* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-top: 0;
}

/* Ensure container accounts for fixed sidebar */
.container {
    display: flex;
    flex: 1;
    min-height: 0;
    background-color: #fafaf8;
    margin-left: 80px; /* Account for fixed left sidebar */
}

/* Smooth theme transitions for theme-aware elements */
body, .global-footer, .footer-column-title, .footer-link, .footer-divider, .footer-copyright,
.sidebar, .right-sidebar, .menu-btn, .search-box, .model-selection, .history-section,
.chat-input-box, .balance-info {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Theme: dark mode root toggles */
.theme-dark body, body.theme-dark {
    background-color: #0f172a;
    color: #e2e8f0;
    /* Show animated background only in dark mode */
    background-image: url('../assets/video-ezgif.com-optimize.gif');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
}

/* Hide background image on main page */
body.page-main {
    background-image: none;
}

/* Payment page specific - ensure scrolling works */
body.page-main.no-right-panel .main-content {
    overflow-y: auto;
    overflow-x: hidden;
    justify-content: flex-start;
    align-items: flex-start;
    padding-top: 16px;
    padding-bottom: 32px;
    margin-right: 0; /* Remove right margin when no right panel */
}

/* Dark theme - prevent flash by targeting html and body */
html.theme-dark,
html.theme-dark body,
.theme-dark { 
    background-color: #0f172a !important; 
    color: #e2e8f0; 
}

.theme-dark .container { background-color: transparent; }
.theme-dark .sidebar, .theme-dark .right-sidebar, .theme-dark .powered-by-section { background-color: #0f172a; }
.theme-dark .search-box, .theme-dark .model-selection, .theme-dark .history-section, .theme-dark .chat-input-box { background: #0b1220; border-color: #1e293b; }
.theme-dark .history-item:hover { background: #0b1220; }
.theme-dark .menu-btn { color: #cbd5e1; }
.theme-dark .menu-btn:hover { color: #e2e8f0; }
.theme-dark .chat-message.assistant .message-content { background: #0b1220; border-color: #1f2937; color: #e5e7eb; }
.theme-dark .chat-message.user .message-content { background: #132a2a; color: #c7f2ef; }
.theme-dark .balance-info { box-shadow: none; }
.theme-dark .history-title { color: #e2e8f0; }
.theme-dark .history-date { color: #94a3b8; }
.theme-dark .search-input { color: #e2e8f0; }
.theme-dark .email-input,
.theme-dark .student-code-char,
.theme-dark .verification-input,
.theme-dark .confirmation-code-char {
    background: #0b1220;
    border-color: #334155;
    color: #e2e8f0;
}
.theme-dark .email-input::placeholder,
.theme-dark .verification-input::placeholder { color: #94a3b8; }
.theme-dark .search-input::placeholder { color: #64748b; }
.theme-dark .chat-input-icon { stroke: #94a3b8; }
.theme-dark .menu-btn.active { box-shadow: none; }
.theme-dark .history-delete { color: #94a3b8; }

/* Hide the inactive icon for theme toggle */
.icon-moon { 
    display: none; 
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.icon-sun {
    display: block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.theme-dark .icon-sun { 
    display: none; 
}
.theme-dark .icon-moon { 
    display: block; 
}

/* Payment header */
.payment-header { width: 100%; display: flex; align-items: center; justify-content: space-between; margin: 16px 0; }
.payment-header-left { display: flex; align-items: center; gap: 8px; }
.payment-title { font-size: 18px; color: #1f2937; }
.theme-dark .payment-title { color: #e2e8f0; }

/* Left Sidebar */
.sidebar {
    width: 80px;
    background-color: #fafaf8;
    border-right: 1px outset #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}


.logo {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.logo svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.sidebar-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 24px;
    transition: background-color 0.2s;
}

.sidebar-btn:hover {
    background-color: #f1f5f9;
}

.sidebar-btn svg {
    width: 20px;
    height: 20px;
    stroke: #6b7280;
    fill: none;
    stroke-width: 2;
}

.sidebar-btn.active svg {
    stroke: #3a5556;
}

/* Left menu (moved from right sidebar) */
.sidebar .left-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-bottom: 120px; /* reserve space for bottom-pinned controls (logout + language) */
}
.sidebar .left-menu .menu-btn {
    min-width: 40px;
    min-height: 40px;
}
.sidebar .left-menu .language-selector {
    margin-bottom: 0;
}

/* Pin language selector to bottom of left menu */
#languageSelectorLeft {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100001; /* Ensure it's above sidebar */
}

/* Pin theme toggle above language selector */
#leftThemeToggleBtn {
    position: absolute;
    bottom: 64px;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0;
}

#leftThemeToggleBtn .menu-icon {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#leftThemeToggleBtn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateX(-50%) scale(1.05);
}

.theme-dark #leftThemeToggleBtn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#leftThemeToggleBtn:active {
    transform: translateX(-50%) scale(0.95);
}

#languageSelectorLeft .lang-dropdown {
    position: fixed;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100000;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    padding: 6px;
}

/* Dropdown when moved to body (for left sidebar) */
body > .lang-dropdown {
    position: fixed !important;
    z-index: 99999 !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.08) !important;
    padding: 6px !important;
    min-width: 180px !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
}

.theme-dark body > .lang-dropdown {
    background: #0b1220 !important;
    border-color: #1e293b !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.35) !important;
}

.theme-dark #languageSelectorLeft .lang-dropdown {
    background: #0b1220;
    border-color: #1e293b;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* Pin logout above theme toggle */
.sidebar .left-menu .logout-btn {
    position: absolute;
    bottom: 112px;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* hidden by default */
}

/* Show logout only when authenticated */
body.auth-logged-in .sidebar .left-menu .logout-btn {
    display: flex;
}

/* Show auth-required menu items only when authenticated */
body.auth-logged-in .auth-required {
    display: flex !important;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.nav-label {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.nav-item.active .nav-label {
    color: #3a5556;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-right: 320px; /* Account for fixed right sidebar */
    align-items: center;
    justify-content: center;
    padding: 0 32px;
    min-height: 110vh; /* Increased by 10% to push footer down */
}

/* Remove right margin when no right panel */
body.no-right-panel .main-content {
    margin-right: 0;
}

/* Chat mode layout: scrollable messages with input docked at bottom */
.main-content.chat-mode {
    justify-content: flex-start;
}

.chat-interface {
    width: 100%;
    /* Grow with viewport on large screens but cap at a comfortable max */
    max-width: clamp(920px, 70vw, 1400px);
    height: calc(100vh - 32px); /* account for vertical padding */
    display: flex;
    flex-direction: column;
}

/* Ultra-wide screens: allow a bit more width */
@media (min-width: 1800px) {
    .chat-interface { max-width: clamp(1100px, 75vw, 1600px); }
}

/* Billing page */
.billing-container { 
  padding: 24px; 
  max-width: 920px; 
  margin: 0 auto;
  overflow-y: auto;
  min-height: 100%;
}
.billing-title { font-size: 24px; font-weight: 700; margin-bottom: 16px; color: #1f2937; }
.billing-plans { 
  display: grid; 
  grid-template-columns: repeat(3, 1fr); 
  gap: 16px;
  justify-items: center;
  justify-content: center;
  max-width: 960px;
  margin: 0 auto;
}
/* Center single card */
.billing-plans:has(:nth-child(1):last-child),
.billing-plans.single-plan {
  grid-template-columns: 1fr;
  max-width: 300px;
  margin: 0 auto;
}
/* Spread 2 cards left and right */
.billing-plans:has(:nth-child(2):last-child),
.billing-plans.two-plans {
  grid-template-columns: repeat(2, 1fr);
  max-width: 620px;
  margin: 0 auto;
  justify-content: space-between;
}

/* Payment Hero Section */
.payment-hero {
  background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 50%, #e0e7ff 100%);
  border-radius: 16px;
  padding: 40px 32px;
  margin-bottom: 32px;
  text-align: center;
}

.payment-hero-supports {
  margin-bottom: 24px;
}

.supports-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-models {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.ai-model-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-model-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gpt-logo {
  background: #000;
  position: relative;
}

.gpt-logo::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 2px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.claude-logo {
  background: #d4a574;
  position: relative;
}

.claude-logo::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #d4a574, 0 0 0 4px #fff;
}

.gemini-logo {
  background: #fff;
  border: 2px solid #ea4335;
  position: relative;
}

.gemini-logo::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #ea4335;
}

.ai-model-name {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.payment-hero-title {
  font-size: 36px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 20px;
  line-height: 1.2;
}

.payment-hero-tagline {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 500;
  color: #4b5563;
}

.payment-hero-tagline span {
  padding: 4px 0;
}

/* Dark theme for payment hero */
.theme-dark .payment-hero {
  background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 50%, #4338ca 100%);
}

.theme-dark .supports-label {
  color: #cbd5e1;
}

.theme-dark .ai-model-badge {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-dark .ai-model-name {
  color: #e5e7eb;
}

.theme-dark .payment-hero-title {
  color: #f9fafb;
}

.theme-dark .payment-hero-tagline {
  color: #d1d5db;
}

/* Responsive design for payment hero */
@media (max-width: 768px) {
  .payment-hero {
    padding: 32px 24px;
  }

  .payment-hero-title {
    font-size: 28px;
  }

  .ai-models {
    gap: 12px;
  }

  .ai-model-badge {
    padding: 6px 12px;
  }

  .ai-model-name {
    font-size: 12px;
  }

  .payment-hero-tagline {
    font-size: 13px;
    gap: 8px;
  }

  .payment-hero-tagline span {
    display: block;
  }
}
.plan-card { 
  background: #fff; 
  border: 1px solid #e5e7eb; 
  border-radius: 12px; 
  padding: 16px; 
  text-align: center; 
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 300px;
  min-height: 400px;
}
.plan-card h3 { font-size: 18px; color: #111827; margin-bottom: 8px; }
.plan-price { color: #374151; margin-bottom: 8px; }
.plan-cost { font-weight: 700; margin-bottom: 12px; }
.plan-features { 
  list-style: none; 
  padding: 0; 
  margin: 8px 0 12px 0; 
  text-align: left; 
  color: #374151; 
  font-size: 14px;
  flex-grow: 1;
}
.plan-features li { margin: 4px 0; position: relative; padding-left: 18px; }
.plan-features li::before { content: '✓'; position: absolute; left: 0; top: 0; color: #10b981; }
.plan-buy { 
  width: 100%; 
  margin-top: auto;
  padding-top: 12px;
}
.billing-note { color: #6b7280; font-size: 12px; margin-top: 12px; text-align: center; }
.theme-dark .plan-card { background: #0b1220; border-color: #1e293b; }
.theme-dark .billing-title { color: #e2e8f0; }
.theme-dark .plan-card h3 { color: #e2e8f0; }
.theme-dark .plan-price { color: #cbd5e1; }
.theme-dark .plan-cost { color: #e5e7eb; }
.theme-dark .plan-features { color: #e5e7eb; }
.theme-dark .plan-features li { color: #e5e7eb; }
.theme-dark .billing-note { color: #9ca3af; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 8px 24px 8px;
}

.chat-input-container {
    position: sticky;
    bottom: 0;
    background: #fafaf8;
    padding: 8px 0 16px 0;
}

/* Dark mode background for the input area container */
.theme-dark .chat-input-container {
    background: #0f172a;
}

.chat-input-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: text; /* indicate text focus area */
}

.chat-input-icon {
    width: 20px;
    height: 20px;
    stroke: #9aa8a7;
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    resize: none;
    overflow-y: auto;
}

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-cowboy-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}
.chat-cowboy-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
}
.chat-cowboy-btn svg { stroke: white; }
.chat-cowboy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.chat-submit-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}
.chat-submit-btn svg { stroke: white; }

/* Chat messages */
.chat-message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.chat-message .message-content {
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
    padding: 10px 12px;
    border-radius: 10px;
}

.chat-message.user .message-content {
    background: #e6f4f1;
    color: #1f3b3c;
}

.chat-message.assistant .message-content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
}

/* Styled code blocks with copy button */
.code-block {
    position: relative;
}
.code-block pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    overflow: auto;
}
.code-block .code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: #111827;
    color: #e5e7eb;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    opacity: 0.85;
}
.code-block .code-copy-btn:hover { opacity: 1; }
.code-block .code-copy-btn.copied { background: #14532d; color: #fff; }

.message-streaming {
    opacity: 0.95;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.message-timestamp {
    font-size: 11px;
    color: #6b7280;
}

.message-token-cost {
    font-size: 11px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-token-cost svg {
    color: #f59e0b;
    opacity: 0.8;
}

.theme-dark .message-token-cost {
    color: #94a3b8;
}

.theme-dark .message-token-cost svg {
    color: #fbbf24;
}

.new-chat-btn {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
}

/* Typing indicator animation */
.typing-indicator { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: #9aa8a7; animation: typing 1s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* Tighter history list */
.history-item { padding: 10px 16px; }
.history-title { margin-bottom: 2px; }
.history-date { font-size: 11px; }

/* Copy button styling */
.copy-btn { align-self: flex-end; border: none; background: transparent; cursor: pointer; padding: 2px; margin-top: -4px; opacity: 0.6; }
.copy-btn:hover { opacity: 1; }
.copy-btn.copied { color: #16a34a; opacity: 1; }

/* Edit button styling */
.edit-btn { align-self: flex-end; border: none; background: transparent; cursor: pointer; padding: 2px; margin-top: -6px; opacity: 0.6; margin-left: auto; }
.edit-btn:hover { opacity: 1; }

.perplexity-logo {
    font-size: 98px;
    font-weight: 600;
    color: #2d3748;
    letter-spacing: -0.025em;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
}

/* (removed) top action buttons */

.welcome-screen {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-container {
    width: 100%;
    /* Smoothly scale with viewport */
    max-width: clamp(420px, 45vw, 1800px);
    margin-bottom: 24px;
    margin-left: auto;
    margin-right: auto;
    transition: max-width 150ms ease;
    will-change: max-width;
}

/* Sidebar balance display */
.user-balance-sidebar {
    padding: 16px 24px;
    margin-bottom: 12px; /* sit just above powered by */
    margin-top: auto; /* pin balance to bottom, above powered by */
}

/* Admin user switch styling */
.admin-user-switch {
    padding: 2px 6px;
    margin: 2px 0px 0 0px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.theme-dark .admin-user-switch { background: #0b1220; border-color: #1e293b; }

.admin-user-switch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.admin-user-label { font-size: 12px; font-weight: 700; color: #374151; }
.theme-dark .admin-user-label { color: #e2e8f0; }

.impersonation-badge {
    font-size: 11px;
    color: #0f766e;
    background: #ecfeff;
    border: 1px solid #99f6e4;
    border-radius: 9999px;
    padding: 2px 8px;
}
.theme-dark .impersonation-badge { color: #5eead4; background: #042f2e; border-color: #155e75; }

.admin-user-select {
    flex: 1;
    background: white;
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s;
}
.admin-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-user-select:hover { border-color: #3a5556; }
.admin-user-select:focus { outline: none; border-color: #3a5556; box-shadow: 0 0 0 3px rgba(58,85,86,0.1); }
.theme-dark .admin-user-select { background: #0b1220; border-color: #334155; color: #e2e8f0; }

.admin-stop-impersonate {
    margin-top: 8px;
    width: 100%;
    border: 1px solid #ef4444;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
}
.admin-stop-impersonate:hover { background: #fee2e2; }
.theme-dark .admin-stop-impersonate { background: #2a0d0d; color: #fecaca; border-color: #7f1d1d; }

.user-balance-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.balance-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-align: center;
    width: 100%;
}



.balance-tokens {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.balance-value {
    color: white;
    font-size: 18px;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    line-height: 1;
}

.balance-label {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.balance-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.balance-type-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
}

.balance-type-value {
    color: white;
    font-size: 13px;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.token-estimate-container {
    display: flex;
    justify-content: right;
    margin-top: 6px;
}

.estimate-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 13px;
}
.theme-dark .estimate-info { background: #0b1220; border-color: #1f2937; }

.estimate-label {
    color: #64748b;
    font-weight: 500;
}
.theme-dark .estimate-label { color: #cbd5e1; }

.estimate-value {
    color: #1e293b;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}
.theme-dark .estimate-value { color: #e2e8f0; }

.estimate-cost {
    color: #64748b;
    font-weight: 500;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, width 150ms ease;
    padding: 0 16px;
    /* Enhanced with modern styling */
    width: 100%;
}

.search-box:hover { border-color: #d7e3e2; }

.search-box:focus-within { border-color: #20b2aa; }

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .search-container, .search-box { transition: none; }
}

.search-icon {
    width: 18px;
    height: 18px;
    stroke: #9aa8a7;
    margin-right: 12px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 16px 16px;
    background: transparent;
    color: #1f2937;
    resize: none;
    overflow-y: auto;
}

.search-input::placeholder {
    color: #9aa8a7;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #f1f5f9;
}

.action-btn svg {
    width: 16px;
    height: 16px;
    stroke: #9aa8a7;
    fill: none;
    stroke-width: 2;
}

.search-cowboy-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4) !important;
    transition: all 0.2s ease !important;
}
.search-cowboy-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6) !important;
}
.search-cowboy-btn svg {
    stroke: white !important;
}
.search-cowboy-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.submit-btn {
    background: #667eea !important;
    margin-left: 8px;
    border-radius: 8px !important;
    transition: background-color 0.2s ease !important;
}

.submit-btn:hover { background: #5a6fd8 !important; }

.submit-btn svg {
    stroke: white !important;
}

/* Category Chips */
/* Optional quick chips (hidden by default) */
.category-chips { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 640px; }

.chip {
    padding: 12px 24px;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.chip::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.chip:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e1;
}

.chip:hover::before {
    left: 100%;
}

/* Right Sidebar */
.right-sidebar {
    width: 320px;
    background-color: #fafaf8;
    border-left: 1px outset #e5e7eb;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    /* Replacement for Tailwind's shadow-lg */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* Hide right sidebar when not present */
body.no-right-panel .right-sidebar {
    display: none;
}

/* Scale right sidebar on large screens and adjust main-content/footer margins accordingly */
@media (min-width: 1440px) {
    .right-sidebar { width: 360px; }
    .main-content {
        margin-right: 360px;
    }
    .global-footer-container {
        width: calc(100% - 80px - 360px);
        margin-right: 360px;
    }
    body.no-right-panel .main-content {
        margin-right: 0;
    }
    body.no-right-panel .global-footer-container {
        width: calc(100% - 80px);
        margin-right: 0;
    }
}
@media (min-width: 1800px) {
    .right-sidebar { width: 400px; }
    .main-content {
        margin-right: 400px;
    }
    .global-footer-container {
        width: calc(100% - 80px - 400px);
        margin-right: 400px;
    }
    body.no-right-panel .main-content {
        margin-right: 0;
    }
    body.no-right-panel .global-footer-container {
        width: calc(100% - 80px);
        margin-right: 0;
    }
}

.sign-in-container {
    padding: 24px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Login page top actions (theme + billing) */
.login-top-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }
.login-top-actions .menu-btn { min-width: 40px; min-height: 40px; }

.sign-in-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.sign-in-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 32px;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-btn {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.google-btn {
    background-color: #4285f4;
    color: white;
}

.google-btn:hover {
    background-color: #3367d6;
}

.apple-btn {
    background-color: black;
    color: white;
}

.apple-btn:hover {
    background-color: #1f2937;
}

.divider {
    position: relative;
    margin: 4px 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #e5e7eb;
}

.theme-dark .divider::before {
    background-color: #475569;
}

.divider span {
    background-color: #fafaf8;
    padding: 0 12px;
    font-size: 14px;
    color: #6b7280;
    position: relative;
}

.theme-dark .divider span {
    background-color: #10172a;
    color: #94a3b8;
}

.email-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 12px;
    color: #111827;
}

.email-input:focus {
    border-color: #20b2aa;
    box-shadow: 0 0 0 1px #20b2aa;
}

.email-btn {
    background-color: #20b2aa;
    color: white;
}

.email-btn:hover {
    background-color: #1a9a93;
}

.sso-text {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 24px;
}

/* Student Code Styles */
.student-code-group {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 12px;
}

.student-code-char {
    width: 32px;
    height: 40px;
    text-align: center;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #111827;
}

.student-code-char:focus {
    border-color: #20b2aa;
    outline: none;
}

.hyphen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    font-size: 16px;
    color: #374151;
    margin: 0 2px;
    line-height: 1;
}

.register-btn {
    background-color: #f1f5f9;
    color: #374151;
    margin-top: 8px;
}


.perplexity-logo-img {
    height: 156px;
    vertical-align: text-bottom;
    margin-right: 16px;
}

.perplexity-logo-span {
    color: #63006B;
}

.powered-by-img {
    max-width: 100%;
    height: auto;
}

/* Mobile Touch Support */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Ensure body allows scrolling on mobile */
@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Allow text selection in content areas */
.chat-message .message-content,
.search-input,
.chat-input,
.email-input,
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Smooth scrolling for touch devices */
.chat-messages,
.history-list,
.main-content,
.right-sidebar {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Touch-friendly scrollbars on mobile */
@media (max-width: 768px) {
    .chat-messages::-webkit-scrollbar,
    .history-list::-webkit-scrollbar {
        width: 6px;
    }
    
    .chat-messages::-webkit-scrollbar-track,
    .history-list::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .chat-messages::-webkit-scrollbar-thumb,
    .history-list::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }
    
    .theme-dark .chat-messages::-webkit-scrollbar-thumb,
    .theme-dark .history-list::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Touch-friendly button sizes */
.sidebar-btn,
.menu-btn,
.chip,
.auth-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Mobile Navigation */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.theme-dark .mobile-nav-toggle {
    background: rgba(30, 41, 59, 0.9);
    border-color: #475569;
    color: #e2e8f0;
}

.theme-dark .mobile-nav-toggle:hover {
    background: rgba(30, 41, 59, 1);
}

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* =====================================================
   MOBILE RESPONSIVE STYLES - App-Style Layout
   ===================================================== */

/* Mobile Header Bar - Always visible with model & balance */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fafaf8;
    border-bottom: 1px solid #e5e7eb;
    z-index: 998;
    padding: 8px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.theme-dark .mobile-header {
    background: #0f172a;
    border-bottom-color: #1e293b;
}

.mobile-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mobile Model Selector in header */
.mobile-model-select {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    max-width: 160px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 6px center;
    background-repeat: no-repeat;
    background-size: 14px;
    cursor: pointer;
}

.theme-dark .mobile-model-select {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

/* Mobile Balance Badge */
.mobile-balance-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.mobile-balance-badge svg {
    width: 14px;
    height: 14px;
}

/* Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #fafaf8;
    border-top: 1px solid #e5e7eb;
    z-index: 998;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.theme-dark .mobile-bottom-nav {
    background: #0f172a;
    border-top-color: #1e293b;
}

.mobile-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 12px;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.theme-dark .mobile-nav-item {
    color: #94a3b8;
}

.theme-dark .mobile-nav-item:hover,
.theme-dark .mobile-nav-item.active {
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.1);
}

/* Right Sidebar as Slide-in Drawer on Mobile */
.mobile-right-drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-right-drawer-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive - Mobile Breakpoint */
@media (max-width: 768px) {
    /* Show mobile-specific elements */
    .mobile-header {
        display: flex;
    }
    
    .mobile-bottom-nav {
        display: block;
    }
    
    .mobile-nav-toggle {
        display: flex;
    }
    
    /* Hide hamburger toggle since we have bottom nav - but keep for left sidebar */
    .mobile-nav-toggle {
        top: 10px;
        left: 10px;
        padding: 6px;
        z-index: 999;
    }

    /* Main Container adjustments */
    .container {
        flex-direction: column;
        min-height: 100vh;
        margin-left: 0;
        padding-top: 60px; /* Account for mobile header */
        padding-bottom: 64px; /* Account for bottom nav */
        overflow-x: hidden;
    }
    
    /* Remove footer margins on mobile */
    .global-footer-container {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        padding-bottom: 80px; /* Extra space for bottom nav */
    }

    /* Left Sidebar - Slide-in drawer from left */
    .sidebar {
        width: 280px;
        height: 100vh;
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        flex-direction: column;
        justify-content: flex-start;
        padding: 24px 0;
        background: #fafaf8;
        border-right: 1px solid #e5e7eb;
        overflow-y: auto;
    }
    
    .theme-dark .sidebar {
        background: #0f172a;
        border-right-color: #334155;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .mobile-sidebar-overlay.active {
        display: block;
    }

    .sidebar-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 24px;
    }

    /* Right Sidebar - Slide-in drawer from right */
    .right-sidebar {
        width: 300px;
        height: 100vh;
        position: fixed;
        right: -300px;
        top: 0;
        z-index: 1002;
        transition: right 0.3s ease;
        background: #fafaf8;
        border-left: 1px solid #e5e7eb;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    .theme-dark .right-sidebar {
        background: #0f172a;
        border-left-color: #1e293b;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .right-sidebar.mobile-open {
        right: 0;
    }

    /* Hide default right sidebar elements that are shown in header/bottom nav */
    .right-sidebar .model-selection {
        display: none; /* Model is in header */
    }
    
    .right-sidebar .user-balance-sidebar {
        display: none; /* Balance is in header badge */
    }

    /* Main Content - Full width, centered */
    .main-content {
        flex: 1;
        padding: 16px;
        margin-right: 0;
        margin-left: 0;
        min-height: calc(100vh - 124px); /* 60px header + 64px bottom nav */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }

    .main-content.chat-mode {
        padding-top: 16px;
        justify-content: flex-start;
    }
    
    /* Welcome screen adjustments */
    .welcome-screen {
        width: 100%;
        padding-top: 20px;
    }

    .perplexity-logo {
        font-size: 36px;
        margin-bottom: 24px;
    }
    
    .perplexity-logo-img {
        height: 100px;
        max-width: 100%;
    }

    /* Search container full width */
    .search-container {
        max-width: 100%;
        width: 100%;
    }

    .search-box {
        padding: 12px 16px;
        min-height: 48px;
    }

    /* Chat interface adjustments */
    .chat-interface {
        max-width: 100%;
        height: calc(100vh - 140px); /* Account for header and bottom nav */
    }

    .chat-input-box {
        padding: 12px 16px;
        min-height: 48px;
    }

    /* Category chips */
    .category-chips {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0 8px;
    }
    
    .chip {
        padding: 10px 16px;
        min-height: 40px;
        font-size: 13px;
        flex: 0 1 auto;
        min-width: auto;
        text-align: center;
    }

    /* Mobile-friendly balance in drawer */
    .balance-info {
        padding: 12px;
    }

    .balance-value {
        font-size: 16px;
    }

    .balance-label {
        font-size: 10px;
    }
    
    .balance-breakdown {
        margin-top: 6px;
        padding-top: 6px;
        gap: 3px;
    }
    
    .balance-type-label {
        font-size: 11px;
    }
    
    .balance-type-value {
        font-size: 12px;
    }
    
    /* Mobile-friendly auth forms */
    .auth-panel {
        padding: 16px;
    }
    
    .email-input {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Improve touch targets for code inputs */
    .student-code-char,
    .confirmation-code-char {
        min-width: 40px;
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Mobile-friendly payment plans */
    .billing-plans {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 100%;
    }
    
    .billing-plans:has(:nth-child(1):last-child),
    .billing-plans:has(:nth-child(2):last-child) {
        max-width: 100%;
    }
    
    .plan-card {
        margin-bottom: 0;
        min-height: auto;
        max-width: 100%;
    }
    
    .plan-buy {
        min-height: 48px;
        font-size: 16px;
    }
    
    /* Pages with no right panel */
    .no-right-panel .main-content {
        margin-right: 0;
        margin-left: 0;
        max-width: 100%;
    }
    
    /* Sign-in container adjustments */
    .sign-in-container {
        min-height: auto;
        padding: 16px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }
    
    .auth-panel {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    /* Powered-by section */
    .powered-by-section {
        position: relative;
        margin-top: auto;
        padding: 16px;
        min-height: 50px;
    }
    
    /* Right sidebar drawer close button */
    .mobile-drawer-close {
        display: flex;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        border: none;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10;
    }
    
    .mobile-drawer-close svg {
        width: 18px;
        height: 18px;
        stroke: #6b7280;
    }
    
    .theme-dark .mobile-drawer-close {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .theme-dark .mobile-drawer-close svg {
        stroke: #94a3b8;
    }
    
    /* History section in mobile drawer */
    .right-sidebar .history-section {
        margin-top: 48px; /* Space for close button */
        flex: 1;
        min-height: 200px;
    }
    
    /* Token estimate container */
    .token-estimate-container {
        justify-content: center;
    }
    
    /* Admin page mobile adjustments */
    .admin-container {
        padding: 16px;
        padding-top: 70px;
        padding-bottom: 80px;
    }
}

/* Small mobile screens */
@media (max-width: 375px) {
    .mobile-model-select {
        max-width: 120px;
        font-size: 12px;
    }
    
    .mobile-balance-badge {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .chip {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .mobile-nav-item {
        padding: 6px 12px;
        font-size: 9px;
    }
    
    .mobile-nav-item svg {
        width: 20px;
        height: 20px;
    }
}

/* Error styling for code input */
.student-code-group.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.error-message {
    color: #ef4444;
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

/* Authenticated interface */
.authenticated-container {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100%;
}

.top-menu {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
    justify-content: space-between;
}

.menu-btn {
    background: none;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.menu-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.menu-icon[src] {
    /* Styles for image icons (like payment icon) */
    object-fit: contain;
    display: block;
}

.menu-btn:hover {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.menu-btn.active .menu-icon {
    stroke: white;
}

.logout-btn {
    color: #ef4444;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.logout-btn .menu-icon {
    stroke: currentColor;
}

/* Language Selector Button */
.language-selector { position: relative; display: inline-block; }
.lang-button { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    width: 40px; 
    height: 40px; 
    padding: 0; 
    border: none; 
    background: transparent; 
    color: inherit; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: box-shadow .2s, transform .1s, background-color .2s; 
    min-width: 0; 
}
.lang-button:hover { 
    box-shadow: 0 2px 8px rgba(0,0,0,.08); 
    transform: translateY(-1px);
    background-color: rgba(0, 0, 0, 0.05);
}
.theme-dark .lang-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.lang-button .menu-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Language Selection Modal */
.language-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.language-modal-overlay.show {
    opacity: 1;
}

.language-modal-content {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.language-modal-overlay.show .language-modal-content {
    transform: scale(1);
}

.language-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.language-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.language-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: background-color 0.2s, color 0.2s;
}

.language-modal-close:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.language-modal-close svg {
    width: 20px;
    height: 20px;
}

.language-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.language-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-card:hover {
    border-color: #667eea;
    background: #f9fafb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.language-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
}

.language-card-flag {
    font-size: 32px;
    line-height: 1;
}

.language-card-name {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.language-card.active .language-card-name {
    color: #667eea;
    font-weight: 600;
}

.language-card-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Dark Theme */
.theme-dark .language-modal-content {
    background: #0b1220;
    border: 1px solid #1e293b;
}

.theme-dark .language-modal-header {
    border-bottom-color: #1e293b;
}

.theme-dark .language-modal-title {
    color: #e2e8f0;
}

.theme-dark .language-modal-close {
    color: #94a3b8;
}

.theme-dark .language-modal-close:hover {
    background-color: #1e293b;
    color: #e2e8f0;
}

.theme-dark .language-card {
    background: #0f172a;
    border-color: #1e293b;
}

.theme-dark .language-card:hover {
    border-color: #667eea;
    background: #1e293b;
}

.theme-dark .language-card.active {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.theme-dark .language-card-name {
    color: #e2e8f0;
}

.theme-dark .language-card.active .language-card-name {
    color: #93c5fd;
}

.model-selection {
    margin-bottom: 8px;
    padding: 10px 20px 10px 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.model-selection h3 {
    margin-bottom: 8px;
    color: #374151;
    font-size: 18px;
}
.theme-dark .model-selection h3 { color: #e2e8f0; }

.model-dropdown-container {
    width: 100%;
}

.model-dropdown {
    width: 100%;
    background: white;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
}
.theme-dark .model-dropdown { background: #0b1220; border-color: #334155; color: #e2e8f0; }

.model-dropdown:hover {
    border-color: #3a5556;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.model-dropdown:focus {
    outline: none;
    border-color: #3a5556;
    box-shadow: 0 0 0 3px rgba(58, 85, 86, 0.1);
}

.model-dropdown:disabled {
    background-color: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
    opacity: 0.7;
}

.model-token-value {
    margin-top: 0px;
    padding: 0px 0px;
    text-align: center;
}

.token-value-text {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    display: inline-block;
}

.token-value-text.loading {
    color: #6b7280;
    font-style: italic;
    font-weight: 500;
}



.history-section { 
    background-color: white; 
    border-radius: 12px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    flex: 1 1 auto; 
    min-height: 0; 
    margin-bottom: 16px;
}
.history-header { display: flex; align-items: center; justify-content: space-between; padding: 2px 12px 0; }

.history-section h3 { margin: 0; color: #374151; font-size: 14px; font-weight: 700; }
.theme-dark .history-section h3 { color: #f1f5f9; }
.history-header + .history-list { border-top: 1px solid #e5e7eb; }
.refresh-history-btn { border: none; background: transparent; cursor: pointer; opacity: .6; padding: 4px; }
.refresh-history-btn:hover { opacity: 1; }

/* New chat button (purple) */
.history-new-btn {
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
    box-shadow: 0 2px 6px rgba(118, 75, 162, 0.35);
}
.history-new-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }

.history-list { flex: 1 1 auto; overflow-y: auto; max-height: none; }

.history-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-style: italic;
}

.history-placeholder p {
    margin: 0;
    font-size: 14px;
}

.history-item {
    padding: 4px 16px 4px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-card { position: relative; }
.history-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-title-row .history-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-delete { border: none; background: transparent; cursor: pointer; padding: 2px; opacity: 0.5; }
.history-delete:hover { opacity: 1; }

.history-item:hover {
    background-color: #f9fafb;
}

.history-item:last-child {
    border-bottom: none;
}

.history-title {
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.history-date {
    font-size: 12px;
    color: #6b7280;
}

/* Authentication separator line */
.auth-separator {
    border-top: 1px solid #e5e7eb;
    margin: 24px 0 16px 0;
}

/* User balance in authenticated sidebar */
.authenticated-container .user-balance-sidebar {
    margin-top: auto;
    margin-bottom: 0;
    padding: 12px 0;
    border-top: 1px solid #e5e7eb;
}

/* Powered by section positioning */
.powered-by-section { 
    padding: 16px 24px; 
    border-top: 1px solid #e5e7eb; 
    background-color: #fafaf8; 
    text-align: center; 
}

/* When inside authenticated container, no auto margin needed */
.authenticated-container .powered-by-section {
    margin-top: 0;
    padding: 12px 24px;
}

/* Unauthenticated powered-by section gets margin-top auto */
.unauthenticated-only {
    margin-top: auto;
}

.powered-by-text {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

/* State-specific styling for right sidebar */
.right-sidebar.state-authenticated .sign-in-container {
    display: none;
}

.right-sidebar.state-unauthenticated .authenticated-container {
    display: none;
}

/* Hide unauthenticated-only powered-by when authenticated */
.right-sidebar.state-authenticated .unauthenticated-only {
    display: none;
}

/* Hide authenticated powered-by when unauthenticated (it's inside authenticated-container so this is automatic) */
.right-sidebar.state-unauthenticated .powered-by-section { 
    margin-top: auto; 
}

/* Authentication Panel Management */
.auth-panel {
    transition: all 0.3s ease;
    flex: 1;
    overflow-y: auto;
}

.auth-panel.hidden {
    display: none !important;
}

/* Switch Button Styling */
.switch-btn {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb !important;
    transition: all 0.3s ease !important;
}

.switch-btn:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Email Verification Section */
.verification-section {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    animation: slideIn 0.3s ease;
}

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

.verification-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.verification-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.verification-text h4 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.verification-text p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

.verification-text span {
    font-weight: 600;
    color: #374151;
}

.verification-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.verification-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    font-weight: 600;
    background: white;
    transition: all 0.2s ease;
    color: #111827;
}

.verification-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.verify-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
}

.verify-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.verify-btn:disabled {
    background: #9ca3af !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.verification-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.resend-btn {
    background: none;
    border: none;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.resend-btn:hover {
    color: #5a6fd8;
}

.resend-btn:disabled {
    color: #9ca3af;
    cursor: not-allowed;
    text-decoration: none;
}

.resend-timer {
    font-size: 14px;
    color: #6b7280;
}

/* Utility classes for state management */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Toast Notifications */
#toast-container {
    pointer-events: none;
    z-index: 10000;
}

.toast-notification {
    pointer-events: auto;
}

/* LLM Busy Popup */
.llm-busy-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 16px;
}

.llm-busy-popup-overlay.show {
    opacity: 1;
}

.llm-busy-popup {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 100%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.llm-busy-popup-overlay.show .llm-busy-popup {
    transform: scale(1);
}

.llm-busy-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 0 20px;
}

.llm-busy-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
}

.llm-busy-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: all 0.2s ease;
}

.llm-busy-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.llm-busy-content {
    padding: 16px 20px 20px 20px;
}

.llm-busy-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
}

.llm-busy-message {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.llm-busy-model-select {
    margin-top: 16px;
}

.llm-busy-model-select label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.llm-busy-dropdown {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 36px;
}

.llm-busy-dropdown:hover {
    border-color: #9ca3af;
}

.llm-busy-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.llm-busy-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.llm-busy-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.llm-busy-btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.llm-busy-btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.llm-busy-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.llm-busy-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.llm-busy-btn-primary svg {
    stroke: currentColor;
}

/* Dark theme for LLM Busy Popup */
.theme-dark .llm-busy-popup {
    background: #1e293b;
    border: 1px solid #334155;
}

.theme-dark .llm-busy-icon {
    background: linear-gradient(135deg, #422006 0%, #713f12 100%);
    color: #fbbf24;
}

.theme-dark .llm-busy-close {
    color: #94a3b8;
}

.theme-dark .llm-busy-close:hover {
    background: #334155;
    color: #e2e8f0;
}

.theme-dark .llm-busy-title {
    color: #f1f5f9;
}

.theme-dark .llm-busy-message {
    color: #94a3b8;
}

.theme-dark .llm-busy-model-select label {
    color: #e2e8f0;
}

.theme-dark .llm-busy-dropdown {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

.theme-dark .llm-busy-dropdown:hover {
    border-color: #475569;
}

.theme-dark .llm-busy-dropdown:focus {
    border-color: #667eea;
}

.theme-dark .llm-busy-actions {
    background: #0f172a;
    border-top-color: #334155;
}

.theme-dark .llm-busy-btn-secondary {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

.theme-dark .llm-busy-btn-secondary:hover {
    background: #334155;
    border-color: #475569;
}

/* Chat Error Message (inline fallback) */
.chat-error-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 12px 0;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    border-radius: 12px;
    color: #991b1b;
    font-size: 14px;
    animation: slideInError 0.3s ease-out;
}

.theme-dark .chat-error-message {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    border-color: #b91c1c;
    color: #fecaca;
}

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

.chat-error-message .error-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #fee2e2;
    border-radius: 50%;
    color: #dc2626;
}

.theme-dark .chat-error-message .error-icon {
    background: #7f1d1d;
    color: #fca5a5;
}

.chat-error-message .error-text {
    flex: 1;
    line-height: 1.5;
}

.chat-error-message .error-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chat-error-message .error-dismiss:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #dc2626;
}

.theme-dark .chat-error-message .error-dismiss {
    color: #6b7280;
}

.theme-dark .chat-error-message .error-dismiss:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fca5a5;
}

/* Chat Token Warning Message */
.chat-token-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin: 16px 0;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fde047;
    border-radius: 12px;
    color: #854d0e;
    font-size: 14px;
    animation: slideInError 0.3s ease-out;
}

.theme-dark .chat-token-warning {
    background: linear-gradient(135deg, #422006 0%, #713f12 100%);
    border-color: #ca8a04;
    color: #fef08a;
}

.chat-token-warning .warning-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fef08a;
    border-radius: 50%;
    color: #ca8a04;
}

.theme-dark .chat-token-warning .warning-icon {
    background: #713f12;
    color: #fde047;
}

.chat-token-warning .warning-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-token-warning .warning-text {
    font-weight: 600;
    line-height: 1.4;
}

.chat-token-warning .warning-link {
    color: #b45309;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.chat-token-warning .warning-link:hover {
    color: #92400e;
    text-decoration: underline;
}

.theme-dark .chat-token-warning .warning-link {
    color: #fbbf24;
}

.theme-dark .chat-token-warning .warning-link:hover {
    color: #fcd34d;
}

/* Confirmation Code Styles */
.confirmation-code-section {
    margin: 16px 0;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.theme-dark .confirmation-code-section {
    background: #0b1220;
    border-color: #1e293b;
}

.confirmation-code-label {
    margin-bottom: 12px;
    text-align: center;
}

.confirmation-code-label-text {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.theme-dark .confirmation-code-label-text {
    color: #e2e8f0;
}

.confirmation-code-description {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.theme-dark .confirmation-code-description {
    color: #94a3b8;
}

.confirmation-code-group {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.confirmation-code-char {
    width: 38px;
    height: 45px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
    outline: none;
}

.theme-dark .confirmation-code-char {
    background: #0b1220;
    border-color: #334155;
    color: #e2e8f0;
}

.confirmation-code-char:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #fefefe;
}

.theme-dark .confirmation-code-char:focus {
    background: #1e293b;
    border-color: #667eea;
}

.confirmation-code-char.filled {
    border-color: #10b981;
    background: #f0fdf4;
    color: #065f46;
}

.confirmation-code-char.error {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}

.confirmation-code-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.confirmation-code-send-btn,
.confirmation-code-resend-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirmation-code-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.confirmation-code-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.confirmation-code-send-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.confirmation-code-resend-btn {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.confirmation-code-resend-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

.confirmation-code-timer {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.confirmation-code-display {
    margin: 12px auto 0;
    padding: 12px 20px;
    max-width: fit-content;
    background: #94a3b8 !important;
    border: 1px solid #64748b !important;
    border-radius: 8px;
    text-align: center;
    display: inline-block;
    transition: all 0.2s ease;
}

.confirmation-code-display-label {
    display: block;
    font-size: 10px;
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.confirmation-code-display-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px;
}

.theme-dark .confirmation-code-display {
    background: #1e293b !important;
    border-color: #334155 !important;
}

.theme-dark .confirmation-code-display-label {
    color: #94a3b8;
}

.theme-dark .confirmation-code-display-value {
    color: #e2e8f0;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.password-strength.weak {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.password-strength.medium {
    background-color: #fffbeb;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.password-strength.strong {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.password-strength.very-strong {
    background-color: #f0f9ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.password-requirements {
    margin-top: 8px;
    font-size: 11px;
    color: #6b7280;
}

.requirement-item {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.requirement-item.valid {
    color: #16a34a;
}

.requirement-item.invalid {
    color: #dc2626;
}

.requirement-icon {
    width: 12px;
    height: 12px;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Remember Me Checkbox */
.remember-me-container {
    display: flex;
    align-items: center;
    margin: 12px 0;
}

.remember-me-checkbox {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    accent-color: #667eea;
}

.remember-me-label {
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
}

/* Admin Interface Styles */
.admin-container {
  max-width: 1600px;
  margin: 0;
  padding: 20px;
  position: sticky;
  top: 0;
  left: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  z-index: 10;
  width: 100%;
  box-sizing: border-box;
}

/* Widen admin container for payment plans and users tabs to use full available width */
.admin-container.payment-plans-active {
  max-width: 100%;
}

/* Ensure payment plans and users tab panels use full width */
#payment-plans.admin-tab-panel,
#users.admin-tab-panel {
  width: 100%;
  box-sizing: border-box;
}

/* Ensure table containers in payment plans and users use full width */
#payment-plans .admin-table-container,
#users .admin-table-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.admin-header {
  margin-bottom: 30px;
}

.admin-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.admin-header-left {
  text-align: left;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-header .page-title {
  margin: 0 0 10px 0;
  color: var(--text-primary);
}

.admin-header .page-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 30px;
  gap: 0;
}

.admin-tab {
  background: none;
  border: none;
  padding: 15px 25px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-tab:hover {
  color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.admin-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.tab-icon {
  font-size: 1.2rem;
}

/* Tab Content */
.admin-tab-content {
  position: relative;
}

.admin-tab-panel {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.admin-tab-panel.active {
  display: block;
}

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

/* Panel Headers */
.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.admin-panel-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.4rem;
}

.admin-filters {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

/* Enhanced filters for models page */
.models-filters {
  display: flex;
  gap: 20px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.filter-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

/* Admin CSS Variables */
:root {
  --primary-color: #667eea;
  --primary-dark: #5a6fd8;
  --accent-color: #764ba2;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --primary-color-rgb: 102, 126, 234;
}

.theme-dark {
  --primary-color: #667eea;
  --primary-dark: #5a6fd8;
  --accent-color: #764ba2;
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --border-color: #404040;
  --primary-color-rgb: 102, 126, 234;
}

/* Admin Controls */
.admin-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

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

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

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

.admin-btn-secondary {
  background: #6b7280;
  color: white;
}

.admin-btn-secondary:hover {
  background: #4b5563;
  color: white;
}

.theme-dark .admin-btn-secondary {
  background: var(--text-secondary);
  color: white;
}

.theme-dark .admin-btn-secondary:hover {
  background: var(--text-primary);
  color: white;
}

.admin-btn-danger {
  background: #dc3545;
}

.admin-btn-danger:hover {
  background: #c82333;
}

.btn-icon {
  font-size: 1rem;
}

.admin-input, .admin-select {
  background: linear-gradient(145deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
}

.admin-input:focus, .admin-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
  transform: translateY(-1px);
}

.admin-input:hover, .admin-select:hover {
  border-color: var(--accent-color);
  transform: translateY(-0.5px);
}

.admin-select {
  cursor: pointer;
  min-width: 150px;
}

/* Admin Tables */
.admin-table-container {
  background: var(--bg-primary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
}

/* Custom scrollbar for admin tables */
.admin-table-container::-webkit-scrollbar {
  width: 8px;
}

.admin-table-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.admin-table-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
  transition: background 0.3s ease;
}

.admin-table-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox scrollbar styling */
.admin-table-container {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-secondary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--border-color) 100%);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 18px 12px;
  text-align: left;
  border-bottom: 3px solid var(--primary-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

/* Sortable table headers */
.admin-table th.sortable {
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: all 0.3s ease;
}

.admin-table th.sortable:hover {
  background: linear-gradient(135deg, var(--border-color) 0%, var(--bg-secondary) 100%);
  transform: translateY(-1px);
}

.admin-table th.sortable::after {
  content: "⇅";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  font-size: 0.8rem;
  transition: opacity 0.3s ease;
}

.admin-table th.sortable:hover::after {
  opacity: 1;
}

.admin-table th.sortable.asc::after {
  content: "↑";
  opacity: 1;
  color: var(--primary-color);
}

.admin-table th.sortable.desc::after {
  content: "↓";
  opacity: 1;
  color: var(--primary-color);
}

/* Non-sortable headers still get hover effect */
.admin-table th:not(.sortable):hover {
  background: linear-gradient(135deg, var(--border-color) 0%, var(--bg-secondary) 100%);
  transform: translateY(-1px);
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: background-color 0.2s ease;
}

.admin-table tbody tr:hover {
  background-color: var(--bg-secondary);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* Table footer for row counts */
.admin-table-footer {
  padding: 12px 15px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  bottom: 0;
  z-index: 50;
}

.table-row-count {
  font-weight: 500;
}

.table-scroll-indicator {
  display: none;
  font-size: 0.8rem;
  color: var(--primary-color);
}

/* Show scroll indicator when table is scrollable */
.admin-table-container.has-scroll .table-scroll-indicator {
  display: block;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  min-width: 60px;
}

.status-active { background: #d4edda; color: #155724; }
.status-inactive { background: #f8d7da; color: #721c24; }
.status-visible { background: #d1ecf1; color: #0c5460; }
.status-hidden { background: #ffeaa7; color: #856404; }
.status-confirmed { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }

/* Loading States */
.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  gap: 15px;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Admin Modals */
.admin-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.admin-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-content {
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
  border: 2px solid var(--primary-color);
  backdrop-filter: blur(10px);
  position: relative;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

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

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 2px solid var(--border-color);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--border-color) 100%);
  border-radius: 12px 12px 0 0;
  position: relative;
}

.admin-modal-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
}

.admin-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
}

.admin-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.admin-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Admin Forms */
.admin-form {
  padding: 25px;
  background: linear-gradient(145deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 10px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

.admin-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
  border-radius: 8px 8px 0 0;
}

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

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

.admin-form-group-row {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.admin-form-field {
  flex: 1;
  min-width: 0;
}

.admin-form-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 500;
}

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 30px;
  padding: 20px 0 0 0;
  border-top: 2px solid var(--border-color);
  position: relative;
}

.admin-form-actions::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color) 0%, var(--primary-color) 100%);
}

.admin-help-text {
  display: block;
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Action Buttons in Tables */
.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table-btn {
  background: none;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

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

.table-btn-danger {
  border-color: #dc3545;
  color: #dc3545;
}

.table-btn-danger:hover {
  background: #dc3545;
  color: white;
}

/* Responsive Design for Admin */
@media (max-width: 768px) {
  .admin-container {
    padding: 15px;
  }
  
  .admin-header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .admin-header-right {
    width: 100%;
    justify-content: flex-start;
  }
  
  .admin-tabs {
    flex-direction: column;
    border-bottom: none;
  }
  
  .admin-tab {
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 5px;
  }
  
  .admin-tab.active {
    border-color: var(--primary-color);
  }
  
  .admin-panel-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .admin-filters {
    justify-content: stretch;
  }
  
  .admin-filters .admin-select,
  .admin-filters .admin-input {
    flex: 1;
    min-width: auto;
  }

  /* Mobile styles for enhanced filters */
  .models-filters {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .filter-group {
    min-width: auto;
    width: 100%;
  }
  
  .admin-table-container {
    overflow-x: auto;
    max-height: 60vh; /* Reduce height on mobile */
  }
  
  .admin-table {
    min-width: 600px;
  }
  
  .admin-table-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .admin-form-actions {
    flex-direction: column;
  }
  
  .admin-form-group-row {
    flex-direction: column;
    gap: 20px;
  }
  
  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Light theme styles for admin modals */
body:not(.theme-dark) .admin-modal {
  background-color: rgba(0, 0, 0, 0.4);
}

body:not(.theme-dark) .admin-modal-content {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid var(--primary-color);
  color: #333;
}

body:not(.theme-dark) .admin-modal-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 2px solid #dee2e6;
}

body:not(.theme-dark) .admin-modal-header h3 {
  color: #333;
}

body:not(.theme-dark) .admin-modal-close {
  color: #666;
}

body:not(.theme-dark) .admin-modal-close:hover {
  background: #e9ecef;
  color: #333;
}

body:not(.theme-dark) .admin-form {
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid #dee2e6;
}

body:not(.theme-dark) .admin-input,
body:not(.theme-dark) .admin-select {
  background: #ffffff;
  border: 1px solid #ced4da;
  color: #333;
}

body:not(.theme-dark) .admin-input:focus,
body:not(.theme-dark) .admin-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

body:not(.theme-dark) .admin-form-group label {
  color: #333;
}

body:not(.theme-dark) .admin-help-text {
  color: #666;
}

/* Dark theme adjustments for admin */
.theme-dark .admin-modal {
  background-color: rgba(0, 0, 0, 0.8);
}

.theme-dark .admin-modal-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border: 2px solid var(--primary-color);
}

.theme-dark .admin-modal-header {
  background: linear-gradient(135deg, #2d2d2d 0%, #404040 100%);
}

.theme-dark .admin-form {
  background: linear-gradient(145deg, #1a1a1a 0%, #2d2d2d 100%);
  border: 1px solid #404040;
}

.theme-dark .admin-input, .theme-dark .admin-select {
  background: linear-gradient(145deg, #1a1a1a 0%, #2d2d2d 100%);
  border: 2px solid #404040;
}

.theme-dark .admin-input:focus, .theme-dark .admin-select:focus {
  border-color: var(--primary-color);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.theme-dark .admin-input:hover, .theme-dark .admin-select:hover {
  border-color: var(--accent-color);
}

.theme-dark .status-active { 
  background: #1e3a1e; 
  color: #4caf50; 
}

.theme-dark .status-inactive { 
  background: #3a1e1e; 
  color: #f44336; 
}

.theme-dark .status-visible { 
  background: #1e2a3a; 
  color: #2196f3; 
}

.theme-dark .status-hidden { 
  background: #3a321e; 
  color: #ff9800; 
}

.theme-dark .status-confirmed { 
  background: #1e3a1e; 
  color: #4caf50; 
}

.theme-dark .status-pending { 
  background: #3a321e; 
  color: #ff9800; 
}

/* Dark theme table header adjustments */
.theme-dark .admin-table th {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #e2e8f0;
  border-bottom: 3px solid var(--primary-color);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.theme-dark .admin-table th:hover {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

.theme-dark .filter-label {
  color: #e2e8f0;
}

/* Dark theme sortable headers */
.theme-dark .admin-table th.sortable:hover {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

.theme-dark .admin-table th.sortable.asc::after,
.theme-dark .admin-table th.sortable.desc::after {
  color: var(--primary-color);
}

/* Settings Page Styles */
.generic-page {
  max-width: 920px;
  width: 100%;
  padding: 24px;
}

.page-title {
  margin-bottom: 8px;
}

.page-subtitle {
  margin-bottom: 24px;
  color: #6b7280;
}

/* Global Footer Styles */
.global-footer-container {
  width: calc(100% - 80px - 320px); /* Account for left sidebar and right panel */
  margin-top: auto;
  margin-left: 80px; /* Account for fixed left sidebar */
  margin-right: 320px; /* Account for fixed right panel */
  flex-shrink: 0;
}

/* Footer when no right panel */
body.no-right-panel .global-footer-container {
  width: calc(100% - 80px);
  margin-right: 0;
}

.global-footer {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: #1f2937;
  padding: 60px 32px 32px 32px;
  margin-top: 80px;
  transition: background 0.3s ease, color 0.3s ease;
}

.footer-content {
  max-width: 1200px;
  margin: 0;
  margin-bottom: 40px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.footer-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.footer-logo-text {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa 0%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

.footer-tagline {
  font-size: 14px;
  color: #9ca3af;
  margin: 0;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.footer-column {
  display: flex;
  flex-direction: column;
}

.footer-column-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #111827;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d1d5db;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.footer-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-link {
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: #111827;
  text-decoration: underline;
}

.footer-divider {
  height: 1px;
  background: #e5e7eb;
  max-width: 1200px;
  margin: 0 auto 24px auto;
  transition: background 0.3s ease;
}

.footer-copyright {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  transition: color 0.3s ease;
}

.footer-copyright p {
  margin: 0;
}

/* Dark theme adjustments for footer */
.theme-dark .global-footer {
  background: linear-gradient(180deg, #0a102a 0%, #0f172a 100%);
  color: #e5e7eb;
}

.theme-dark .footer-column-title {
  color: #ffffff;
  border-bottom-color: #374151;
}

.theme-dark .footer-link {
  color: #d1d5db;
}

.theme-dark .footer-link:hover {
  color: #ffffff;
}

.theme-dark .footer-divider {
  background: #374151;
}

.theme-dark .footer-copyright {
  color: #9ca3af;
}

/* Light theme footer */
body:not(.theme-dark) .global-footer {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: #1f2937;
}

body:not(.theme-dark) .footer-column-title {
  color: #111827;
  border-bottom-color: #d1d5db;
}

body:not(.theme-dark) .footer-link {
  color: #4b5563;
}

body:not(.theme-dark) .footer-link:hover {
  color: #111827;
}

body:not(.theme-dark) .footer-divider {
  background: #e5e7eb;
}

body:not(.theme-dark) .footer-copyright {
  color: #6b7280;
}

/* Responsive footer */
@media (max-width: 968px) {
  .footer-content {
    gap: 40px;
  }
  
  .footer-links {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }
}

/* Ensure footer is at bottom on all pages */
body {
    position: relative;
}

.global-footer-container {
    margin-top: auto;
}

@media (max-width: 640px) {
  .global-footer {
    padding: 40px 24px 24px 24px;
  }
  
  .footer-links {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-content {
    gap: 32px;
  }
}

/* Page Content Styles */
.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px 80px 24px;
}

.content-section {
  margin-bottom: 32px;
}

.content-section h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 16px;
}

.theme-dark .content-section h2 {
  color: #e2e8f0;
}

.content-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  margin-top: 16px;
}

.theme-dark .content-section h3 {
  color: #d1d5db;
}

.content-section p {
  color: #4b5563;
  line-height: 1.7;
  margin-bottom: 12px;
}

.theme-dark .content-section p {
  color: #cbd5e1;
}

.content-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.content-list li {
  padding: 8px 0;
  padding-left: 24px;
  position: relative;
  color: #4b5563;
  line-height: 1.7;
}

.theme-dark .content-list li {
  color: #cbd5e1;
}

.content-list li::before {
  content: '•';
  position: absolute;
  left: 8px;
  color: #10b981;
  font-weight: bold;
}

.content-link {
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.2s ease;
}

.content-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.theme-dark .content-link {
  color: #60a5fa;
}

.theme-dark .content-link:hover {
  color: #93c5fd;
}

.faq-item {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.theme-dark .faq-item {
  border-bottom-color: #374151;
}

.faq-item:last-child {
  border-bottom: none;
}

.help-item {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.theme-dark .help-item {
  border-bottom-color: #374151;
}

.help-item:last-child {
  border-bottom: none;
}

.settings-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.settings-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #1f2937;
}

.settings-card h3 + p {
  margin-top: 0;
}

.settings-card p {
  color: #6b7280;
}

.settings-card-label {
  min-width: 120px;
  color: #374151;
}

.settings-theme-label {
  font-weight: 600;
  color: #374151;
}

.settings-theme-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Dark mode styles for settings page */
.theme-dark .page-title {
  color: #e2e8f0;
}

.theme-dark .page-subtitle {
  color: #94a3b8;
}

.theme-dark .settings-card {
  background: #0b1220;
  border-color: #1e293b;
}

.theme-dark .settings-card h3 {
  color: #e2e8f0;
}

.theme-dark .settings-card p {
  color: #94a3b8;
}

.theme-dark .settings-card-label {
  color: #cbd5e1;
}

.theme-dark .settings-theme-label {
  color: #cbd5e1;
}
