/* ==================== RESET & BASE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* رنگ‌های تم روشن */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    
    /* رنگ‌های متن */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    /* رنگ‌های پس‌زمینه */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-input: #ffffff;
    
    /* سایه‌ها */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* حاشیه‌ها */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* فاصله‌ها */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* فونت‌ها */
    --font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
}

/* تم تیره */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-light: #9ca3af;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --bg-sidebar: #1f2937;
    --bg-input: #374151;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease;
    overflow-x: hidden;
}

/* ==================== LAYOUT ==================== */
.main-container {
    display: flex;
    height: calc(100vh - 64px);
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

/* ==================== NAVBAR ==================== */
.navbar {
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    height: 64px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 var(--space-lg);
    max-width: 100%;
    margin: 0 auto;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.nav-brand i {
    font-size: var(--font-size-2xl);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.nav-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

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

.sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.btn-new-chat {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    transition: all 0.2s ease;
}

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

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.conversation-item {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all 0.2s ease;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

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

.conversation-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.conversation-item i {
    font-size: var(--font-size-lg);
}

.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-lg);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-details small {
    color: var(--text-light);
    font-size: var(--font-size-xs);
}

.btn-settings {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.btn-settings:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ==================== CHAT SECTION ==================== */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

.chat-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--bg-tertiary);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.chat-title h2 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xl);
    color: var(--text-primary);
}

.status-badge {
    background: var(--success);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.model-select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    min-width: 180px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.api-key-input {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.api-key-input input {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    width: 250px;
    transition: all 0.2s ease;
}

.api-key-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-save-key {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: all 0.2s ease;
}

.btn-save-key:hover {
    background: var(--primary-dark);
}

/* ==================== CHAT CONTAINER ==================== */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: var(--space-lg);
    animation: fadeIn 0.3s ease;
    max-width: 90%;
}

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

.ai-message {
    align-self: flex-start;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--font-size-lg);
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, var(--secondary) 0%, #34d399 100%);
    color: white;
}

.message-content {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--bg-tertiary);
    overflow: hidden;
}

.user-message .message-content {
    background: var(--primary);
    color: white;
    border-top-right-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-xl);
}

.ai-message .message-content {
    border-top-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-xl);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--bg-tertiary);
}

.user-message .message-header {
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.sender-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.message-time {
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-text {
    line-height: 1.8;
    font-size: var(--font-size-base);
}

.message-text p {
    margin-bottom: var(--space-md);
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-hint {
    background: var(--bg-tertiary);
    border-right: 4px solid var(--warning);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-top: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.user-message .message-hint {
    background: rgba(255, 255, 255, 0.1);
}

.message-hint i {
    color: var(--warning);
    font-size: var(--font-size-lg);
    margin-top: 2px;
}

.message-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--bg-tertiary);
}

.user-message .message-actions {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.action-btn {
    background: var(--bg-tertiary);
    border: none;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all 0.2s ease;
}

.user-message .action-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.user-message .action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== INPUT SECTION ==================== */
.input-section {
    padding: var(--space-lg);
    border-top: 1px solid var(--bg-tertiary);
    background: var(--bg-secondary);
}

.input-container {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
    background: var(--bg-input);
    border: 1px solid var(--bg-tertiary);
    border-radius: var(--radius-xl);
    padding: var(--space-md);
    transition: all 0.2s ease;
}

.input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.action-buttons {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.text-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

textarea {
    border: none;
    background: none;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    resize: none;
    line-height: 1.6;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-xs) 0;
    width: 100%;
}

textarea:focus {
    outline: none;
}

.input-hints {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.hint {
    background: var(--bg-tertiary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-base);
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 100px;
    justify-content: center;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-light);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.token-info {
    background: var(--bg-tertiary);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-weight: 500;
}

.disclaimer {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--warning);
}

.disclaimer i {
    font-size: var(--font-size-base);
}

/* ==================== INFO PANEL ==================== */
.info-panel {
    width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

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

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.btn-close-panel {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.btn-close-panel:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.stat-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    border: 1px solid var(--bg-tertiary);
    transition: all 0.2s ease;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-xl);
}

.stat-details {
    flex: 1;
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.instructions {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--bg-tertiary);
}

.instructions h4 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.instructions ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.instructions li {
    padding-right: var(--space-lg);
    position: relative;
    color: var(--text-secondary);
    line-height: 1.6;
}

.instructions li:before {
    content: "•";
    color: var(--primary);
    font-size: var(--font-size-xl);
    position: absolute;
    right: 0;
    top: -2px;
}

.api-status {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--bg-tertiary);
}

.api-status h4 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--success);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    width: fit-content;
}

