/* ─── Styled UI: Variables & Base ─────────────────────────── */
:root,
html[data-theme="light"] {
  --aitutor-bg: #ffffff;
  --aitutor-bg-secondary: #f7f7f8;
  --aitutor-border: #e5e5e5;
  --aitutor-text: #0d0d0d;
  --aitutor-text-muted: #6e6e80;
  --aitutor-user-bubble: #f7f7f8;
  --aitutor-input-bg: #ffffff;
  --aitutor-primary-btn: #000000;
  --aitutor-primary-btn-hover: #2d2d2d;
  --aitutor-primary-btn-text: #ffffff;
  --aitutor-radius: 12px;
  --aitutor-radius-lg: 22px;
  --aitutor-surface-elevated: #ffffff;
  --aitutor-shadow: rgba(0, 0, 0, 0.08);
  --aitutor-shadow-strong: rgba(0, 0, 0, 0.15);
  --aitutor-overlay: rgba(0, 0, 0, 0.5);
}

/* Dark theme (default for app: light; user can switch to dark) */
html[data-theme="dark"] {
  --aitutor-bg: #171717;
  --aitutor-bg-secondary: #262626;
  --aitutor-border: #404040;
  --aitutor-text: #fafafa;
  --aitutor-text-muted: #a3a3a3;
  --aitutor-user-bubble: #262626;
  --aitutor-input-bg: #262626;
  --aitutor-primary-btn: #fafafa;
  --aitutor-primary-btn-hover: #e5e5e5;
  --aitutor-primary-btn-text: #0d0d0d;
  --aitutor-surface-elevated: #262626;
  --aitutor-shadow: rgba(0, 0, 0, 0.3);
  --aitutor-shadow-strong: rgba(0, 0, 0, 0.5);
  --aitutor-overlay: rgba(0, 0, 0, 0.6);
}

/* Dark mode overrides for legal and success pages (inline styles in templates) */
html[data-theme="dark"] .legal-page { background: var(--aitutor-bg-secondary) !important; color: var(--aitutor-text) !important; }
html[data-theme="dark"] .legal-header { background: var(--aitutor-bg) !important; border-bottom-color: var(--aitutor-border) !important; }
html[data-theme="dark"] .legal-title { color: var(--aitutor-text) !important; }
html[data-theme="dark"] .legal-content h1,
html[data-theme="dark"] .legal-content h2 { color: var(--aitutor-text) !important; }
html[data-theme="dark"] .legal-content h3,
html[data-theme="dark"] .legal-content p,
html[data-theme="dark"] .legal-content li,
html[data-theme="dark"] .legal-content .updated { color: var(--aitutor-text-muted) !important; }
html[data-theme="dark"] .legal-content strong { color: var(--aitutor-text) !important; }
html[data-theme="dark"] .legal-content a { color: #93c5fd !important; }
html[data-theme="dark"] .legal-footer-links { border-top-color: var(--aitutor-border) !important; }
html[data-theme="dark"] .success-container { background: var(--aitutor-bg-secondary) !important; }
html[data-theme="dark"] .success-card { background: var(--aitutor-bg) !important; color: var(--aitutor-text) !important; }
html[data-theme="dark"] .success-title { color: var(--aitutor-text) !important; }
html[data-theme="dark"] .success-message { color: var(--aitutor-text-muted) !important; }
html[data-theme="dark"] .practice-container { color: var(--aitutor-text); }
html[data-theme="dark"] .practice-section h2 { color: var(--aitutor-text) !important; }

/* Dark mode: wizard level cards & Start learning hover */
html[data-theme="dark"] .wizard-card:hover {
  border-color: rgba(96, 165, 250, 0.6) !important;
  background: var(--aitutor-bg-secondary) !important;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25) !important;
}
html[data-theme="dark"] .wizard-card.selected {
  border-color: rgba(96, 165, 250, 0.8) !important;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.35) 0%, rgba(59, 130, 246, 0.2) 100%) !important;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35), 0 4px 12px rgba(59, 130, 246, 0.15) !important;
}
html[data-theme="dark"] .wizard-card.selected:hover {
  border-color: rgba(96, 165, 250, 0.9) !important;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.45) 0%, rgba(59, 130, 246, 0.28) 100%) !important;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.45), 0 4px 14px rgba(59, 130, 246, 0.2) !important;
}
html[data-theme="dark"] .wizard-card.selected .card-check {
  background: #60a5fa !important;
  color: #0f172a !important;
}
html[data-theme="dark"] .wizard-card.coming-soon:hover {
  border-color: var(--aitutor-border) !important;
  background: var(--aitutor-bg) !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .start-learning-btn {
  color: var(--aitutor-primary-btn-text) !important;
}
html[data-theme="dark"] .start-learning-btn:hover:not(:disabled) {
  background: #e5e5e5 !important;
  color: #0d0d0d !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) !important;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--aitutor-bg-secondary);
  color: var(--aitutor-text);
  line-height: 1.6;
}

/* ─── aitutor-style Top Bar ──────────────────────────────────────── */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  background: var(--aitutor-bg);
  border-bottom: 1px solid var(--aitutor-border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1100; /* above sidebar (1001) and overlay (1000) */
}

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

.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--aitutor-text);
  border-radius: 8px;
  cursor: pointer;
}

.topbar-menu-btn:hover {
  background: var(--aitutor-bg-secondary);
}

/* Topbar menu button: X state when sidebar is open (mobile) */
.topbar-menu-btn.active svg {
  transition: transform 0.2s ease;
}
.topbar-menu-btn.active svg line:nth-child(1) {
  transform: rotate(45deg);
  transform-origin: 12px 12px;
}
.topbar-menu-btn.active svg line:nth-child(2) {
  opacity: 0;
}
.topbar-menu-btn.active svg line:nth-child(3) {
  transform: rotate(-45deg);
  transform-origin: 12px 12px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--aitutor-text);
}

.topbar-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
}

.topbar-chevron {
  opacity: 0.6;
}

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

.topbar-right .login-btn,
.topbar-right .signup-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.2s;
}

.topbar-right .login-btn {
  background: var(--aitutor-primary-btn);
  color: var(--aitutor-primary-btn-text);
}

.topbar-right .login-btn:hover {
  background: var(--aitutor-primary-btn-hover);
}

.topbar-right .signup-btn {
  background: transparent;
  color: var(--aitutor-text);
  border: 1px solid var(--aitutor-border);
}

.topbar-right .signup-btn:hover {
  background: var(--aitutor-bg-secondary);
}

/* Topbar Admin Links */
.topbar-admin-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--aitutor-text-muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.topbar-admin-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.topbar-admin-btn:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.15);
}

.topbar-admin-btn:hover svg {
  opacity: 1;
  stroke: #3b82f6;
}

html[data-theme="dark"] .topbar-admin-btn:hover {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
}

html[data-theme="dark"] .topbar-admin-btn:hover svg {
  stroke: #60a5fa;
}

/* Hide admin labels on small screens, keep icons */
@media (max-width: 640px) {
  .topbar-admin-label {
    display: none;
  }
  .topbar-admin-btn {
    padding: 6px 8px;
  }
}

/* Topbar user menu with avatar and dropdown */
.topbar-user-menu {
  position: relative;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 24px;
  border: 1px solid var(--aitutor-border);
  background: var(--aitutor-bg);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--aitutor-text);
}

