/* ============================================
   AI Chat Hub - Main Stylesheet
   Modern Cyberpunk/Glassmorphism Design
   ============================================ */

:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    /* Secondary Colors */
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    
    /* Neutral Colors */
    --dark-900: #0f0f23;
    --dark-800: #1a1a2e;
    --dark-700: #25253a;
    --dark-600: #2d2d44;
    --dark-500: #3d3d5c;
    
    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Glass Effect */
    --glass-bg: rgba(26, 26, 46, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    /* Model Colors */
    --gpt-color: #10a37f;
    --gemini-color: #4285f4;
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 70px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--dark-900) 0%, var(--dark-800) 50%, var(--dark-900) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-800);
}

::-webkit-scrollbar-thumb {
    background: var(--dark-500);
    border-radius: 4px;
}

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

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary);
    animation: pulse 2s infinite;
}

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

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--dark-600);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.nav-section-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 0.25rem;
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    background: var(--dark-600);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.model-badge {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.model-badge.gpt {
    background: var(--gpt-color);
    color: white;
}

.model-badge.gemini {
    background: var(--gemini-color);
    color: white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

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

.user-details {
    min-width: 0;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    background: var(--dark-600);
    border: none;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

/* ============================================
   Main Content Area
   ============================================ */
.main-with-sidebar {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ============================================
   Chat Interface
   ============================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.chat-header {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.model-selector {
    display: flex;
    gap: 0.5rem;
}

.model-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

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

.model-btn.chatgpt.active {
    border-color: var(--gpt-color);
    background: var(--gpt-color);
}

.model-btn.gemini.active {
    border-color: var(--gemini-color);
    background: var(--gemini-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

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

.message.assistant .message-avatar {
    background: var(--dark-600);
    color: var(--text-primary);
}

.message.assistant.chatgpt .message-avatar {
    background: var(--gpt-color);
    color: white;
}

.message.assistant.gemini .message-avatar {
    background: var(--gemini-color);
    color: white;
}

.message-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(10px);
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
}

.message-content p {
    margin-bottom: 0.75rem;
}

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

.message-content pre {
    background: var(--dark-900);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.message-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
}

.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

.chat-input-container {
    padding: 1.5rem 0;
    border-top: 1px solid var(--glass-border);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0.75rem;
    backdrop-filter: blur(10px);
    transition: var(--transition-fast);
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0.5rem;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px var(--primary-glow);
}

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

/* ============================================
   Admin Dashboard
   ============================================ */
.admin-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-header {
    margin-bottom: 2rem;
}

.admin-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.admin-subtitle {
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    color: white;
}

.stat-icon.warning {
    background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
    color: white;
}

.stat-icon.info {
    background: linear-gradient(135deg, var(--gemini-color) 0%, #1d4ed8 100%);
    color: white;
}

.stat-trend {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.stat-trend.up {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.stat-trend.down {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--dark-700);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-input.password-input {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.1em;
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-secondary {
    background: var(--dark-600);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--dark-500);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* API Key Cards */
.api-key-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.api-key-card {
    background: var(--dark-700);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.api-key-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.api-key-icon.chatgpt {
    background: var(--gpt-color);
    color: white;
}

.api-key-icon.gemini {
    background: var(--gemini-color);
    color: white;
}

.api-key-info {
    flex: 1;
    min-width: 0;
}

.api-key-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.api-key-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.api-key-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.api-key-status.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.api-key-status.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.api-key-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    box-shadow: var(--glass-shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary);
    animation: pulse 2s infinite;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
}

.auth-form .form-group:last-of-type {
    margin-bottom: 1.5rem;
}

.auth-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--secondary);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent);
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tr:hover td {
    background: var(--dark-700);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.welcome-icon {
    font-size: 5rem;
    color: var(--primary);
    margin-bottom: 2rem;
    animation: float 3s ease-in-out infinite;
}

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

.welcome-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.welcome-text {
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 2rem;
}

.welcome-models {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.welcome-model {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.welcome-model:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
}

.welcome-model.chatgpt:hover {
    border-color: var(--gpt-color);
}

.welcome-model.gemini:hover {
    border-color: var(--gemini-color);
}

.welcome-model-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.welcome-model.chatgpt .welcome-model-icon {
    background: var(--gpt-color);
    color: white;
}

.welcome-model.gemini .welcome-model-icon {
    background: var(--gemini-color);
    color: white;
}

.welcome-model-name {
    font-weight: 600;
}

.welcome-model-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-with-sidebar {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
        background: var(--glass-bg);
        border-bottom: 1px solid var(--glass-border);
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .mobile-menu-btn {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
    }
}

@media (max-width: 640px) {
    .auth-card {
        padding: 1.5rem;
    }

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

    .chat-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .model-selector {
        width: 100%;
    }

    .model-btn {
        flex: 1;
        justify-content: center;
    }

    .message {
        max-width: 95%;
    }

    .api-key-card {
        flex-direction: column;
        text-align: center;
    }

    .api-key-actions {
        width: 100%;
        justify-content: center;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

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

.toast.success {
    border-color: var(--secondary);
}

.toast.error {
    border-color: var(--danger);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: auto;
}

/* Sidebar Fixes */
.sidebar-nav .nav-section {
    margin-bottom: 1.5rem;
}

.sidebar-nav .nav-section-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    margin: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-primary);
}

.sidebar-nav .nav-item.active {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary);
}

.sidebar-nav .nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-item .badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 9999px;
}

.sidebar-nav .nav-item .badge-gpt {
    background: #10A37F;
    color: white;
}


/* Sidebar Fixes */
.sidebar-nav .nav-section {
    margin-bottom: 1.5rem;
}

.sidebar-nav .nav-section-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    margin: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-primary);
}

.sidebar-nav .nav-item.active {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary);
}

.sidebar-nav .nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-item .badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 9999px;
}

.sidebar-nav .nav-item .badge-gpt {
    background: #10A37F;
    color: white;
}


.sidebar-nav .nav-item .badge-gem {
    background: #4285F4;
    color: white;
}

.sidebar-footer .user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

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

.sidebar-footer .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-footer .user-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.sidebar-footer .user-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-footer .logout-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.sidebar-footer .logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.sidebar-footer .logout-form {
    margin: 0;
}

/* Force vertical sidebar layout */
.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav .nav-section {
    display: flex;
    flex-direction: column;
}

.sidebar-nav .nav-item {
    display: flex !important;
    width: 100%;
}

.nav-section-title {
    display: block !important;
    width: 100%;
}

/* Fix main content area */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 260px;
    z-index: 100;
}

.admin-container,
.chat-container {
    padding-left: 1rem;
}