.status-note {
    display: block;
    margin-top: var(--space-md);
    color: var(--text-light);
    font-size: var(--font-size-xs);
}

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--bg-tertiary);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: 60vh;
}

.modal-body ol {
    padding-right: var(--space-lg);
    margin: var(--space-lg) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.modal-body li {
    padding: var(--space-sm) 0;
    color: var(--text-secondary);
}

.api-input-group {
    display: flex;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.api-key-input-full {
    flex: 1;
    padding: var(--space-md);
    border: 2px solid var(--bg-tertiary);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
}

.api-key-input-full:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-test-api {
    background: var(--secondary);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-test-api:hover {
    background: #0da271;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--bg-tertiary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

/* ==================== UTILITY CLASSES ==================== */
.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: var(--font-size-lg);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(10deg);
}

.connected {
    background: var(--success);
}

.disconnected {
    background: var(--danger);
}

.loading {
    background: var(--warning);
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 1200px) {
    .main-container {
        height: calc(100vh - 64px);
    }
    
    .sidebar {
        width: 240px;
    }
    
    .info-panel {
        width: 280px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        right: -100%;
        top: 64px;
        height: calc(100vh - 64px);
        z-index: 1000;
        width: 280px;
    }
    
    .sidebar.active {
        right: 0;
    }
    
    .info-panel {
        position: fixed;
        left: -100%;
        top: 64px;
        height: calc(100vh - 64px);
        z-index: 1000;
        width: 280px;
    }
    
    .info-panel.active {
        left: 0;
    }
    
    .chat-section {
        margin: 0;
    }
    
    .model-selector {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .api-key-input input {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 var(--space-md);
    }
    
    .nav-brand span {
        display: none;
    }
    
    .chat-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    
    .chat-title {
        justify-content: center;
        text-align: center;
    }
    
    .model-selector {
        gap: var(--space-sm);
    }
    
    .api-key-input {
        flex-direction: column;
    }
    
    .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .text-input-wrapper {
        order: 2;
    }
    
    .send-btn {
        order: 3;
        width: 100%;
    }
    
    .message {
        max-width: 100%;
    }
    
    .input-footer {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
    
    .modal-content {
        width: 95%;
        margin: var(--space-md);
    }
}

@media (max-width: 480px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 1.5rem;
    }
    
    .nav-brand {
        font-size: var(--font-size-lg);
    }
    
    .chat-title h2 {
        font-size: var(--font-size-lg);
    }
    
    .message-content {
        padding: var(--space-md);
    }
    
    .stat-box {
        padding: var(--space-md);
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: var(--font-size-lg);
    }
    
    .stat-value {
        font-size: var(--font-size-xl);
    }
}

/* ==================== SCROLLBAR STYLING ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ==================== ANIMATIONS ==================== */
@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.loading-shimmer {
    background: linear-gradient(90deg, 
        var(--bg-tertiary) 25%, 
        var(--bg-secondary) 50%, 
        var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .navbar,
    .sidebar,
    .info-panel,
    .input-section,
    .action-buttons,
    .message-actions {
        display: none !important;
    }
    
    .main-container {
        display: block;
        height: auto;
    }
    
    .chat-section {
        display: block;
    }
    
    .chat-container {
        overflow: visible;
        padding: 0;
    }
    
    .message {
        break-inside: avoid;
        max-width: 100%;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}