.topbar-user-btn:hover {
  background: var(--aitutor-bg-secondary);
  border-color: var(--aitutor-text-muted);
}

.topbar-user-btn.active {
  background: var(--aitutor-bg-secondary);
  border-color: var(--aitutor-primary, #3b82f6);
}

.topbar-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  line-height: 1;
}

.topbar-avatar-lg {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.topbar-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--aitutor-text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-chevron {
  flex-shrink: 0;
  color: var(--aitutor-text-muted);
  transition: transform 0.2s ease;
}

.topbar-user-btn.active .topbar-chevron {
  transform: rotate(180deg);
}

/* Dropdown */
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--aitutor-bg);
  border: 1px solid var(--aitutor-border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.topbar-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topbar-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}

.topbar-dropdown-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.topbar-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--aitutor-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-dropdown-email {
  font-size: 12px;
  color: var(--aitutor-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-dropdown-divider {
  height: 1px;
  background: var(--aitutor-border);
  margin: 0;
}

.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--aitutor-text);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.topbar-dropdown-item:hover {
  background: var(--aitutor-bg-secondary);
}

.topbar-logout-item {
  color: #ef4444;
}

.topbar-logout-item:hover {
  background: #fef2f2;
}

/* Dark mode adjustments for logout item */
[data-theme="dark"] .topbar-logout-item:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Topbar user menu responsive */
@media (max-width: 480px) {
  .topbar-username {
    display: none;
  }
  .topbar-chevron {
    display: none;
  }
  .topbar-user-btn {
    padding: 3px;
    border-radius: 50%;
  }
  .topbar-dropdown {
    right: -8px;
    min-width: 200px;
  }
}

/* Theme toggle (light/dark) */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--aitutor-text);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover {
  background: var(--aitutor-bg-secondary);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
}
.theme-toggle .icon-dark { display: none; }
.theme-toggle .icon-light { display: block; }
html[data-theme="dark"] .theme-toggle .icon-dark { display: block; }
html[data-theme="dark"] .theme-toggle .icon-light { display: none; }

/* ─── Modern Container Layout ───────────────────────────────────── */
.app-container {
  display: flex;
  height: calc(100vh - 52px);
  width: 100%;
  background: var(--aitutor-bg);
  overflow: hidden;
  position: relative;
}

.app-container * {
  box-sizing: border-box;
}

/* ─── Mobile Hamburger Menu (hidden on mobile – topbar button used instead) ───────────────────────────────────── */
.mobile-hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
  background: var(--aitutor-surface-elevated);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1002;
  box-shadow: 0 4px 12px var(--aitutor-shadow-strong);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border: 1px solid var(--aitutor-border);
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background: var(--aitutor-text);
  border-radius: 1px;
  transition: all 0.3s ease;
}

.mobile-hamburger:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mobile-hamburger.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-hamburger.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  top: 52px; /* below the topbar */
  left: 0;
  width: 100%;
  height: calc(100vh - 52px);
  background: var(--aitutor-overlay);
  z-index: 1000; /* Below sidebar (1001) but above content */
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* Hide sidebar and its triggers when user is not logged in */
.sidebar.sidebar-hidden {
  display: none !important;
}

.sidebar-trigger-hidden {
  display: none !important;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  background: var(--aitutor-bg);
  border-right: 1px solid var(--aitutor-border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  max-height: 100%;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}
html[data-theme="dark"] .sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
html[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}
html[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-header {
  text-align: center;
  margin-bottom: 24px;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  font-weight: 400;
  color: #1e293b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 1px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #FDFCFB, #E2D1C3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.subtitle {
  font-size: 14px;
  color: #64748b;
  font-weight: 400;
}

/* ─── Sidebar Session Info ───────────────────────────────────── */
.sidebar-session-info {
  margin-bottom: 16px;
}

.session-card {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  border-radius: 10px;
  padding: 14px 16px;
  color: white;
}

.session-card-subject {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.session-card-level {
  font-size: 12px;
  color: #94a3b8;
}

/* Quick Start Section */
.quick-start-section {
  margin-bottom: 16px;
}

/* New Chat Section */
.new-chat-section {
  margin-bottom: 16px;
}

.new-chat-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--aitutor-border);
  background: var(--aitutor-bg);
  color: var(--aitutor-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.new-chat-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(59, 130, 246, 0.4);
}
html[data-theme="dark"] .new-chat-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Past Sessions Section */
.past-sessions-section {
  margin-bottom: 16px;
}

.sidebar-past-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.past-session-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--aitutor-bg);
  border: 1px solid var(--aitutor-border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.past-session-item:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(59, 130, 246, 0.4);
}
html[data-theme="dark"] .past-session-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.past-session-item .past-session-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--aitutor-text);
  margin-bottom: 2px;
}

.past-session-item .past-session-meta {
  font-size: 11px;
  color: var(--aitutor-text-muted);
}

.quick-start-hint {
  font-size: 12px;
  color: var(--aitutor-text-muted);
  line-height: 1.5;
  margin: 0;
  padding: 12px;
  background: var(--aitutor-bg-secondary);
  border-radius: 8px;
  border: 1px dashed var(--aitutor-border);
}

/* Admin Navigation Links */
.admin-nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--aitutor-bg-secondary);
  color: var(--aitutor-text);
  text-decoration: none;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--aitutor-border);
  transition: background 0.15s, border-color 0.15s;
}
.admin-nav-link:last-child {
  margin-bottom: 0;
}
.admin-nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}
html[data-theme="dark"] .admin-nav-link:hover {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.3);
  color: #60a5fa;
}

