/* ============================================
   Persian AI Shopping Bot - Management Panel
   Modern Windows 11 Fluent Design
   ============================================ */

:root {
    /* Light Theme */
    --primary: #4A90D9;
    --primary-hover: #357ABD;
    --primary-light: #E8F0FE;
    --secondary: #2E5D8A;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;

    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-hover: #F8FAFD;

    --text-primary: #1A1A2E;
    --text-secondary: #7F8C8D;
    --text-muted: #95A5A6;

    --border: #E0E6ED;
    --border-light: #F0F0F0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --font-family: 'Hamishe', 'Vazirmatn', 'Tahoma', sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1A1A2E;
    --bg-secondary: #16213E;
    --bg-sidebar: #0F1729;
    --bg-card: #1E293B;
    --bg-hover: #283142;

    --text-primary: #ECF0F1;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    --border: #2C3E50;
    --border-light: #1E293B;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.4);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============ Sidebar ============ */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: var(--shadow);
    z-index: 100;
}

.sidebar.collapsed {
    width: 70px;
    min-width: 70px;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.logo-text h2 {
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--text-primary);
}

.logo-text p {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
    font-size: var(--font-size-sm);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: bold;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 3px;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
}

.theme-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.version-info {
    text-align: center;
    margin-top: 12px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ============ Top Bar ============ */
.topbar {
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-card);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--bg-hover);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: bold;
}

.status-indicator.online {
    background: #F0FFF0;
    color: var(--success);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(39, 174, 96, 0); }
    100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

.icon-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.icon-button:hover {
    background: var(--bg-hover);
}

/* ============ Main Content ============ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.page-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* ============ Stats Grid ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.stat-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
}

.stat-info h3 {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--text-primary);
}

.online-text {
    color: var(--success) !important;
}

/* ============ Charts ============ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

.chart-card h3 {
    font-size: var(--font-size-lg);
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* ============ Buttons ============ */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* ============ Filter Bar ============ */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 150px;
}

/* ============ Table ============ */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table thead {
    background: var(--bg-hover);
}

.modern-table th {
    padding: 14px 16px;
    text-align: right;
    font-size: var(--font-size-sm);
    font-weight: bold;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.modern-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-size-sm);
}

.modern-table tbody tr {
    transition: var(--transition-fast);
}

.modern-table tbody tr:hover {
    background: var(--bg-hover);
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: bold;
    display: inline-block;
}

.badge-success {
    background: #F0FFF0;
    color: var(--success);
}

.badge-danger {
    background: #FFF0F0;
    color: var(--danger);
}

/* ============ Modal ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: var(--font-size-lg);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

/* ============ Toast ============ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    font-size: var(--font-size-sm);
}

.toast-success {
    border-right: 4px solid var(--success);
}

.toast-error {
    border-right: 4px solid var(--danger);
}

.toast-warning {
    border-right: 4px solid var(--warning);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        right: -260px;
        height: 100vh;
    }

    .sidebar.show {
        right: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ Excel Page ============ */
.excel-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.upload-section {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-section:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-icon {
    font-size: 48px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.excel-preview {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.import-summary {
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}

.excel-history {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* ============ Settings Forms ============ */
.settings-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ============ Backup Page ============ */
.backup-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.backup-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* ============ Stats Details ============ */
.stats-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.detail-card h3 {
    margin-bottom: 12px;
    font-size: var(--font-size-lg);
}

/* ============ Badge Warning ============ */
.badge-warning {
    background: #FFF8F0;
    color: var(--warning);
}

/* ============ Success Button ============ */
.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #219A52;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #C0392B;
}

/* ============================================
   Flow Tracer Styles
   ============================================ */

.cache-icon { background: #e8f5e9; border-radius: 50%; }
.keyword-icon { background: #e3f2fd; border-radius: 50%; }
.sql-icon { background: #fff3e0; border-radius: 50%; }
.failed-icon { background: #ffebee; border-radius: 50%; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    margin: 0;
}

.flow-table-section {
    margin-top: 24px;
}

.flow-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.flow-badge.cache {
    background: #e8f5e9;
    color: #2e7d32;
}

.flow-badge.keyword_high {
    background: #e3f2fd;
    color: #1565c0;
}

.flow-badge.keyword_medium {
    background: #fff8e1;
    color: #f57f17;
}

.flow-badge.sql {
    background: #fff3e0;
    color: #e65100;
}

.flow-badge.failed {
    background: #ffebee;
    color: #c62828;
}

.flow-badge.pending {
    background: #f3e5f5;
    color: #6a1b9a;
}

.score-high {
    color: #2e7d32;
    font-weight: bold;
}

.score-medium {
    color: #f57f17;
    font-weight: bold;
}

.score-low {
    color: #c62828;
    font-weight: bold;
}

.latency-fast {
    color: #2e7d32;
}

.latency-normal {
    color: #1565c0;
}

.latency-slow {
    color: #e65100;
    font-weight: bold;
}

.flow-detail-panel {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-value {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

.flow-diagram {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.8;
    overflow-x: auto;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.flow-arrow {
    color: var(--text-muted);
    margin: 0 8px;
}

.flow-step-pass {
    color: #2e7d32;
}

.flow-step-fail {
    color: #c62828;
}

.flow-step-skip {
    color: var(--text-muted);
}

.flow-detail-panel pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 13px;
}

.flow-detail-panel code {
    font-family: 'Courier New', monospace;
}

#flowTableBody tr {
    cursor: pointer;
    transition: var(--transition-fast);
}

#flowTableBody tr:hover {
    background: var(--bg-hover) !important;
}

#flowTableBody tr.selected {
    background: var(--primary-light) !important;
    border-left: 3px solid var(--primary);
}

/* ============================================
   Chat Playground Styles
   ============================================ */

.chat-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 400px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

.chat-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bubble-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-bubble.user .bubble-avatar {
    background: var(--primary-light);
}

.chat-bubble.bot .bubble-avatar {
    background: #f0f0f0;
}

.bubble-content {
    background: var(--bg-hover);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    position: relative;
}

.chat-bubble.user .bubble-content {
    background: var(--primary);
    color: white;
}

.bubble-content p {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: 1.6;
    white-space: pre-wrap;
}

.bubble-time {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: left;
}

.chat-bubble.user .bubble-time {
    color: rgba(255,255,255,0.7);
}

.bubble-meta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-bubble.user .bubble-meta {
    border-top-color: rgba(255,255,255,0.2);
}

.meta-item {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-primary);
    border-radius: 4px;
    color: var(--text-secondary);
}

.chat-bubble.user .meta-item {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}

.chat-input-area {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    resize: none;
    outline: none;
    transition: var(--transition-fast);
    max-height: 120px;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.chat-status {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status.typing {
    color: var(--primary);
}

.chat-status.error {
    color: var(--danger);
}

.typing-dots::after {
    content: '';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}