/* Quick Start Action Link */
.quick-start-action-link {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #3b82f6;
  color: #fff;
  text-decoration: none;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.quick-start-action-link:hover {
  background: #2563eb;
}

/* Legacy subject card styles (kept for compatibility) */
.subject-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.subject-card {
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.subject-card.active {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #f0f9ff 0%, #dbeafe 100%);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}

.subject-card.disabled {
  cursor: not-allowed;
  opacity: 0.6;
  background: #f8fafc;
}

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

.subject-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.subject-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.5px;
}

.subject-status {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.subject-status.available {
  background: #d1fae5;
  color: #065f46;
}

.subject-status.coming-soon {
  background: #fef3c7;
  color: #92400e;
}

/* ─── Level Selection (Sidebar) ───────────────────────────────────── */
.level-section {
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--aitutor-text-muted);
  margin-bottom: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.level-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.level-cards * {
  box-sizing: border-box;
}

.level-card {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  position: relative;
  overflow: hidden;
}

/* Hide description in compact sidebar */
.level-card .level-description {
  display: none;
}

/* Active state */
.level-card.active {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.level-card.active .level-title {
  color: #1d4ed8;
  font-weight: 600;
}

.level-card.active .level-arrow {
  color: #3b82f6;
}

.level-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.level-card.selected {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.level-card.selected .level-title {
  color: #1e293b;
}

.level-card.selected .level-description {
  color: rgba(30, 41, 59, 0.9);
}

.level-card.selected .level-arrow {
  color: #1e293b;
}

.level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.level-arrow {
  font-size: 10px;
  color: #64748b;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.level-card.expanded .level-arrow {
  transform: rotate(180deg);
}

.level-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #1e293b;
  margin-bottom: 0;
  letter-spacing: 0.5px;
}

.level-description {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, margin-top 0.3s ease, opacity 0.2s ease;
  margin-top: 0;
}

.level-card.expanded {
  background: #ffffff;
}

.level-card.expanded .level-description {
  max-height: 120px;
  margin-top: 8px;
  opacity: 1;
}

.level-card.selected .level-description {
  color: rgba(255, 255, 255, 0.9);
}

.selected-level-display {
  text-align: center;
  padding: 16px;
}

.selected-level-title {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.selected-level-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: #1e293b;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.change-level-btn {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.change-level-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Duplicate level-card styles removed - using styles from lines 322-358 above */

/* ─── Session Info ─────────────────────────────────────────────── */
.session-info {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: none;
}

.session-info.active {
  display: block;
}

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

.session-title {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
}

.session-status {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.session-details {
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.4;
}

/* ─── Start Session Button ─────────────────────────────────────── */
.start-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.start-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.start-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

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

.start-btn .icon {
  width: 20px;
  height: 20px;
}

/* ─── Main Chat Area ───────────────────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--aitutor-bg);
  overflow: hidden;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.chat-area * {
  box-sizing: border-box;
}

/* Note: Main chat-header styles are now in the onboarding section above */
/* These are legacy styles kept for compatibility */
.chat-header-legacy {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: white;
  flex-shrink: 0;
}

.chat-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  font-weight: 400;
  color: #1e293b;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.chat-subtitle {
  font-size: 14px;
  color: #64748b;
}

/* ─── Messages Container ───────────────────────────────────────── */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20%;
  background: var(--aitutor-bg);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.messages-container * {
  box-sizing: border-box;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.messages-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Chat area side spacing: increase on larger screens (not main page sides) */
@media (min-width: 1200px) {
  .chat-header {
    padding-left: 20%;
    padding-right: 20%;
  }
  .messages-container {
    padding-left: 20%;
    padding-right: 20%;
  }
  .input-area {
    padding-left: 20%;
    padding-right: 20%;
  }
}

@media (min-width: 1600px) {
  .chat-header {
    padding-left: 20%;
    padding-right: 20%;
  }
  .messages-container {
    padding-left: 20%;
    padding-right: 20%;
  }
  .input-area {
    padding-left: 20%;
    padding-right: 20%;
  }
}

@media (min-width: 1920px) {
  .chat-header {
    padding-left: 20%;
    padding-right: 20%;
  }
  .messages-container {
    padding-left: 20%;
    padding-right: 20%;
  }
  .input-area {
    padding-left: 20%;
    padding-right: 20%;
  }
}

/* ─── Message Bubbles (aitutor-style) ───────────────────────────── */
.message {
  display: flex;
  margin-bottom: 24px;
  animation: fadeInUp 0.3s ease;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 768px;
}

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

.message.user {
  flex-direction: row;
  justify-content: flex-end;
  align-self: flex-end;
  margin-left: auto;
}

.message.assistant {
  justify-content: flex-start;
  align-self: flex-start;
  margin-right: auto;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--aitutor-bg-secondary);
  transition: opacity 0.2s;
}

.message.user .message-avatar {
  background: var(--aitutor-user-bubble);
  color: var(--aitutor-text-muted);
}

.message.assistant .message-avatar {
  background: transparent;
  color: var(--aitutor-text-muted);
}

.message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--aitutor-radius-lg);
  line-height: 1.6;
  font-size: 15px;
  position: relative;
}

.message.user .message-bubble {
  background: var(--aitutor-user-bubble);
  color: var(--aitutor-text);
  border: 1px solid var(--aitutor-border);
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: transparent;
  color: var(--aitutor-text);
  border: none;
  padding-left: 0;
  border-bottom-left-radius: 4px;
}

/* Message content styling */
.message-bubble p {
  margin: 0.5em 0;
}

.message-bubble p:first-child {
  margin-top: 0;
}

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

.message-bubble ul, .message-bubble ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.message-bubble li {
  margin: 0.25em 0;
}

/* Message content wrapper — holds bubble + feedback vertically */
.message-content-wrapper {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

/* Feedback system (aitutor-style) */
.feedback-container {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--aitutor-bg-secondary);
  border-radius: var(--aitutor-radius);
  border: 1px solid var(--aitutor-border);
  max-width: 75%;
}

.feedback-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.feedback-btn {
  background: none;
  border: 1px solid var(--aitutor-border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--aitutor-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.feedback-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px var(--aitutor-shadow);
}

.feedback-btn.thumbs-up:hover {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #22c55e;
}

.feedback-btn.thumbs-down:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}

.feedback-btn.submitted {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.feedback-guide {
  color: var(--aitutor-text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.feedback-guide small {
  color: var(--aitutor-text-muted);
}

/* Typing indicator (aitutor-style) */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  background: var(--aitutor-bg-secondary);
  border: 1px solid var(--aitutor-border);
  border-radius: var(--aitutor-radius-lg);
  border-bottom-left-radius: 4px;
  max-width: 75%;
}

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

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── Input Area (aitutor-style) ─────────────────────────────────── */
.input-area {
  padding: 16px 20% 24px;
  background: var(--aitutor-bg);
  border-top: none;
  flex-shrink: 0;
}

.input-wrapper {
  max-width: 768px;
  margin: 0 auto;
  width: 100%;
}

.input-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: var(--aitutor-input-bg);
  border: 1px solid var(--aitutor-border);
  border-radius: var(--aitutor-radius-lg);
  padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.input-container:focus-within {
  border-color: var(--aitutor-text-muted);
  box-shadow: 0 0 0 1px var(--aitutor-text-muted);
}

.input-actions-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.input-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 20px;
  border: none;
  background: var(--aitutor-bg-secondary);
  color: var(--aitutor-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.input-pill:hover:not(.disabled) {
  background: var(--aitutor-border);
  color: var(--aitutor-text);
}

.input-pill.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.input-pill-icon {
  flex-shrink: 0;
}

.input-pill-label {
  white-space: nowrap;
}

.input-disclaimer {
  text-align: center;
  font-size: 12px;
  color: var(--aitutor-text-muted);
  margin: 12px 0 0;
  line-height: 1.4;
}

.input-disclaimer a {
  color: var(--aitutor-text-muted);
  text-decoration: underline;
}

.attach-image-button {
  background: transparent;
  color: var(--aitutor-text-muted);
  border: none;
  border-radius: 20px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  transition: color 0.2s ease, background 0.2s ease;
}

.attach-image-button:hover:not(.disabled) {
  color: var(--aitutor-text);
  background: var(--aitutor-bg-secondary);
}

.attach-image-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.attach-image-button .icon,
.attach-image-button .attach-icon,
.input-pill-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.input-container .image-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px 0;
  min-height: 0;
  border-bottom: 1px solid var(--aitutor-border);
  margin-bottom: 10px;
}

.attach-preview-item {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.attach-preview-item:hover {
  border-color: var(--aitutor-text-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.attach-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attach-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.attach-preview-remove:hover {
  background: rgba(220, 38, 38, 0.9);
}

/* Attachment lightbox */
.attach-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.attach-lightbox-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.attach-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.attach-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.attach-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, color 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.attach-lightbox-close:hover {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
}

.message-attached-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.message-attached-images .message-attached-img {
  max-width: 200px;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.message-attached-images .message-attached-img:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
}

/* Click-to-view for any image inside chat message bubbles (e.g. assistant markdown images) */
.message-bubble img {
  cursor: pointer;
  border-radius: 6px;
  max-width: 100%;
}
.message-bubble img:hover {
  opacity: 0.9;
}

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

.input-field {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 4px;
  font-size: 15px;
  color: var(--aitutor-text);
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  max-height: 200px;
  min-height: 24px;
}

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

.input-field.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.send-button {
  background: var(--aitutor-primary-btn);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.send-button:hover:not(:disabled) {
  background: var(--aitutor-primary-btn-hover);
}

.send-button.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.send-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-button .icon {
  width: 16px;
  height: 16px;
}

/* aitutor-style circular send (arrow only) */
.send-button-circle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
}

.send-button-circle .send-arrow {
  width: 18px;
  height: 18px;
  transform: rotate(-90deg);
}

.diagram-button {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}

.diagram-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.diagram-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.diagram-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.diagram-button .icon {
  width: 16px;
  height: 16px;
}

/* ─── Welcome/Setup Wizard State (aitutor-style) ───────────────────── */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px 24px 16px;
  overflow: hidden;
  width: 100%;
  max-width: 768px;
}

/* Blob above "Physics, explained your way" — 3D canvas blob */
.welcome-blob-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 160px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: visible;
}
.welcome-blob-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  padding-bottom: 120px;
  transform: translate(-50%, -50%);
  width: 220%;
  height: 220%;
  max-width: none;
}

.welcome-hero-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--aitutor-text);
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.welcome-hero-subtitle {
  font-size: 14px;
  color: var(--aitutor-text-muted);
  margin: 0 0 20px 0;
}

.setup-wizard {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 20px;
}

/* Wizard Step Container */
.wizard-step {
  animation: fadeIn 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

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

/* Wizard Header */
.wizard-header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  width: 100%;
  max-width: 500px;
}

.wizard-back {
  position: absolute;
  left: 0;
  top: 0;
  background: none;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.wizard-back:hover {
  background: #f8fafc;
  color: #1e293b;
  border-color: #cbd5e1;
}

/* Progress Indicator */
.wizard-progress {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0;
  margin-bottom: 24px;
}

.progress-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s;
  flex-shrink: 0;
}

.progress-step.active {
  background: #3b82f6;
  color: white;
}

.progress-step.completed {
  background: #10b981;
  color: white;
}

.progress-line {
  width: 80px;
  height: 4px;
  background: #e2e8f0;
  transition: background 0.3s;
  flex-shrink: 0;
}

.progress-line.active {
  background: linear-gradient(90deg, #10b981, #3b82f6);
}

.wizard-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  font-weight: 400;
  color: var(--aitutor-text);
  margin: 16px 0 10px 0;
  letter-spacing: 1.5px;
}

.wizard-subtitle {
  font-size: 15px;
  color: var(--aitutor-text-muted);
  margin: 0 0 8px 0;
}

/* Wizard Cards */
.wizard-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* Level selection: small rounded rectangle buttons, no scroll */
.wizard-level-cards-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.wizard-level-cards-row .wizard-level-card {
  flex: 0 1 auto;
  min-width: 0;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  gap: 0;
  position: relative;
  border-radius: 12px;
}

.wizard-level-cards-row .wizard-level-card .wizard-level-card-icon {
  display: none;
}

.wizard-level-cards-row .wizard-level-card .wizard-level-card-body {
  flex: 0 0 auto;
  min-width: 0;
  width: auto;
  text-align: center;
}

.wizard-level-cards-row .wizard-level-card .wizard-level-card-title {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--aitutor-text);
  margin: 0;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Mobile: allow level card titles to wrap so text stays inside buttons */
@media (max-width: 768px) {
  .wizard-level-cards-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 100%;
  }
  .wizard-level-cards-row .wizard-level-card {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    padding: 12px 14px;
    overflow: hidden;
  }
  .wizard-level-cards-row .wizard-level-card .wizard-level-card-body {
    min-width: 0;
    overflow: hidden;
  }
  .wizard-level-cards-row .wizard-level-card .wizard-level-card-title {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 13px;
    line-height: 1.3;
  }
}

.wizard-level-cards-row .wizard-level-card .wizard-level-card-detail,
.wizard-level-cards-row .wizard-level-card .wizard-level-card-tag {
  display: none;
}

.wizard-level-cards-row .wizard-level-card .card-check {
  display: none;
}

.wizard-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 16px;
  padding: 18px 24px;
  background: var(--aitutor-bg);
  border: 1px solid var(--aitutor-border);
  border-radius: var(--aitutor-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.wizard-card:hover {
  border-color: var(--aitutor-text-muted);
  background: var(--aitutor-bg-secondary);
}

.wizard-card.selected {
  border-color: var(--aitutor-text);
  background: var(--aitutor-bg-secondary);
  box-shadow: 0 0 0 1px var(--aitutor-text);
}

.wizard-card.coming-soon {
  opacity: 0.6;
  cursor: not-allowed;
}

.wizard-card.coming-soon:hover {
  border-color: #e2e8f0;
  background: white;
  transform: none;
  box-shadow: none;
}

.wizard-card .card-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f8fafc;
  border-radius: 10px;
}

.wizard-card .card-content {
  flex: 1;
  min-width: 0;
}

.wizard-card .card-content h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  font-weight: 400;
  color: #0f172a;
  margin: 0 0 4px 0;
  letter-spacing: 0.5px;
}

.wizard-card .card-content p {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 8px 0;
}

.wizard-card .card-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
}

.wizard-card .card-tag.popular {
  background: #fef3c7;
  color: #92400e;
}

.wizard-card .card-tag.advanced {
  background: #ede9fe;
  color: #5b21b6;
}

.wizard-card .card-tag.available {
  background: #dcfce7;
  color: #166534;
}

.wizard-card .card-tag.coming-soon {
  background: #fef3c7;
  color: #92400e;
}

.wizard-card .card-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--aitutor-bg-secondary);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s;
  flex-shrink: 0;
}

.wizard-card.selected .card-check {
  background: var(--aitutor-primary-btn);
  color: #fff;
}

.wizard-card .card-lock {
  font-size: 20px;
  opacity: 0.5;
  flex-shrink: 0;
}

/* Wizard Summary (aitutor-style) */
.wizard-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--aitutor-bg-secondary);
  border: 1px solid var(--aitutor-border);
  border-radius: var(--aitutor-radius);
  margin-top: 16px;
  width: 100%;
  max-width: 500px;
  box-sizing: border-box;
}

.summary-content {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--aitutor-text);
}

.summary-label {
  font-size: 12px;
  color: var(--aitutor-text-muted);
}

.summary-level,
.summary-subject {
  font-size: 15px;
  font-weight: 600;
}

.summary-divider {
  color: var(--aitutor-text-muted);
}

.start-learning-btn {
  background: var(--aitutor-primary-btn);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.start-learning-btn:hover:not(:disabled) {
  background: var(--aitutor-primary-btn-hover);
}

.start-learning-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive Wizard */
@media (max-width: 768px) {
  .welcome-state {
    padding: 20px 15px;
  }
  
  .wizard-title {
    font-size: 26px;
  }
  
  .wizard-subtitle {
    font-size: 13px;
  }
  
  .wizard-card {
    padding: 14px 16px;
  }
  
  .card-icon {
    font-size: 28px;
    width: 40px;
  }
  
  .card-content h3 {
    font-size: 17px;
  }
  
  .wizard-summary {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .summary-content {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .start-learning-btn {
    width: 100%;
  }
  
  .wizard-back {
    position: static;
    transform: none;
    margin-bottom: 12px;
  }
  
  .wizard-header {
    display: flex;
    flex-direction: column;
  }
}

/* Chat Header Styles (aitutor-style, active session) */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20%;
  background: var(--aitutor-bg);
  border-bottom: 1px solid var(--aitutor-border);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-session-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-subject {
  font-size: 15px;
  font-weight: 600;
  color: var(--aitutor-text);
}

.session-level-badge {
  background: var(--aitutor-bg-secondary);
  color: var(--aitutor-text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.new-session-btn {
  background: transparent;
  border: 1px solid var(--aitutor-border);
  color: var(--aitutor-text);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.new-session-btn:hover {
  background: var(--aitutor-bg-secondary);
  border-color: var(--aitutor-text-muted);
}

/* Legacy welcome styles (kept for compatibility) */
.welcome-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  font-size: 32px;
  margin-bottom: 24px;
}

.welcome-title {
  font-size: 24px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
}

.welcome-text {
  font-size: 16px;
  line-height: 1.6;
  max-width: 400px;
}

/* Responsive Onboarding */
@media (max-width: 900px) {
  .level-selection-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .onboarding-level-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 16px;
  }
  
  .level-card-icon {
    font-size: 28px;
    margin-bottom: 0;
  }
  
  .level-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    margin-bottom: 0;
  }
  
  .level-card-features {
    display: none;
  }
  
  .level-card-action {
    display: none;
  }
  
  .onboarding-features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 28px;
  }
  
  .hero-subtitle {
    font-size: 14px;
  }
  
  .onboarding-features {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 16px;
  }
  
  .feature-item {
    padding: 8px;
  }
}

/* ─── Responsive Design ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .app-container {
    height: 95vh;
    width: 100%;
  }

  .sidebar {
    width: 260px;
    padding: 16px;
  }
}

/* ─── Mobile Level Selector (hidden on desktop by default) ─────────────── */
.mobile-level-selector {
  display: none;
}

.mobile-session-info {
  display: none;
}

.mobile-start-btn {
  display: none;
}

.mobile-top-status {
  display: none;
}

/* ─── Desktop Media Queries ─────────────────────────────────────────────── */
@media (min-width: 769px) {
  /* Ensure mobile elements are hidden on desktop */
  .mobile-level-selector {
    display: none !important;
  }
  
  .mobile-session-info {
    display: none !important;
  }
  
  .mobile-start-btn {
    display: none !important;
  }
  
  .mobile-top-status {
    display: none !important;
  }
  
  .mobile-hamburger {
    display: none !important;
  }
  
  .mobile-sidebar-overlay {
    display: none !important;
  }
  .mobile-logo {
    display: none !important;
  }
  
  /* Ensure desktop sidebar is properly displayed */
  .sidebar {
    position: relative !important;
    left: 0 !important;
    width: 280px !important;
    height: auto !important;
    z-index: auto !important;
    transition: none !important;
    box-shadow: none !important;
    max-width: none !important;
    min-width: none !important;
  }
}

/* ─── Mobile Media Queries ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    height: calc(100vh - 52px); /* viewport minus topbar */
    margin: 0;
    border-radius: 0;
    width: 100%;
    overflow: hidden;
  }

  .topbar-menu-btn {
    display: flex !important;
  }

  .topbar-logo-img {
    height: 36px;
  }

  /* Use only the topbar hamburger on mobile; hide the floating duplicate */
  .mobile-hamburger {
    display: none !important;
  }

  .mobile-sidebar-overlay {
    display: block !important;
  }

  .sidebar {
    position: fixed;
    top: 52px; /* below the topbar */
    left: -100%;
    width: 75vw;
    max-width: 320px;
    min-width: 0;
    height: calc(100vh - 52px); /* full height minus topbar */
    z-index: 1001;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--aitutor-bg);
    padding-top: 8px;
  }

  .sidebar.show {
    left: 0;
  }

  /* Mobile Top Status Bar - Only visible when session is active */
  .mobile-top-status {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0; /* clear separation from content */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
  }

  .mobile-status-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 12px;
    padding-right: 12px;
    white-space: nowrap;
    overflow: hidden;
  }

  .mobile-level-pill-small {
    background: #3b82f6;
    color: #1e293b;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
  }
  
  .mobile-subscription-pill {
    background: #64748b;
    color: #1e293b;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
  }

  .mobile-subscription-pill.premium {
    background: #10b981;
  }

  /* Hide mobile session info by default */
  .mobile-session-info {
    display: none;
  }

  .mobile-start-btn {
    display: none;
  }
  
  /* Mobile Level Selector - Centered in Chat Box */
  .mobile-level-selector {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    text-align: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    z-index: 1000;
  }

  .mobile-level-selector.fade-out {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
  }

  .mobile-level-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    font-weight: 400;
    color: #1e293b;
    margin-bottom: 24px;
    letter-spacing: 1px;
  }

  .mobile-level-pills {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
  }
  
  .mobile-level-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
  }
  
  .mobile-level-pill:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
    color: #3b82f6;
  }
  
  .mobile-level-pill.selected {
    border-color: #3b82f6;
    background: #3b82f6;
    color: #1e293b;
    transform: scale(1.02);
  }

  .mobile-level-start-btn {
    margin-top: 24px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #FDFCFB, #E2D1C3);
    color: #1e293b;
    border: none;
    border-radius: 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .mobile-level-start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  }

  .mobile-level-start-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }

  .mobile-level-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .mobile-level-start-btn .icon {
    width: 16px;
    height: 16px;
  }
  
  /* Chat area adjustments */
  .chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 52px);
    padding-top: 0;
    position: relative;
  }
  
  .chat-header {
    display: none !important;
  }
  
  .chat-title,
  .chat-subtitle {
    display: none !important;
  }
  
  .message-bubble {
    max-width: 85%;
    font-size: 14px;
    line-height: 1.5;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  /* Feedback below response on mobile */
  .message-content-wrapper .message-bubble {
    max-width: 100%;
  }

  .feedback-container {
    max-width: 100%;
  }
  
  .input-area {
    padding: 16px;
  }
  
  .input-buttons {
    flex-direction: row;
    gap: 8px;
  }
  
  .attach-image-button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }
  
  .attach-image-button .icon,
  .attach-image-button .attach-icon {
    width: 20px;
    height: 20px;
  }
  
  .diagram-button,
  .send-button {
    padding: 8px 12px;
    font-size: 12px;
  }
  /* Mobile logo hidden — topbar already shows the logo */
  .mobile-logo {
    display: none !important;
  }
}



@media (max-width: 480px) {
  .app-container {
    height: 100vh;
  }
  
  .sidebar {
    width: 85vw;
    max-width: 320px;
    min-width: 280px;
  }
  
  .mobile-level-selector {
    padding: 12px 16px;
  }
  
  .mobile-level-pill {
    padding: 6px 12px;
    font-size: 13px;
  }
  
  /* Level selection: stack cards on very small screens so text never overflows */
  .wizard-level-cards-row {
    flex-direction: column;
    width: 100%;
  }
  .wizard-level-cards-row .wizard-level-card {
    width: 100%;
    max-width: 100%;
  }
  
  .chat-header {
    padding: 12px 16px;
  }
  
  .messages-container {
    padding: 12px 16px;
  }
  
  .input-area {
    padding: 12px 16px;
  }
  
  .message-bubble {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 14px;
  }

  .message-content-wrapper .message-bubble {
    max-width: 100%;
  }

  .message-avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .feedback-container {
    max-width: 100%;
    padding: 6px 10px;
  }

  .feedback-buttons {
    gap: 6px;
    margin-bottom: 4px;
  }

  .feedback-btn {
    padding: 4px 8px;
    font-size: 12px;
    gap: 2px;
  }

  .feedback-guide {
    font-size: 10px;
  }
}

/* Second 480px block merged — sidebar max-height removed to not break
   the fixed slide-out panel on mobile */

/* ─── Image styling ───────────────────────────────────────────── */
.message-bubble img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ─── Math styling ───────────────────────────────────────────── */
.katex-display {
  margin: 1em 0;
}

.katex {
  font-size: 1.05em;
}

/* ─── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  pointer-events: none;
}

/* ─── Tooltip System ───────────────────────────────────────── */
.tooltip {
  position: absolute;
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  max-width: 250px;
  text-align: center;
  white-space: nowrap;
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip.bounce {
  animation: tooltipBounce 2s infinite;
}

@keyframes tooltipBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #667eea;
}

/* Mobile tooltip positioning - show at bottom */
@media (max-width: 768px) {
  .tooltip::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #667eea;
  }
}

.toast {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  margin-bottom: 12px;
  max-width: 350px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.error {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
}

.toast.success {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
}

.toast.warning {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .toast {
    max-width: none;
    margin-bottom: 8px;
  }
}

/* ─── Diagram Suggestions ───────────────────────────────────────── */
.diagram-suggestions {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.diagram-suggestions-header {
  margin-bottom: 12px;
}

.diagram-suggestions-header small {
  color: #0369a1;
  font-weight: 500;
}

.diagram-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.diagram-btn {
  padding: 8px 16px;
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  background: white;
  color: #0369a1;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.diagram-btn:hover {
  background: #0ea5e9;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.diagram-btn:active {
  transform: translateY(0);
}

.diagram-btn.text-desc {
  border-color: #10b981;
  color: #047857;
}

.diagram-btn.text-desc:hover {
  background: #10b981;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.diagram-btn.visual-img {
  border-color: #8b5cf6;
  color: #6d28d9;
}

.diagram-btn.visual-img:hover {
  background: #8b5cf6;
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

@media (max-width: 768px) {
  .diagram-suggestions {
    margin-top: 12px;
    padding: 12px;
  }
  
  .diagram-buttons {
    flex-direction: column;
    gap: 6px;
  }
  
  .diagram-btn {
    padding: 10px 12px;
    font-size: 13px;
    justify-content: center;
  }
} 

/* Add these styles at the end of the existing CSS file */

/* User Section */
.user-section {
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}
html[data-theme="dark"] .user-section {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.user-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-details {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.user-name {
  font-weight: 700;
  color: #1e293b;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
html[data-theme="dark"] .user-name {
  color: #f1f5f9;
}

.user-tier {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.user-tier.free {
  background: rgba(255, 255, 255, 0.2);
  color: #1e293b;
}

.user-tier.registered {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.user-tier.premium {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

.login-btn, .logout-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #1e293b;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  flex-shrink: 0;
}

.login-btn:hover, .logout-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}
html[data-theme="dark"] .login-btn,
html[data-theme="dark"] .logout-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.15);
}
html[data-theme="dark"] .login-btn:hover,
html[data-theme="dark"] .logout-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Usage Section */
.usage-section {
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
html[data-theme="dark"] .usage-section {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.usage-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.usage-label {
  color: var(--aitutor-text-muted);
  font-weight: 600;
  font-size: 13px;
}

.usage-count {
  color: var(--aitutor-text);
  font-weight: 700;
  font-size: 14px;
}

.usage-tier {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.usage-tier.free {
  background: rgba(156, 163, 175, 0.2);
  color: #9ca3af;
}

.usage-tier.registered {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f7;
}

.usage-tier.premium {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1f2937;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  border-left: 4px solid #6b7280;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.toast-success {
  border-left-color: #10b981;
}

.toast.toast-error {
  border-left-color: #ef4444;
}

.toast.toast-info {
  border-left-color: #3b82f6;
}

/* Upgrade Prompt */
.upgrade-prompt {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.upgrade-content {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  max-width: 400px;
  margin: 20px;
  position: relative;
}
html[data-theme="dark"] .upgrade-content {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.upgrade-content h3 {
  color: #1e293b;
  margin-bottom: 15px;
  font-size: 20px;
}
html[data-theme="dark"] .upgrade-content h3 {
  color: #f1f5f9;
}

.upgrade-content p {
  color: #64748b;
  margin-bottom: 20px;
  line-height: 1.5;
}
html[data-theme="dark"] .upgrade-content p {
  color: #94a3b8;
}

.upgrade-btn {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.upgrade-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #1e293b;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
}

.upgrade-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.upgrade-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.upgrade-cancel-btn {
  background: rgba(107, 114, 128, 0.1);
  color: #64748b;
  border: 1px solid rgba(107, 114, 128, 0.2);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upgrade-cancel-btn:hover {
  background: rgba(107, 114, 128, 0.2);
  color: #374151;
}

/* Message Styles */
/* Duplicate message styles removed - using the correct ones above */

/* ─── Subscription Section ──────────────────────────────────────── */
.subscription-section {
  margin-bottom: 20px;
  background: var(--aitutor-surface-elevated);
  border-radius: 14px;
  border: 1px solid var(--aitutor-border);
  overflow: hidden;
  box-shadow: 0 8px 24px var(--aitutor-shadow);
}

.subscription-header {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
html[data-theme="dark"] .subscription-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.subscription-header-icon {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
html[data-theme="dark"] .subscription-header-icon {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.1);
}

.subscription-header-text {
  flex: 1;
}

.subscription-header-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}
html[data-theme="dark"] .subscription-header-title {
  color: #f1f5f9;
}

.subscription-header-subtitle {
  font-size: 11px;
  color: rgba(100, 116, 139, 0.8);
  font-weight: 400;
}
html[data-theme="dark"] .subscription-header-subtitle {
  color: rgba(148, 163, 184, 0.8);
}

.subscription-content {
  padding: 12px 16px;
}

.subscription-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  flex-wrap: wrap;
}

.subscription-status.active {
  background: #f8fafc;
  border: 1px solid #bae6fd;
}
html[data-theme="dark"] .subscription-status.active {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(56, 189, 248, 0.2);
}

.subscription-status.inactive {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
html[data-theme="dark"] .subscription-status.inactive {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

.status-icon {
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}
html[data-theme="dark"] .status-icon {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subscription-status.inactive .status-icon {
  background: rgba(255, 255, 255, 0.8);
}
html[data-theme="dark"] .subscription-status.inactive .status-icon {
  background: rgba(255, 255, 255, 0.1);
}

.status-details {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.status-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0;
  white-space: nowrap;
}
html[data-theme="dark"] .status-title {
  color: #f1f5f9;
}

.status-subtitle {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}
html[data-theme="dark"] .status-subtitle {
  color: #94a3b8;
}

.status-expiry {
  font-size: 9px;
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  font-weight: 500;
  white-space: nowrap;
  margin-left: auto;
}
html[data-theme="dark"] .status-expiry {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
}

.subscription-features {
  margin-bottom: 12px;
}

.features-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--aitutor-text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.features-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--aitutor-text-muted);
  padding: 4px 0;
}

.feature-item.active {
  color: #059669;
}
html[data-theme="dark"] .feature-item.active {
  color: #34d399;
}

.feature-item.inactive {
  color: #9ca3af;
}
html[data-theme="dark"] .feature-item.inactive {
  color: #6b7280;
}

.feature-icon {
  font-size: 12px;
  width: 16px;
  text-align: center;
}

.subscription-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.upgrade-btn, .sync-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--aitutor-border);
  text-decoration: none;
  white-space: nowrap;
  width: 100%;
}

.upgrade-btn {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
}
html[data-theme="dark"] .upgrade-btn {
  background: linear-gradient(135deg, #334155 0%, #475569 100%);
  color: #f1f5f9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.upgrade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}
html[data-theme="dark"] .upgrade-btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.sync-btn {
  background: #f8fafc;
  color: #374151;
  border: 1px solid #e2e8f0;
}
html[data-theme="dark"] .sync-btn {
  background: var(--aitutor-bg-secondary);
  color: var(--aitutor-text-muted);
  border-color: var(--aitutor-border);
}

.sync-btn:hover {
  background: rgba(107, 114, 128, 0.2);
  color: #374151;
}
html[data-theme="dark"] .sync-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--aitutor-text);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
    opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  }

.modal-overlay.show {
    opacity: 1;
  visibility: visible;
}

.subscription-modal {
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 900px;
  width: 95%;
  max-height: 85vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

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

.modal-header {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  padding: 20px 28px;
  border-radius: 20px 20px 0 0;
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #1e293b;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.modal-subtitle {
  font-size: 14px;
  opacity: 0.9;
  font-weight: 400;
}

.modal-content {
  padding: 24px 28px;
}

.plans-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.plan-card {
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.plan-card.free {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
}

.plan-card.premium {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  border-color: #0ea5e9;
  box-shadow: 0 8px 25px -8px rgba(14, 165, 233, 0.3);
}

.plan-card.premium::before {
  content: 'RECOMMENDED';
  position: absolute;
  top: 10px;
  right: -30px;
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 30px;
  transform: rotate(45deg);
  letter-spacing: 0.5px;
}

.plan-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
}

.plan-card.free .plan-icon {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
}

.plan-card.premium .plan-icon {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
}

.plan-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 6px;
  color: #1e293b;
  letter-spacing: 0.5px;
}

.plan-price {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 2px;
  color: #1e293b;
}

.plan-card.premium .plan-price {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.plan-period {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 18px;
}

.plan-features {
  text-align: left;
  margin-bottom: 18px;
}

.plan-features-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-feature {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #6b7280;
}

.plan-feature.active {
  color: #059669;
}

.plan-feature.inactive {
  color: #9ca3af;
}

.plan-feature-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.plan-button {
  width: 100%;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.plan-card.free .plan-button {
  background: #f1f5f9;
  color: #64748b;
  border: 2px solid #e2e8f0;
}

.plan-card.free .plan-button:hover {
  background: #e2e8f0;
  color: #475569;
}

.plan-card.premium .plan-button {
  background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
  color: #1e293b;
  box-shadow: 0 4px 15px -3px rgba(102, 126, 234, 0.4);
}

.plan-card.premium .plan-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -5px rgba(102, 126, 234, 0.5);
}

.modal-footer {
  text-align: center;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}

.modal-footer-text {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
}

.modal-footer-link {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}

.modal-footer-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .subscription-modal {
    width: 95%;
    margin: 20px;
    max-height: 90vh;
  }
  
  .modal-header {
    padding: 16px 20px;
  }
  
  .modal-content {
    padding: 20px;
  }
  
  .plans-comparison {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .modal-title {
    font-size: 20px;
  }
  
  .modal-subtitle {
    font-size: 12px;
  }
  
  .plan-card {
    padding: 16px;
  }
  
  .plan-feature {
    font-size: 11px;
    margin-bottom: 3px;
  }
} 

/* WordPress Checkout Modal */
.checkout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.checkout-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

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

.checkout-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
}

.checkout-modal-header h3 {
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: #1e293b;
}

.checkout-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

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

.checkout-modal-content {
    position: relative;
    min-height: 600px;
}

.checkout-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 600px;
    background: #f9fafb;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.checkout-loading p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .checkout-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .checkout-modal-header {
        padding: 16px 20px;
    }
    
    .checkout-modal-header h3 {
        font-size: 20px;
    }
    
    .checkout-modal-content {
        min-height: 500px;
    }
    
    .checkout-loading {
        height: 500px;
    }
} 

/* WordPress Login Modal */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.login-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
}

.login-modal-header h3 {
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: #1e293b;
}

.login-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

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

.login-modal-content {
    position: relative;
    min-height: 500px;
    padding: 24px;
}

.login-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 500px;
    background: #f9fafb;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .login-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .login-modal-header {
        padding: 16px 20px;
    }
    
    .login-modal-header h3 {
        font-size: 20px;
    }
    
    .login-modal-content {
        min-height: 400px;
        padding: 20px;
    }
    
    .login-loading {
        height: 400px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group input {
        padding: 12px 16px;
    }
    
    .auth-submit-btn {
        padding: 12px 20px;
        margin-top: 12px;
    }
    
    .auth-tab {
        padding: 12px 16px;
    }
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
    padding: 0;
}

.auth-tab {
    flex: 1;
    padding: 14px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    margin: 0;
}

.auth-tab.active {
    color: #1e293b;
    border-bottom-color: #3b82f6;
}

.auth-tab:hover {
    color: #374151;
}

/* Auth Forms */
.auth-form {
    margin-bottom: 20px;
    padding: 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
    padding: 0;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    margin: 0;
    background: #ffffff;
    color: #1e293b;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
    color: #1e293b;
    border: 2px solid #E2D1C3;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
    margin-bottom: 0;
}

.auth-submit-btn:hover {
    background: linear-gradient(135deg, #E2D1C3 0%, #FDFCFB 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    margin: 0;
}

.auth-loading p {
    margin-top: 16px;
    color: #6b7280;
    font-size: 14px;
    padding: 0;
}

/* ─── Dark Mode: Login / Signup Modal ──────────────────────────── */
html[data-theme="dark"] .login-modal-overlay {
    background: rgba(0, 0, 0, 0.85);
}

html[data-theme="dark"] .login-modal {
    background: var(--aitutor-bg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .login-modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-bottom-color: var(--aitutor-border);
}

html[data-theme="dark"] .login-modal-header h3 {
    color: var(--aitutor-text);
}

html[data-theme="dark"] .login-close {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .login-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--aitutor-text);
}

html[data-theme="dark"] .login-modal-content {
    background: var(--aitutor-bg);
}

/* Dark mode: Auth tabs */
html[data-theme="dark"] .auth-tabs {
    border-bottom-color: var(--aitutor-border);
}

html[data-theme="dark"] .auth-tab {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .auth-tab.active {
    color: var(--aitutor-text);
    border-bottom-color: #60a5fa;
}

html[data-theme="dark"] .auth-tab:hover {
    color: var(--aitutor-text);
}

/* Dark mode: Form fields */
html[data-theme="dark"] .form-group label {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .form-group input {
    background: var(--aitutor-bg-secondary);
    border-color: var(--aitutor-border);
    color: var(--aitutor-text);
}

html[data-theme="dark"] .form-group input::placeholder {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .form-group input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

/* Dark mode: Submit button */
html[data-theme="dark"] .auth-submit-btn {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    color: var(--aitutor-text);
    border-color: #475569;
}

html[data-theme="dark"] .auth-submit-btn:hover {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Dark mode: Auth loading */
html[data-theme="dark"] .auth-loading p {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .auth-loading .spinner {
    border-color: var(--aitutor-border);
    border-top-color: #60a5fa;
}

/* Dark mode: Login loading */
html[data-theme="dark"] .login-loading {
    background: var(--aitutor-bg-secondary);
}

/* ─── Dark Mode: Checkout Modal ────────────────────────────────── */
html[data-theme="dark"] .checkout-modal-overlay {
    background: rgba(0, 0, 0, 0.85);
}

html[data-theme="dark"] .checkout-modal {
    background: var(--aitutor-bg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .checkout-modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-bottom-color: var(--aitutor-border);
}

html[data-theme="dark"] .checkout-modal-header h3 {
    color: var(--aitutor-text);
}

html[data-theme="dark"] .checkout-close {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .checkout-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--aitutor-text);
}

html[data-theme="dark"] .checkout-loading {
    background: var(--aitutor-bg-secondary);
}

html[data-theme="dark"] .checkout-loading p {
    color: var(--aitutor-text-muted);
}

/* ─── Dark Mode: Subscription Modal ───────────────────────────── */
html[data-theme="dark"] .subscription-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

html[data-theme="dark"] .subscription-modal {
    background: var(--aitutor-bg);
}

html[data-theme="dark"] .subscription-modal-header h2 {
    color: var(--aitutor-text);
}

html[data-theme="dark"] .subscription-modal-close {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .subscription-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--aitutor-text);
}

html[data-theme="dark"] .plan-card {
    background: var(--aitutor-bg-secondary);
    border-color: var(--aitutor-border);
}

html[data-theme="dark"] .plan-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .plan-name {
    color: var(--aitutor-text);
}

html[data-theme="dark"] .plan-price {
    color: var(--aitutor-text);
}

html[data-theme="dark"] .plan-period {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .plan-features-title {
    color: var(--aitutor-text);
}

html[data-theme="dark"] .plan-feature {
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .plan-button {
    background: var(--aitutor-border);
    color: var(--aitutor-text-muted);
}

html[data-theme="dark"] .plan-card.premium {
    border-color: #f59e0b;
}

html[data-theme="dark"] .subscription-modal-footer {
    border-top-color: var(--aitutor-border);
}

html[data-theme="dark"] .subscription-modal-footer-text {
    color: var(--aitutor-text-muted);
}

/* ─── Dark Mode: Toast overrides ──────────────────────────────── */
html[data-theme="dark"] .toast {
    background: var(--aitutor-bg-secondary);
    color: var(--aitutor-text);
    border-left-color: #6b7280;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .toast.toast-success {
    border-left-color: #34d399;
}

html[data-theme="dark"] .toast.toast-error {
    border-left-color: #f87171;
}

html[data-theme="dark"] .toast.toast-info {
    border-left-color: #60a5fa;
}

/* New Subscription Modal Styles for Hybrid Checkout */
.subscription-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.subscription-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.subscription-modal {
    background: linear-gradient(135deg, #FDFCFB 0%, #E2D1C3 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

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

.subscription-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.subscription-modal-header h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: #1e293b;
    margin: 0;
}

.subscription-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.subscription-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.subscription-modal-content {
    margin-bottom: 30px;
}

.plans-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.plan-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.plan-card.premium {
    border-color: #f59e0b;
    position: relative;
}

.plan-card.premium::before {
    content: 'Most Popular';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.plan-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.plan-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 10px;
}

.plan-price {
    font-size: 36px;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 5px;
}

.plan-period {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.plan-features {
    text-align: left;
    margin-bottom: 25px;
}

.plan-features-title {
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 15px;
    font-size: 14px;
}

.plan-feature {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.plan-feature-icon {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: #10b981;
}

.plan-button {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #e5e7eb;
    color: #666;
}

.plan-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.plan-button.premium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.plan-button.current {
    background: #10b981;
    color: white;
    cursor: not-allowed;
}

.plan-button.current:hover {
    transform: none;
    box-shadow: none;
}

.subscription-modal-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.subscription-modal-footer-text {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Responsive Subscription Modal */
@media (max-width: 768px) {
    .subscription-modal {
        padding: 20px;
        margin: 20px;
        max-height: 90vh;
    }
    
    .plans-comparison {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .subscription-modal-header h2 {
        font-size: 24px;
    }
    
    .plan-card {
        padding: 20px;
    }
    
    .plan-price {
        font-size: 28px;
    }
}

/* ─── Question Cards Styles ───────────────────────────────────── */
.question-cards-container {
    margin: 16px 0 24px 52px;
    padding: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.question-cards-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.question-cards-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.question-cards-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-cards-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    color: #1e293b;
    letter-spacing: 0.5px;
}

.question-cards-subtitle {
    font-size: 13px;
    color: #64748b;
    flex: 1;
}

.question-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-card {
    background: linear-gradient(135deg, #ffffff 0%, #fefce8 100%);
    border: 2px solid #fde68a;
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.question-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
    transform: translateX(2px);
}

.question-card.expanded {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
}

.question-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.question-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.question-year {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.question-paper {
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.question-relevance {
    margin-left: auto;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}

.question-card-content {
    margin-bottom: 12px;
}

.question-text {
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    margin: 0;
}

.question-number {
    font-weight: 700;
    color: #92400e;
    margin-right: 2px;
}

.mcq-options {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mcq-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    text-align: left;
}

.mcq-option:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.mcq-option.selected {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.mcq-option-letter {
    font-weight: 700;
    min-width: 1.2em;
    color: #92400e;
}

.question-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.question-expand-btn,
.question-answer-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.question-expand-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.question-answer-btn {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    color: #92400e;
}

.question-answer-btn:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.question-answer-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.expand-icon,
.answer-icon {
    font-size: 10px;
}

/* Full question text (hidden by default) */
.question-full-text {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.question-full-text p {
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
    margin: 0;
    white-space: pre-wrap;
}

/* Answer section */
.question-answer-section {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    border-radius: 10px;
}

.answer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #059669;
    font-size: 14px;
}

.answer-loading::before {
    content: '⏳';
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

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

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

.answer-label {
    font-weight: 600;
    color: #065f46;
    font-size: 14px;
}

.answer-marks {
    background: #10b981;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

.answer-text {
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
    white-space: pre-wrap;
}

.answer-not-found,
.answer-error {
    text-align: center;
    padding: 20px;
}

.not-found-icon,
.error-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.answer-not-found p,
.answer-error p {
    margin: 0 0 4px 0;
    color: #475569;
    font-size: 14px;
}

.answer-not-found small {
    color: #64748b;
    font-size: 12px;
}

.answer-error {
    background: #fef2f2;
    border-color: #fecaca;
}

.answer-error p {
    color: #991b1b;
}

/* Mobile responsive question cards */
@media (max-width: 768px) {
    .question-cards-container {
        margin-left: 0;
        margin-right: 0;
    }
    
    .question-cards-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .question-cards-subtitle {
        display: none;
    }
    
    .question-card {
        padding: 14px;
    }
    
    .question-card-header {
        gap: 6px;
    }
    
    .question-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .question-year,
    .question-paper,
    .question-relevance {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .question-card-actions {
        flex-direction: column;
    }
    
    .question-expand-btn,
    .question-answer-btn {
        width: 100%;
        justify-content: center;
    }
}