/*
 * ============================================
 * WITEXAM CUSTOM STYLES
 * Built on top of WWA Design System
 * ============================================
 */

/* ==========================================
 * NAVBAR
 * Liquid Glass Lite: Solid background, no blur
 * ========================================== */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
  box-shadow: var(--navbar-shadow);
  z-index: var(--z-fixed);
}

[data-theme="dark"] .navbar {
  background-color: var(--bg-primary);
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-6);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.navbar-logo {
  height: 32px;
  width: auto;
}

/* Logo theme switching */
.logo-dark {
  display: none;
}

.logo-light {
  display: inline-block;
}

html[data-theme="dark"] .logo-light,
body.dark .logo-light {
  display: none;
}

html[data-theme="dark"] .logo-dark,
body.dark .logo-dark {
  display: inline-block;
}

.navbar-menu {
  display: none;
  align-items: center;
  gap: var(--space-1);
}

@media (min-width: 768px) {
  .navbar-menu {
    display: flex;
  }
}

.navbar-link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  border-radius: var(--radius-xl);
  transition: var(--transition-colors);
}

.navbar-link:hover {
  color: var(--fg-primary);
  background-color: var(--interactive-hover);
}

.navbar-actions {
  display: none;
  align-items: center;
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .navbar-actions {
    display: flex;
  }
}

.navbar-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
}

.navbar-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--fg-primary);
  border-radius: 2px;
  transition: var(--transition-fast);
}

@media (min-width: 768px) {
  .navbar-toggle {
    display: none;
  }
}

/* Mobile menu */
.navbar-mobile {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  padding: var(--space-4);
  z-index: var(--z-fixed);
}

.navbar-mobile.active {
  display: block;
}

.navbar-mobile .navbar-link {
  display: block;
  padding: var(--space-4);
  font-size: var(--text-lg);
}

.navbar-mobile .navbar-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.navbar-mobile .btn {
  width: 100%;
}

/* ==========================================
 * APP NAVBAR (Logged-in pages)
 * ========================================== */

.app-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
  z-index: var(--z-fixed);
}

/* Bring navbar above chatbot panel when user dropdown is open */
.app-navbar:has(.user-dropdown.active) {
  z-index: calc(var(--z-modal) + 1);
}

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

@media (min-width: 768px) {
  .app-navbar-container {
    padding: 0 var(--space-4);
  }
}

.app-navbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-navbar-logo {
  display: flex;
  align-items: center;
}

.app-navbar-logo img {
  height: 28px;
  width: auto;
}

.app-navbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

@media (min-width: 768px) {
  .app-navbar-right {
    gap: var(--space-3);
  }
}

.app-navbar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  color: var(--fg-secondary);
  transition: var(--transition-fast);
}

.app-navbar-icon-btn:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.app-navbar-icon-btn svg {
  width: 20px;
  height: 20px;
}

.app-navbar-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 18px;
  text-align: center;
  background-color: var(--bg-brand);
  color: var(--fg-on-brand);
  border-radius: var(--radius-full);
}

.app-navbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.app-navbar-user:hover {
  background-color: var(--interactive-hover);
}

.app-navbar-user .avatar {
  width: 32px;
  height: 32px;
  font-size: var(--text-sm);
}

.app-navbar-user-info {
  display: none;
}

@media (min-width: 768px) {
  .app-navbar-user-info {
    display: block;
  }
}

.app-navbar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.app-navbar-dropdown-icon {
  display: none;
  color: var(--fg-tertiary);
}

@media (min-width: 768px) {
  .app-navbar-dropdown-icon {
    display: block;
  }
}

/* Sidebar toggle for subject pages */
.app-navbar-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  color: var(--fg-secondary);
  transition: var(--transition-fast);
}

.app-navbar-sidebar-toggle:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

@media (min-width: 1024px) {
  .app-navbar-sidebar-toggle {
    display: none;
  }
}

/* Navbar Search Bar */
.app-navbar-search {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 480px;
  margin: 0 var(--space-4);
}

.app-navbar-search-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: 36px;
  padding: 0 var(--space-3);
  background-color: var(--bg-tertiary);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.app-navbar-search-btn:hover {
  background-color: var(--interactive-hover);
  border-color: var(--border-primary);
}

.app-navbar-search-btn svg {
  width: 16px;
  height: 16px;
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

.app-navbar-search-placeholder {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-navbar-search-kbd {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--fg-tertiary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  line-height: 1.2;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .app-navbar-search {
    flex: 0;
    margin: 0;
    margin-left: auto;
    max-width: none;
  }

  .app-navbar-search-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    background-color: transparent;
    border-radius: var(--radius-lg);
  }

  .app-navbar-search-btn svg {
    width: 20px;
    height: 20px;
    color: var(--fg-secondary);
  }

  .app-navbar-search-placeholder,
  .app-navbar-search-kbd {
    display: none;
  }
}

/* Search Overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.search-overlay.active {
  display: flex;
}

.search-overlay-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-overlay-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  max-height: 70vh;
  background-color: var(--bg-primary);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn var(--duration-normal) var(--ease-out);
}

.search-overlay-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--border-subtle);
}

.search-overlay-header:focus-within {
  border-bottom-color: var(--brand);
}

.search-overlay-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--fg-secondary);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.search-overlay-back svg {
  width: 20px;
  height: 20px;
}

.search-overlay-icon {
  width: 20px;
  height: 20px;
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

.search-overlay-input {
  flex: 1;
  border: none;
  background: none;
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--fg-primary);
  outline: none;
  box-shadow: none;
  min-width: 0;
}

.search-overlay-input:focus {
  border: none;
  outline: none;
  box-shadow: none;
}

.search-overlay-input::placeholder {
  color: var(--fg-tertiary);
}

.search-overlay-esc {
  padding: 2px 8px;
  font-size: 11px;
  font-family: inherit;
  color: var(--fg-tertiary);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  line-height: 1.2;
  flex-shrink: 0;
}

.search-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.search-overlay-footer {
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-primary);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Search overlay sections */
.search-section {
  margin-bottom: var(--space-4);
}

.search-section:last-child {
  margin-bottom: 0;
}

.search-section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--fg-tertiary);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  text-transform: none;
  letter-spacing: normal;
}

.search-clear-btn:hover {
  color: var(--fg-primary);
  background: var(--bg-tertiary);
}

.search-remove-btn {
  color: var(--fg-tertiary);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.search-remove-btn svg {
  width: 14px;
  height: 14px;
}

.search-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  color: inherit;
}

.search-item:hover,
.search-item.active {
  background-color: var(--bg-hover);
}

.search-item-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--fg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-item-icon svg {
  width: 18px;
  height: 18px;
}

.search-item-icon-emoji {
  font-size: 16px;
  border-radius: var(--radius-md);
  line-height: 1;
}

.search-item-text {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.search-item-meta {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

/* Search empty state */
.search-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.search-empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.search-empty-icon img {
  width: 64px;
  height: 64px;
}

.search-empty-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.search-empty-hint {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Search loading */
.search-loading {
  display: flex;
  justify-content: center;
  padding: var(--space-8);
}

/* Mobile: full screen overlay */
@media (max-width: 767px) {
  .search-overlay {
    padding-top: 0;
    align-items: stretch;
  }

  .search-overlay-container {
    max-width: none;
    max-height: none;
    border-radius: 0;
    height: 100%;
  }

  .search-overlay-back {
    display: flex;
  }

  .search-overlay-esc {
    display: none;
  }

  .search-overlay-footer {
    display: none;
  }
}

/* Page layout with app navbar */
.app-page {
  padding-top: 64px;
  min-height: 100vh;
  background-color: var(--bg-secondary);
}

.app-page-content {
  padding: var(--space-6) var(--space-4);
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .app-page-content {
    padding: var(--space-8) var(--space-6);
  }
}

/* Subject page layout (with sidebar) */
.subject-page {
  padding-top: 64px;
  min-height: 100vh;
  display: flex;
}

.subject-sidebar {
  --sidebar-width: 260px;
  position: fixed;
  left: 0;
  top: 64px;
  bottom: 0;
  width: var(--sidebar-width);
  min-width: 200px;
  max-width: 400px;
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-primary);
  padding: var(--space-4);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--duration-normal) var(--ease-out), width var(--duration-normal) var(--ease-out);
  z-index: calc(var(--z-fixed) - 1);
  display: flex;
  flex-direction: column;
}

.subject-sidebar.active {
  transform: translateX(0);
}

/* Collapsed sidebar */
.subject-sidebar.collapsed {
  --sidebar-width: 60px;
  min-width: 60px;
  padding: var(--space-2);
  overflow: hidden;
}

.subject-sidebar.collapsed .subject-switcher,
.subject-sidebar.collapsed .subject-sidebar-nav,
.subject-sidebar.collapsed .subject-sidebar-back {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Sidebar Collapse Button */
.sidebar-collapse-btn {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 48px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background-color 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--interactive-hover);
}

.sidebar-collapse-btn svg {
  width: 14px;
  height: 14px;
  color: var(--fg-secondary);
  transition: transform 0.2s ease;
}

.subject-sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* Sidebar Resize Handle */
.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
  transition: background-color 0.15s ease;
  display: none;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.resizing {
  background-color: var(--fg-brand);
}

/* Prevent text selection while resizing */
body.sidebar-resizing {
  cursor: ew-resize !important;
  user-select: none !important;
}

body.sidebar-resizing * {
  cursor: ew-resize !important;
}

@media (min-width: 1024px) {
  .subject-sidebar {
    transform: translateX(0);
  }

  .sidebar-collapse-btn {
    display: flex;
  }

  .sidebar-resize-handle {
    display: block;
  }
}

/* Subject Switcher */
.subject-switcher {
  position: relative;
  margin: calc(-1 * var(--space-4));
  margin-bottom: var(--space-4);
}

.subject-switcher-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.subject-switcher-btn:hover {
  background-color: var(--interactive-hover);
}

.subject-switcher-btn.active {
  background-color: var(--bg-secondary);
}

.subject-switcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-brand-subtle);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.subject-switcher-info {
  flex: 1;
  min-width: 0;
}

.subject-switcher-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subject-switcher-meta {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.subject-switcher-arrow {
  color: var(--fg-tertiary);
  transition: transform var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.subject-switcher-btn.active .subject-switcher-arrow {
  transform: rotate(180deg);
}

/* Subject Switcher Dropdown - Liquid Glass Lite */
.subject-switcher-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-opacity);
}

.subject-switcher-dropdown.active {
  opacity: 1;
  visibility: visible;
}

.subject-switcher-dropdown-header {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  border-bottom: 1px solid var(--border-primary);
}

.subject-switcher-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  transition: var(--transition-colors);
}

.subject-switcher-item:hover {
  background-color: var(--interactive-hover);
}

.subject-switcher-item.active {
  background-color: var(--bg-brand-subtle);
}

.subject-switcher-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl);
  font-size: var(--text-base);
  flex-shrink: 0;
}

.subject-switcher-item.active .subject-switcher-item-icon {
  background-color: var(--bg-brand);
}

.subject-switcher-item-info {
  flex: 1;
  min-width: 0;
}

.subject-switcher-item-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.subject-switcher-item-meta {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.subject-switcher-item-check {
  color: var(--fg-brand);
  flex-shrink: 0;
  display: none;
}

.subject-switcher-item.active .subject-switcher-item-check {
  display: block;
}

.subject-switcher-dropdown-footer {
  padding: var(--space-2);
  border-top: 1px solid var(--border-primary);
}

.subject-switcher-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-brand);
  border-radius: var(--radius-xl);
  transition: var(--transition-colors);
}

.subject-switcher-all:hover {
  background-color: var(--bg-brand-subtle);
}

.subject-switcher-all svg {
  width: 16px;
  height: 16px;
}

/* Legacy subject-sidebar-header (keeping for compatibility) */
.subject-sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  margin: calc(-1 * var(--space-4));
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
}

.subject-sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-brand-subtle);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
}

.subject-sidebar-title {
  flex: 1;
  min-width: 0;
}

.subject-sidebar-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subject-sidebar-meta {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.subject-sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.subject-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
}

.subject-sidebar-link:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.subject-sidebar-link.active {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.subject-sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.subject-sidebar-back {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  margin-top: auto;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  border-top: 1px solid var(--border-primary);
  transition: var(--transition-fast);
}

.subject-sidebar-back:hover {
  color: var(--fg-primary);
}

.subject-sidebar-back svg {
  width: 16px;
  height: 16px;
}

.subject-content {
  flex: 1;
  padding: var(--space-6) 5%;
  margin-left: 0;
  background-color: var(--bg-secondary);
  transition: margin-left var(--duration-normal) var(--ease-out);
  overflow-x: hidden;
  box-sizing: border-box;
  width: 100%;
}

@media (min-width: 768px) {
  .subject-content {
    padding: var(--space-8) 5%;
  }
}

@media (min-width: 1024px) {
  .subject-content {
    margin-left: var(--sidebar-width, 260px);
    width: calc(100% - var(--sidebar-width, 260px));
  }
}


/* ==========================================
 * HERO SECTION
 * ========================================== */

.hero {
  padding-top: calc(72px + var(--space-16));
  padding-bottom: var(--space-16);
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  overflow: hidden;
}

.hero .container {
  display: grid;
  gap: var(--space-12);
  align-items: center;
}

@media (min-width: 1024px) {
  .hero .container {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
  }
}

.hero-content {
  text-align: center;
}

@media (min-width: 1024px) {
  .hero-content {
    text-align: left;
  }
}

.hero-badge {
  margin-bottom: var(--space-4);
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .hero-title {
    font-size: var(--text-5xl);
  }
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: var(--text-lg);
  color: var(--fg-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-8);
  max-width: 540px;
}

@media (min-width: 1024px) {
  .hero-description {
    margin-left: 0;
    margin-right: auto;
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin-bottom: var(--space-12);
}

@media (min-width: 1024px) {
  .hero-actions {
    justify-content: flex-start;
  }
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  justify-content: center;
}

@media (min-width: 1024px) {
  .hero-stats {
    justify-content: flex-start;
  }
}

.hero-stat {
  text-align: center;
}

@media (min-width: 1024px) {
  .hero-stat {
    text-align: left;
  }
}

.hero-stat-value {
  display: block;
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--fg-brand);
}

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

/* Hero Visual / Mockup */
.hero-visual {
  display: none;
}

@media (min-width: 1024px) {
  .hero-visual {
    display: block;
  }
}

.hero-mockup {
  perspective: 1000px;
}

.mockup-window {
  background-color: var(--bg-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  transform: rotateY(-5deg) rotateX(5deg);
  border: 1px solid var(--border-primary);
}

.mockup-header {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
}

.mockup-dots {
  display: flex;
  gap: var(--space-2);
}

.mockup-dots span {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background-color: var(--border-secondary);
}

.mockup-dots span:first-child {
  background-color: var(--color-error-400);
}

.mockup-dots span:nth-child(2) {
  background-color: var(--color-warning-400);
}

.mockup-dots span:last-child {
  background-color: var(--color-success-400);
}

.mockup-content {
  display: flex;
  min-height: 300px;
}

.mockup-sidebar {
  width: 60px;
  background-color: var(--bg-secondary);
  padding: var(--space-4) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border-right: 1px solid var(--border-primary);
}

.mockup-nav-item {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-lg);
  background-color: var(--bg-tertiary);
}

.mockup-nav-item.active {
  background-color: var(--bg-brand-subtle);
}

.mockup-main {
  flex: 1;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mockup-card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.mockup-title {
  width: 70%;
  height: 16px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.mockup-title.short {
  width: 40%;
}

.mockup-progress {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.mockup-progress-bar {
  height: 100%;
  background-color: var(--bg-brand);
  border-radius: var(--radius-full);
}

.mockup-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 80px;
}

.mockup-bar {
  flex: 1;
  background-color: var(--color-primary-200);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

[data-theme="dark"] .mockup-bar {
  background-color: var(--color-primary-800);
}

/* ==========================================
 * SECTIONS
 * ========================================== */

.section {
  padding: var(--space-20) 0;
}

.section-alt {
  background-color: var(--bg-secondary);
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-16);
}

.section-header .badge {
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

@media (min-width: 768px) {
  .section-title {
    font-size: var(--text-4xl);
  }
}

.section-description {
  font-size: var(--text-lg);
  color: var(--fg-secondary);
  line-height: var(--leading-relaxed);
}

/* ==========================================
 * FEATURES
 * ========================================== */

.features-grid {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Liquid Glass Lite: No transform on hover */
.feature-card {
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  transition: var(--transition-colors);
  box-shadow: var(--card-shadow);
}

.feature-card:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-primary);
}

.feature-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background-color: var(--bg-brand-subtle);
  border-radius: var(--radius-xl);
  color: var(--fg-brand);
  margin-bottom: var(--space-4);
}

.feature-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.feature-description {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  line-height: var(--leading-relaxed);
}

/* ==========================================
 * STEPS / HOW IT WORKS
 * ========================================== */

.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-width: 800px;
  margin: 0 auto;
}

.step {
  display: grid;
  gap: var(--space-6);
  align-items: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
}

@media (min-width: 768px) {
  .step {
    grid-template-columns: auto 1fr auto;
  }
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--gradient-primary);
  color: var(--fg-on-brand);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.step-content {
  text-align: center;
}

@media (min-width: 768px) {
  .step-content {
    text-align: left;
  }
}

.step-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.step-description {
  color: var(--fg-secondary);
  line-height: var(--leading-relaxed);
}

.step-visual {
  display: none;
}

@media (min-width: 768px) {
  .step-visual {
    display: block;
  }
}

.step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background-color: var(--bg-brand-subtle);
  border-radius: var(--radius-xl);
  color: var(--fg-brand);
}

/* ==========================================
 * CTA SECTION
 * ========================================== */

.cta-section {
  padding: var(--space-12) 0;
}

.cta-card {
  position: relative;
  background: var(--gradient-primary);
  border-radius: var(--radius-3xl);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  overflow: hidden;
}

@media (min-width: 768px) {
  .cta-card {
    padding: var(--space-16) var(--space-12);
  }
}

.cta-content {
  position: relative;
  z-index: 1;
}

.cta-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--fg-on-brand);
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  .cta-title {
    font-size: var(--text-4xl);
  }
}

.cta-description {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-8);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.cta-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.cta-actions .btn-primary {
  background-color: var(--color-neutral-0);
  color: var(--color-primary-600);
}

.cta-actions .btn-primary:hover {
  background-color: var(--color-neutral-100);
}

.cta-note {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
}

.cta-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cta-circles {
  position: absolute;
  right: -100px;
  top: 50%;
  transform: translateY(-50%);
}

.cta-circle {
  position: absolute;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cta-circle:nth-child(1) {
  width: 200px;
  height: 200px;
  right: 0;
  top: -100px;
}

.cta-circle:nth-child(2) {
  width: 300px;
  height: 300px;
  right: -50px;
  top: -150px;
}

.cta-circle:nth-child(3) {
  width: 400px;
  height: 400px;
  right: -100px;
  top: -200px;
}

/* ==========================================
 * FOOTER
 * ========================================== */

.footer {
  background-color: var(--color-neutral-900);
  color: var(--color-neutral-300);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  height: 32px;
  margin-bottom: var(--space-4);
}

.footer-tagline {
  font-size: var(--text-sm);
  color: var(--color-neutral-400);
  margin-bottom: var(--space-6);
}

.footer-social {
  display: flex;
  gap: var(--space-3);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--color-neutral-800);
  border-radius: var(--radius-lg);
  color: var(--color-neutral-400);
  transition: var(--transition-fast);
}

.social-link:hover {
  background-color: var(--color-neutral-700);
  color: var(--color-neutral-0);
}

.footer-heading {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-0);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--color-neutral-400);
  transition: var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-neutral-0);
}

.footer-bottom {
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-neutral-800);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
}

/* ==========================================
 * AUTH PAGES
 * ========================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo {
  height: 40px;
  margin-bottom: var(--space-6);
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--fg-error);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

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

.auth-divider span {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

.auth-terms {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
  margin-top: var(--space-4);
  line-height: 1.5;
}

.auth-terms a {
  color: var(--fg-secondary);
  text-decoration: underline;
}

.auth-terms a:hover {
  color: var(--fg-primary);
}

.auth-social {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  height: var(--btn-height-md);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--btn-radius);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: var(--transition-fast);
}

.btn-social:hover {
  background-color: var(--interactive-hover);
  border-color: var(--border-secondary);
}

.btn-social svg {
  width: 20px;
  height: 20px;
}

.btn-social-apple {
  background-color: #000000;
  border-color: #000000;
  color: #ffffff;
}

.btn-social-apple:hover {
  background-color: #1a1a1a;
  border-color: #1a1a1a;
}

/* Dark mode Apple button */
:root[data-theme="dark"] .btn-social-apple {
  background-color: #ffffff;
  border-color: #ffffff;
  color: #000000;
}

:root[data-theme="dark"] .btn-social-apple:hover {
  background-color: #e5e5e5;
  border-color: #e5e5e5;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-primary);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.auth-footer a {
  color: var(--fg-brand);
  font-weight: var(--font-medium);
}

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

/* OTP Input Styles */
.otp-email-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.otp-email-display span {
  color: var(--fg-primary);
  font-weight: var(--font-medium);
}

.otp-change-email {
  background: none;
  border: none;
  color: var(--fg-brand);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  padding: 0;
}

.otp-change-email:hover {
  text-decoration: underline;
}

.otp-inputs {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
}

.otp-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  border: var(--input-border-width) solid var(--border-primary);
  border-radius: var(--input-radius);
  background: var(--bg-primary);
  color: var(--fg-primary);
  transition: var(--transition-fast);
}

.otp-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.otp-input:hover:not(:focus) {
  border-color: var(--border-secondary);
}

.otp-hint {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
  margin-top: var(--space-3);
}

.otp-resend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.otp-resend-btn {
  background: none;
  border: none;
  color: var(--fg-brand);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  padding: 0;
}

.otp-resend-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.otp-resend-btn:disabled {
  color: var(--fg-tertiary);
  cursor: not-allowed;
}

/* Mobile responsive OTP */
@media (max-width: 480px) {
  .otp-input {
    width: 42px;
    height: 50px;
    font-size: var(--text-xl);
  }
}

.auth-remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.auth-remember label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.auth-remember a {
  color: var(--fg-brand);
}

/* ==========================================
 * DASHBOARD
 * ========================================== */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 72px;
}

.dashboard-layout.no-navbar {
  padding-top: 0;
}

/* Mobile Header (visible only on mobile when no navbar) */
.mobile-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  padding: 0 var(--space-4);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
  z-index: var(--z-fixed);
}

.mobile-header .mobile-logo {
  height: 24px;
}

@media (min-width: 1024px) {
  .mobile-header {
    display: none;
  }
}

.dashboard-layout.no-navbar .main-content {
  padding-top: 60px;
}

@media (min-width: 1024px) {
  .dashboard-layout.no-navbar .main-content {
    padding-top: var(--space-6);
  }
}

/* Liquid Glass Lite: Sidebar with solid background, no transform animations */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--navbar-height);
  bottom: 0;
  width: var(--sidebar-width);
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-primary);
  padding: var(--space-4);
  overflow-y: auto;
  /* Liquid Glass Lite: Use visibility/opacity instead of transform */
  visibility: hidden;
  opacity: 0;
  transition: var(--transition-opacity);
  z-index: var(--z-fixed);
  display: flex;
  flex-direction: column;
}

.dashboard-layout.no-navbar .sidebar {
  top: 60px;
  padding-top: var(--space-4);
}

@media (min-width: 1024px) {
  .dashboard-layout.no-navbar .sidebar {
    top: 0;
  }
}

.sidebar.active {
  visibility: visible;
  opacity: 1;
}

@media (min-width: 1024px) {
  .sidebar {
    visibility: visible;
    opacity: 1;
  }
}

/* Sidebar Header (Logo) */
.sidebar-header {
  padding: var(--space-6) var(--space-3) var(--space-2);
  margin-bottom: var(--space-6);
}

.sidebar-logo {
  display: flex;
  align-items: center;
}

.sidebar-logo img {
  height: 28px;
  width: auto;
}

/* Sidebar User Profile */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-top: var(--space-4);
  border-top: 1px solid var(--border-primary);
}

.sidebar-user .avatar {
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-section {
  margin-bottom: var(--space-8);
}

.sidebar-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-3);
  padding: 0 var(--space-3);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  border-radius: var(--sidebar-item-radius);
  transition: var(--transition-colors);
}

.sidebar-link:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.sidebar-link.active {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  padding: var(--space-6);
  margin-left: 0;
}

@media (min-width: 1024px) {
  .main-content {
    margin-left: var(--sidebar-width);
  }
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
}

.page-description {
  color: var(--fg-secondary);
  margin-top: var(--space-1);
}

/* ==========================================
 * SUBJECT CARDS
 * ========================================== */

.subjects-grid {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .subjects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .subjects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Liquid Glass Lite: Larger radius, soft glow on hover */
.subject-card {
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  transition: var(--transition-colors);
  cursor: pointer;
  box-shadow: var(--card-shadow);
}

.subject-card:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-primary);
}

.subject-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.subject-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  font-size: var(--text-xl);
}

.subject-name {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.subject-meta {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
}

.subject-progress {
  margin-bottom: var(--space-2);
}

.subject-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

.subject-progress-label span:last-child {
  color: var(--fg-tertiary);
}

.add-subject-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background-color: var(--bg-secondary);
  border: 2px dashed var(--border-primary);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  cursor: pointer;
  transition: var(--transition-colors);
}

.add-subject-card:hover {
  border-color: var(--border-brand);
  background-color: var(--bg-brand-subtle);
}

.add-subject-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
  color: var(--fg-secondary);
}

.add-subject-card:hover .add-subject-icon {
  background-color: var(--bg-brand);
  color: var(--fg-on-brand);
}

.add-subject-text {
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
}

/* ==========================================
 * PRACTICE HUB
 * ========================================== */

.practice-hub-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8);
  background: url('../bg/bgmesh-1 Large.jpeg') center/cover no-repeat;
  border-radius: var(--radius-2xl);
  color: var(--fg-on-brand);
  margin-bottom: var(--space-8);
}

@media (min-width: 768px) {
  .practice-hub-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.practice-hub-info h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

.practice-hub-info p {
  opacity: 0.8;
}

.practice-hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.practice-hub-actions .btn {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--fg-on-brand);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.practice-hub-actions .btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.practice-hub-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.practice-hub-title-row h1 {
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .practice-hub-title-row h1 {
    flex: 1;
  }
}

.practice-hub-more-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-fast);
}

.practice-hub-more-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

@media (max-width: 767px) {
  .practice-hub-actions {
    width: 100%;
  }

  .practice-hub-actions > a.btn {
    flex: 1;
    justify-content: center;
  }
}

/* Subject More Menu */
.subject-more-menu {
  position: relative;
}

.subject-more-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 180px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s ease;
  z-index: 100;
}

@media (max-width: 767px) {
  .practice-hub-title-row .subject-more-dropdown {
    right: 0;
    left: auto;
  }
}

.subject-more-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.subject-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--fg-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.subject-more-item:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.subject-more-item:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.subject-more-item:hover {
  background-color: var(--bg-secondary);
}

.subject-more-item.danger {
  color: var(--fg-error);
}

.subject-more-item.danger:hover {
  background-color: var(--bg-error-subtle);
}

.subject-more-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 4px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Subject modal — bottom sheet on mobile */
@media (max-width: 639px) {
  #subjectModal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #templateView,
  #customView {
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh !important;
  }
}

/* Liquid Glass Lite: Stat cards */
.stat-card {
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  padding: var(--space-5);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: auto;
}

.stat-card-label {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-top: var(--space-4);
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-brand-subtle);
  border-radius: var(--radius-xl);
  color: var(--fg-brand);
  flex-shrink: 0;
}

.stat-card-icon svg {
  width: 16px;
  height: 16px;
}

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

.stat-card-change {
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.stat-card-change.positive {
  color: var(--fg-success);
}

.stat-card-change.negative {
  color: var(--fg-error);
}

/* Stat Card Tooltip - synced with analytics-tooltip */
.stat-card-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.stat-card-tooltip-icon {
  width: 14px;
  height: 14px;
  color: var(--fg-tertiary);
  transition: color 0.15s ease;
}

.stat-card-tooltip:hover .stat-card-tooltip-icon {
  color: var(--fg-brand);
}

.stat-card-tooltip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  background: #1e293b;
  border: none;
  color: rgba(255, 255, 255, 0.95);
  font-size: var(--text-xs);
  font-weight: var(--font-regular);
  line-height: 1.5;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  border-radius: var(--radius-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.stat-card-tooltip:hover .stat-card-tooltip-text {
  opacity: 1;
  visibility: visible;
}

/* Mobile: smaller width */
@media (max-width: 640px) {
  .stat-card-tooltip-text {
    left: 0;
    transform: translateX(0);
    max-width: 200px;
  }

  .stat-card-tooltip-text::after {
    left: 12px;
    transform: translateX(0);
  }
}

/* ==========================================
 * PRACTICE / TEST MODE
 * ========================================== */

.question-container {
  max-width: 800px;
  margin: 0 auto;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
}

.question-progress {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.question-counter {
  font-weight: var(--font-semibold);
}

.question-timer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.question-timer svg {
  width: 16px;
  height: 16px;
  color: var(--fg-tertiary);
}

.question-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
}

.question-type {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.question-text {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: var(--transition-fast);
}

.option-item:hover {
  background-color: var(--interactive-hover);
  border-color: var(--border-secondary);
}

.option-item.selected {
  background-color: var(--bg-brand-subtle);
  border-color: var(--border-brand);
}

.option-item.correct {
  background-color: var(--bg-success-subtle);
  border-color: var(--border-success);
}

.option-item.incorrect {
  background-color: var(--bg-error-subtle);
  border-color: var(--border-error);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-weight: var(--font-semibold);
  flex-shrink: 0;
}

.option-item.selected .option-letter {
  background-color: var(--bg-brand);
  color: var(--fg-on-brand);
}

.option-text {
  flex: 1;
  padding-top: var(--space-1);
}

.question-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

.question-actions .btn {
  flex: 1;
}

@media (min-width: 640px) {
  .question-actions .btn {
    flex: initial;
  }
}

/* Feedback / Explanation */
.feedback-card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-top: var(--space-6);
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.feedback-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

.feedback-icon.correct {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.feedback-icon.incorrect {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

.feedback-title {
  font-weight: var(--font-semibold);
}

.feedback-title.correct {
  color: var(--fg-success);
}

.feedback-title.incorrect {
  color: var(--fg-error);
}

.feedback-explanation {
  color: var(--fg-secondary);
  line-height: var(--leading-relaxed);
}

/* ==========================================
 * UPLOAD SECTION
 * ========================================== */

.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--border-brand);
  background-color: var(--bg-brand-subtle);
}

.upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
  color: var(--fg-secondary);
}

.upload-area:hover .upload-icon {
  background-color: var(--bg-brand);
  color: var(--fg-on-brand);
}

.upload-area-icon {
  width: 80px;
  height: 80px;
  min-width: 80px;
  min-height: 80px;
  max-width: 80px;
  max-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-bottom: var(--space-4);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.upload-area-icon.material {
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.upload-area-icon.syllabus {
  background: var(--bg-info-subtle);
  color: var(--fg-info);
}

.upload-area-icon.past_exam {
  background: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.upload-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.upload-description {
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
}

.upload-formats {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

/* ==========================================
 * UTILITIES
 * ========================================== */

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-fixed) - 2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (min-width: 1024px) {
  .sidebar-overlay {
    display: none !important;
  }
}

/* Body scroll lock when sidebar open on mobile */
body.sidebar-open {
  overflow: hidden;
}

@media (min-width: 1024px) {
  body.sidebar-open {
    overflow: auto;
  }
}

/* ==========================================
 * SOURCES PAGE
 * ========================================== */

.sources-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

@media (min-width: 768px) {
  .sources-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.sources-header-info h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
}

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

/* Sources Stats */
.sources-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .sources-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.sources-stat {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
}

.sources-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.sources-stat-icon svg {
  width: 20px;
  height: 20px;
}

.sources-stat-icon.pdf {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

.sources-stat-icon.image {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.sources-stat-icon.doc {
  background-color: var(--bg-info-subtle);
  color: var(--fg-info);
}

.sources-stat-info {
  display: flex;
  flex-direction: column;
}

.sources-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  line-height: 1;
}

.sources-stat-label {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: var(--space-1);
}

/* Sources Toolbar */
.sources-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .sources-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.sources-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.sources-search svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--fg-tertiary);
}

.sources-search-input {
  width: 100%;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-10);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--fg-primary);
  transition: var(--transition-fast);
}

.sources-search-input:focus {
  outline: none;
  border-color: var(--border-brand);
  background-color: var(--bg-primary);
}

.sources-search-input::placeholder {
  color: var(--fg-tertiary);
}

/* Sources Filter Dropdown */
.sources-filter-wrapper {
  position: relative;
}

.sources-filter-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.sources-filter-toggle:hover {
  background-color: var(--interactive-hover);
  border-color: var(--border-secondary);
}

.sources-filter-toggle.active {
  border-color: var(--border-secondary);
}

.sources-filter-icon {
  opacity: 0.7;
}

.sources-filter-label {
  white-space: nowrap;
}

.sources-filter-arrow {
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.sources-filter-toggle.active .sources-filter-arrow {
  transform: rotate(180deg);
}

.sources-filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
  padding: var(--space-2);
}

.sources-filter-dropdown.active {
  display: block;
}

.sources-filter-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.sources-filter-item:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.sources-filter-item.active {
  color: var(--fg-primary);
  font-weight: var(--font-medium);
}

.sources-filter-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sources-filter-item-icon.pdf { color: #ef4444; }
.sources-filter-item-icon.doc { color: #2563eb; }
.sources-filter-item-icon.ppt { color: #f59e0b; }
.sources-filter-item-icon.xls { color: #10b981; }
.sources-filter-item-icon.image { color: #10b981; }
.sources-filter-item-icon.audio { color: #ec4899; }
.sources-filter-item-icon.video { color: #8b5cf6; }

.sources-filter-item-label {
  flex: 1;
}

.sources-filter-item-check {
  color: var(--brand);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sources-filter-item.active .sources-filter-item-check {
  opacity: 1;
}

.sources-filter-divider {
  height: 1px;
  background-color: var(--border-primary);
  margin: var(--space-2) 0;
}

/* Legacy filter styles (keep for compatibility) */
.sources-filters {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sources-filters::-webkit-scrollbar {
  display: none;
}

.sources-filter-btn {
  padding: var(--space-2) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  white-space: nowrap;
  transition: var(--transition-fast);
}

.sources-filter-btn:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.sources-filter-btn.active {
  background-color: var(--fg-primary);
  border-color: var(--fg-primary);
  color: var(--bg-primary);
}

/* View toggle hidden - only list view used */
.sources-view-toggle {
  display: none;
}

.sources-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--fg-tertiary);
  transition: var(--transition-fast);
}

.sources-view-btn:hover {
  color: var(--fg-primary);
}

.sources-view-btn.active {
  background-color: var(--bg-primary);
  color: var(--fg-primary);
  box-shadow: var(--shadow-sm);
}

.sources-view-btn svg {
  width: 18px;
  height: 18px;
}

/* Sources Grid */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

@media (min-width: 640px) {
  .sources-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .sources-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .sources-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Source Card - matches wit-test-card style */
.source-card {
  position: relative;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: all var(--transition-fast);
}

.source-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.source-card-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
}

.source-card-preview svg {
  width: 48px;
  height: 48px;
  color: var(--fg-tertiary);
}

.source-card-preview.pdf {
  background-color: var(--bg-error-subtle);
}

.source-card-preview.pdf svg {
  color: var(--fg-error);
}

.source-card-preview.image {
  background-size: cover;
  background-position: center;
}

.source-card-preview.doc {
  background-color: var(--bg-info-subtle);
}

.source-card-preview.doc svg {
  color: var(--fg-info);
}

/* YouTube source preview */
.source-card-preview.youtube {
  background-color: #fef2f2;
}

.source-card-preview.youtube svg {
  color: #dc2626;
}

/* Website source preview */
.source-card-preview.website {
  background-color: #eff6ff;
}

.source-card-preview.website svg {
  color: #2563eb;
}

/* Text input source preview */
.source-card-preview.text {
  background-color: #f5f3ff;
}

.source-card-preview.text svg {
  color: #7c3aed;
}

/* Audio source preview */
.source-card-preview.audio {
  background-color: #fdf2f8;
}

.source-card-preview.audio svg {
  color: #db2777;
}

/* Video source preview */
.source-card-preview.video {
  background-color: #f5f3ff;
}

.source-card-preview.video svg {
  color: #7c3aed;
}

/* Excel source preview */
.source-card-preview.excel,
.source-card-preview.xlsx,
.source-card-preview.xls {
  background-color: #ecfdf5;
}

.source-card-preview.excel svg,
.source-card-preview.xlsx svg,
.source-card-preview.xls svg {
  color: #059669;
}

/* PowerPoint source preview */
.source-card-preview.ppt,
.source-card-preview.pptx {
  background-color: #fffbeb;
}

.source-card-preview.ppt svg,
.source-card-preview.pptx svg {
  color: #d97706;
}

/* Dark mode overrides for source type colors */
html[data-theme="dark"] .source-card-preview.youtube,
body.dark .source-card-preview.youtube {
  background-color: rgba(220, 38, 38, 0.15);
}

html[data-theme="dark"] .source-card-preview.website,
body.dark .source-card-preview.website {
  background-color: rgba(37, 99, 235, 0.15);
}

html[data-theme="dark"] .source-card-preview.text,
body.dark .source-card-preview.text {
  background-color: rgba(124, 58, 237, 0.15);
}

html[data-theme="dark"] .source-card-preview.audio,
body.dark .source-card-preview.audio {
  background-color: rgba(219, 39, 119, 0.15);
}

html[data-theme="dark"] .source-card-preview.video,
body.dark .source-card-preview.video {
  background-color: rgba(124, 58, 237, 0.15);
}

html[data-theme="dark"] .source-card-preview.excel,
html[data-theme="dark"] .source-card-preview.xlsx,
html[data-theme="dark"] .source-card-preview.xls,
body.dark .source-card-preview.excel,
body.dark .source-card-preview.xlsx,
body.dark .source-card-preview.xls {
  background-color: rgba(5, 150, 105, 0.15);
}

html[data-theme="dark"] .source-card-preview.ppt,
html[data-theme="dark"] .source-card-preview.pptx,
body.dark .source-card-preview.ppt,
body.dark .source-card-preview.pptx {
  background-color: rgba(217, 119, 6, 0.15);
}

.source-card-type {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background-color: rgba(0, 0, 0, 0.6);
  color: var(--color-neutral-0);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-md);
}

.source-card-info {
  padding: var(--space-4);
}

.source-card-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--space-2);
}

.source-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.source-card-meta span:not(:last-child)::after {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  background-color: var(--fg-tertiary);
  border-radius: var(--radius-full);
  margin-left: var(--space-3);
  vertical-align: middle;
}

.source-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4) var(--space-4);
}

.source-card-badge {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  flex: 1;
  min-width: 0;
}

.source-card-badge .badge {
  font-size: var(--text-xs);
}

.source-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.source-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--fg-tertiary);
  transition: var(--transition-fast);
}

.source-action-btn:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.source-action-btn-danger:hover {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

.source-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Source Card More Menu */
.source-card-more {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.source-card-menu-anchor {
  position: relative;
}

.source-card-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-tertiary);
  cursor: pointer;
  transition: all 0.2s;
}

.source-card-more-btn:hover {
  background: var(--bg-secondary);
  color: var(--fg-primary);
}

.source-card-more-btn svg {
  width: 18px;
  height: 18px;
}

.source-card-more-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-1);
  min-width: 160px;
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 100;
}

.source-card-more-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.source-card-more-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-primary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.source-card-more-item:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.source-card-more-item:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.source-card-more-item:hover {
  background: var(--bg-tertiary);
}

.source-card-more-item.danger {
  color: var(--fg-error);
}

.source-card-more-item.danger:hover {
  background: var(--bg-error-subtle);
}

.source-card-more-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Quick Upload Area */
.sources-quick-upload {
  margin-top: var(--space-8);
}

.quick-upload-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-6);
  background-color: var(--bg-secondary);
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: var(--transition-fast);
}

.quick-upload-area:hover,
.quick-upload-area.dragover {
  border-color: var(--border-brand);
  background-color: var(--bg-brand-subtle);
}

.quick-upload-area svg {
  width: 24px;
  height: 24px;
  color: var(--fg-tertiary);
}

.quick-upload-area:hover svg,
.quick-upload-area.dragover svg {
  color: var(--fg-brand);
}

.quick-upload-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.quick-upload-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

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

/* Sources List View */
.sources-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.sources-list .source-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
}

.sources-list .source-card-preview {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-lg);
}

.sources-list .source-card-preview svg {
  width: 24px;
  height: 24px;
}

.sources-list .source-card-type {
  display: none;
}

.sources-list .source-card-info {
  flex: 1;
  padding: 0;
  min-width: 0;
}

/* Force children to stack vertically */
.sources-list .source-card-info > .source-card-name,
.sources-list .source-card-info > .source-card-meta {
  display: block;
  width: 100%;
}

.sources-list .source-card-info > .source-card-badge {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  width: 100%;
}

.sources-list .source-card-name {
  margin-bottom: var(--space-1);
}

.sources-list .source-card-badge {
  margin-top: var(--space-1);
}

.sources-list .source-card-actions {
  flex: 0 0 auto;
}

/* Hide view button for consistency */
.sources-list .source-card-actions > .source-action-btn:first-child {
  display: none;
}

/* Content Max Width - List Pages */
.sources-header,
.sources-toolbar,
.sources-list,
.wit-tests-header,
.wit-tests-toolbar,
.wit-tests-list,
.bookmarks-header,
.bookmarks-filters,
.bookmarks-list,
.bookmarks-header + .analytics-stats,
.prep-plan-header,
.prep-plan-stats,
.prep-plan-intro-banner,
.prep-plan-section,
.prep-plan-priority-summary,
.prep-plan-topics-summary,
.prep-plan-topics,
.prep-plan-source-section,
.source-detail-header,
.source-detail-actions,
.source-detail-link,
.source-detail-section,
.source-detail-empty,
.subject-content > .empty-state {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.prep-plan-topics-summary {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
}

/* Sources Mobile Responsive */
@media (max-width: 639px) {
  /* Header */
  .sources-header {
    flex-direction: column;
    gap: var(--space-4);
  }

  .sources-header .btn {
    width: 100%;
    justify-content: center;
  }

  /* Toolbar - search and filter on same row */
  .sources-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    max-width: 100%;
  }

  .sources-search {
    flex: 1;
    min-width: 0;
  }

  /* Filter dropdown - same row as search, icon only */
  .sources-filter-wrapper {
    flex-shrink: 0;
  }

  .sources-filter-toggle {
    padding: var(--space-3);
    height: 42px;
    width: 42px;
    justify-content: center;
  }

  .sources-filter-label,
  .sources-filter-arrow {
    display: none;
  }

  .sources-filter-dropdown {
    left: auto;
    right: 0;
    min-width: 200px;
  }

  /* Filters - horizontal scroll within bounds */
  .sources-filters {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .sources-filter-btn {
    flex-shrink: 0;
  }

  /* Hide view toggle on mobile */
  .sources-view-toggle {
    display: none;
  }

  /* Source Cards - CSS Grid for mobile */
  /* Row 1: icon (left) + buttons (right) */
  /* Row 2: title (full width) */
  /* Row 3: meta + badges (full width) */
  .sources-list .source-card {
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto auto;
    gap: 0 var(--space-3);
    padding: var(--space-3);
    align-items: center;
  }

  /* Preview - row 1, col 1 */
  .sources-list .source-card-preview {
    grid-column: 1;
    grid-row: 1;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .sources-list .source-card-preview svg {
    width: 20px;
    height: 20px;
  }

  /* More/actions - row 1, col 2, aligned right */
  .sources-list .source-card-more {
    position: static;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  /* Info - row 2-3, full width */
  .sources-list .source-card-info {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    display: block !important;
    padding-top: var(--space-2);
  }

  .sources-list .source-card-name {
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0;
    flex: none;
  }

  .sources-list .source-card-meta {
    font-size: var(--text-xs);
    gap: var(--space-2);
    flex: none;
  }

  /* Badge - below meta */
  .sources-list .source-card-badge {
    margin-top: var(--space-1);
    flex: none !important;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
  }

  .sources-list .source-card-badge .badge,
  .sources-list .source-card-badge .queue-item-tag {
    height: var(--badge-height-sm);
    font-size: 10px;
    padding: 0 var(--space-2);
    white-space: nowrap;
  }

  /* Actions - top right */
  .sources-list .source-card-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }

  /* Action buttons - touch friendly */
  .source-action-btn {
    width: 36px;
    height: 36px;
  }

  .source-action-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Quick upload area */
  .quick-upload-area {
    flex-direction: column;
    text-align: center;
    padding: var(--space-6) var(--space-4);
    gap: var(--space-3);
  }

  .quick-upload-area span {
    font-size: var(--text-sm);
  }

  /* Subject content on mobile - prevent overflow */
  .subject-content {
    padding: var(--space-4) 5%;
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Prevent source cards from overflowing */
  .sources-list .source-card {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Ensure text truncates properly */
  .sources-list .source-card-meta {
    overflow: hidden;
  }

  .sources-list .source-card-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Tables inside cards - horizontal scroll on mobile */
  .subject-content .card:has(.table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .subject-content .table {
    min-width: 500px;
  }

  .subject-content .table th,
  .subject-content .table td {
    white-space: nowrap;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }
}

/* ==========================================
 * SOURCE DETAIL PAGE
 * ========================================== */

.source-detail-header {
  margin-bottom: var(--space-6);
}

.source-detail-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  text-decoration: none;
  margin-bottom: var(--space-4);
  transition: color 0.15s;
}

.source-detail-back:hover {
  color: var(--fg-primary);
}

.source-detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.source-detail-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin: 0;
  word-break: break-word;
}

.source-detail-badges {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  align-items: center;
  padding-top: var(--space-1);
}

.source-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-top: var(--space-2);
}

.source-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.source-detail-delete-btn {
  color: var(--fg-error) !important;
  margin-left: auto;
}

.source-detail-link {
  margin-bottom: var(--space-6);
}

.source-detail-link .source-link-section {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-tertiary, #f1f5f9);
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.source-detail-link .source-link-section:hover {
  background: var(--color-neutral-200);
}

.source-detail-link .source-link-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.source-detail-link .source-link-icon.youtube { background: #fef2f2; color: #dc2626; }
.source-detail-link .source-link-icon.website { background: #eff6ff; color: #2563eb; }
.source-detail-link .source-link-icon.text { background: #f5f3ff; color: #7c3aed; }
.source-detail-link .source-link-icon.pdf { background: var(--bg-error-subtle, #fef2f2); color: var(--fg-error, #ef4444); }
.source-detail-link .source-link-icon.image { background: #ecfdf5; color: #10b981; }
.source-detail-link .source-link-icon.audio { background: #fdf2f8; color: #db2777; }
.source-detail-link .source-link-icon.video { background: #f5f3ff; color: #7c3aed; }
.source-detail-link .source-link-icon.document { background: var(--bg-brand-subtle, #EDEDFC); color: var(--fg-brand, #3E39B1); }

.source-detail-link .source-link-info {
  flex: 1;
  min-width: 0;
}

.source-detail-link .source-link-label {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
  margin-bottom: 2px;
}

.source-detail-link .source-link-url {
  font-size: var(--text-sm);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-detail-link .source-link-badge {
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  color: var(--fg-secondary);
  border-radius: 9999px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.source-detail-link .source-link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 10px 20px;
  background: var(--bg-brand, #4E47DD);
  color: #ffffff;
  border-radius: 9999px;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  flex-shrink: 0;
  transition: all 0.2s;
}

.source-detail-link .source-link-btn:hover {
  background: var(--color-primary-600, #3E39B1);
  transform: translateY(-1px);
}

.source-detail-link .source-link-btn.youtube { background: #ff0000; }
.source-detail-link .source-link-btn.youtube:hover { background: #cc0000; }
.source-detail-link .source-link-btn.website { background: #3b82f6; }
.source-detail-link .source-link-btn.website:hover { background: #2563eb; }
.source-detail-link .source-link-btn-chevron { display: none; }

.source-detail-meta-sep {
  width: 1px;
  height: 12px;
  background: var(--border);
  flex-shrink: 0;
}

.source-detail-section {
  margin-bottom: var(--space-8);
}

.source-detail-section-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-4) 0;
}

.source-detail-extracts {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.source-detail-extract {
  padding: var(--space-5);
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.source-detail-extract:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.source-detail-extract.extract-highlight {
  animation: extractHighlightPulse 2.5s ease-out;
  border-color: var(--primary-400);
}

@keyframes extractHighlightPulse {
  0% { background: var(--primary-50); border-color: var(--primary-400); box-shadow: 0 0 0 4px var(--primary-100); }
  50% { background: var(--primary-50); border-color: var(--primary-400); box-shadow: 0 0 0 4px var(--primary-100); }
  100% { background: var(--bg-primary); border-color: var(--primary-400); box-shadow: var(--shadow-xs); }
}

.source-detail-extract-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.source-detail-extract-badges {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.source-detail-extract-importance {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.source-detail-ask-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1-5) var(--space-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.source-detail-ask-ai-btn:hover {
  background: var(--bg-brand-subtle);
  border-color: var(--fg-brand);
  color: var(--fg-brand);
}

.source-detail-extract-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-2) 0;
}

.source-detail-extract-content {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  line-height: 1.7;
}

.source-detail-extract-content p {
  margin: 0;
  white-space: pre-wrap;
}

.source-detail-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  color: var(--fg-brand);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  padding: var(--space-1) 0;
  margin-top: var(--space-2);
}

.source-detail-toggle-btn:hover {
  text-decoration: underline;
}

.source-detail-extract-summary {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
  font-style: italic;
  line-height: 1.6;
}

.source-detail-empty {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--fg-secondary);
}

.source-detail-empty p {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-base);
}

.source-detail-empty-hint {
  font-size: var(--text-sm) !important;
  color: var(--fg-tertiary) !important;
}

/* Extract type badges — reuse colors from source viewer */
.extract-type-badge {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--bg-brand);
  color: white;
  text-transform: capitalize;
}

.extract-type-badge.concept { background: #6366f1; }
.extract-type-badge.definition { background: #8b5cf6; }
.extract-type-badge.formula { background: #ec4899; }
.extract-type-badge.example { background: #10b981; }
.extract-type-badge.key_point { background: #f59e0b; }
.extract-type-badge.summary { background: #06b6d4; }
.extract-type-badge.theorem { background: #ef4444; }
.extract-type-badge.rule { background: #3b82f6; }
.extract-type-badge.review { background: #64748b; }

/* Source Detail — Tablet */
@media (max-width: 767px) {
  .source-detail-link .source-link-section {
    padding: 12px 16px;
  }

  .source-detail-extract {
    padding: var(--space-4);
  }
}

/* Source Detail — Mobile */
@media (max-width: 479px) {
  .source-detail-title-row {
    flex-direction: column;
    gap: var(--space-2);
  }

  .source-detail-title {
    font-size: var(--text-xl);
  }

  .source-detail-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .source-detail-link .source-link-section {
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-lg);
  }

  .source-detail-link .source-link-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
  }

  .source-detail-link .source-link-btn,
  .source-detail-link .source-link-btn.youtube,
  .source-detail-link .source-link-btn.website,
  .source-detail-link .source-link-btn.pdf,
  .source-detail-link .source-link-btn.image,
  .source-detail-link .source-link-btn.audio,
  .source-detail-link .source-link-btn.video,
  .source-detail-link .source-link-btn.document {
    padding: 0;
    background: none;
    color: var(--fg-tertiary);
    border-radius: 0;
    font-size: 0;
    flex-shrink: 0;
  }
  .source-detail-link .source-link-btn:hover {
    background: none;
    transform: none;
    color: var(--fg-primary);
  }
  .source-detail-link .source-link-btn-text,
  .source-detail-link .source-link-btn svg:not(.source-link-btn-chevron) {
    display: none;
  }
  .source-detail-link .source-link-btn-chevron {
    display: block;
  }

  .source-detail-meta {
    flex-wrap: wrap;
  }

  .source-detail-extract {
    padding: var(--space-3);
    border-radius: var(--radius-lg);
  }

  .source-detail-extract-title {
    font-size: var(--text-sm);
  }
}

/* ==========================================
 * UPLOAD PAGE
 * ========================================== */

/* Top Header Bar */
.upload-top-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.upload-top-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  line-height: 1.3;
}

.upload-top-subtitle {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-top: 2px;
}

.upload-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  color: var(--fg-secondary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.upload-back-btn:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
  border-color: var(--border-secondary);
}

/* Content Type Selector */
/* Content Type Tabs (Level 1) */
/* Upload section wrapper — constrain width to match question-container */
.upload-section {
  max-width: 800px;
  margin: 0 auto;
}

/* Content Type Tabs — underline style */
.ct-tabs {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: var(--space-5);
}

.ct-tab {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-1);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  margin-bottom: -1px;
}

.ct-tab:hover {
  color: var(--fg-primary);
}

.ct-tab.active {
  color: var(--fg-brand);
  border-bottom-color: var(--fg-brand);
}

.ct-tab svg {
  flex-shrink: 0;
}

.ct-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--fg-brand);
  color: white;
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1;
}

/* Content Type Panel — card body with shadow */
.ct-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}

/* Upload Tabs — compact rounded pills, no bg */
.upload-tabs {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* Upload Info Banner */
.upload-info-banner {
  margin-top: var(--space-4);
  background: var(--brand-bg, rgba(99, 102, 241, 0.06));
  border: 1px solid var(--brand-border, rgba(99, 102, 241, 0.15));
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  position: relative;
  overflow: hidden;
}

.upload-info-banner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand);
}

.upload-info-banner-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.upload-info-banner-icon {
  color: var(--brand);
  display: flex;
  flex-shrink: 0;
}

.upload-info-banner-title {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--fg-primary);
  flex: 1;
}

.upload-info-banner-expand {
  display: none;
  background: none;
  border: none;
  color: var(--fg-secondary);
  cursor: pointer;
  padding: var(--space-1);
}

.upload-info-banner-expand svg {
  transition: transform 0.2s ease;
}

.upload-info-banner-close {
  background: none;
  border: none;
  color: var(--fg-secondary);
  cursor: pointer;
  padding: var(--space-1);
  opacity: 0.6;
  transition: opacity 0.15s;
}

.upload-info-banner-close:hover {
  opacity: 1;
}

.upload-info-banner-body {
  margin-top: var(--space-3);
}

.upload-info-banner-summary {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-sm);
}

.upload-info-banner-list {
  margin: 0;
  padding-left: var(--space-5);
  list-style-type: disc;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.upload-info-banner-list li {
  line-height: 1.5;
}

.upload-info-banner-list strong {
  color: var(--fg-primary);
}

.upload-info-banner-dismiss {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
  cursor: pointer;
}

.upload-info-banner-dismiss input[type="checkbox"] {
  accent-color: var(--brand);
}

/* Mobile: collapsed by default, expand on click */
@media (max-width: 639px) {
  .upload-info-banner-expand {
    display: flex;
  }

  .upload-info-banner-body {
    display: none;
  }

  .upload-info-banner.expanded .upload-info-banner-body {
    display: block;
  }
}

/* Queued Items Section */
.queue-section {
  margin-top: var(--space-6);
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.queue-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.queue-count {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.queue-empty {
  text-align: center;
  padding: var(--space-6);
  color: var(--fg-tertiary);
  font-size: var(--text-sm);
}

.queue-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
}

.queue-item:hover {
  border-color: var(--border-secondary);
}

.queue-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.queue-item-info {
  flex: 1;
  min-width: 0;
}

.queue-item-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-name.clickable {
  cursor: pointer;
  color: var(--fg-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.queue-item-meta {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.queue-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.queue-item-tag {
  display: inline-flex;
  align-items: center;
  height: var(--badge-height-md);
  padding: 0 var(--badge-padding);
  border-radius: var(--badge-radius);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1;
  white-space: nowrap;
}

.queue-item-tag.material {
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.queue-item-tag.syllabus {
  background: var(--bg-info-subtle);
  color: var(--fg-info);
}

.queue-item-tag.past_exam {
  background: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

/* Content type dropdown on queue items */
.queue-item-ct-dropdown {
  position: relative;
}

.queue-item-ct-dropdown .queue-item-tag {
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
}

.queue-item-ct-dropdown .queue-item-tag:hover {
  opacity: 0.8;
}

.queue-ct-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 160px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  overflow: hidden;
}

.queue-ct-menu.open {
  display: block;
}

.queue-ct-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.queue-ct-option:hover {
  background: var(--bg-tertiary);
}

.queue-ct-option.material { color: var(--fg-brand); }
.queue-ct-option.syllabus { color: var(--fg-info); }
.queue-ct-option.past_exam { color: var(--fg-warning); }

/* Confirm dialog content type row */
.confirm-ct-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.confirm-ct-row .queue-item-tag { flex-shrink: 0; }

@media (max-width: 480px) {
  .confirm-ct-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

.queue-item-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--fg-tertiary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.queue-item-remove:hover {
  background: var(--bg-error-subtle);
  color: var(--fg-error);
}

.upload-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.upload-tab:hover {
  background: var(--bg-tertiary);
  color: var(--fg-primary);
}

.upload-tab.active {
  background-color: var(--fg-primary);
  color: var(--bg-primary);
  border-color: var(--fg-primary);
}

.upload-tab svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* Tab Content */
.upload-tab-content {
  display: none;
}

.upload-tab-content.active {
  display: block;
}

/* URL Form Styles */
.upload-url-form,
.upload-text-form {
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
}

.upload-url-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

.upload-url-icon.youtube {
  background: var(--bg-error-subtle);
  color: var(--fg-error);
}

.upload-url-icon.website {
  background: var(--bg-info-subtle);
  color: var(--fg-info);
}

.upload-url-icon.text {
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.upload-url-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: var(--space-2);
}

.upload-url-description {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-6);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.upload-url-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 500px;
  margin: 0 auto;
}

.upload-url-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--fg-primary);
  transition: var(--transition-fast);
}

.upload-url-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--bg-brand-subtle);
}

.upload-url-input::placeholder {
  color: var(--fg-tertiary);
}

.upload-url-input-group .btn {
  align-self: flex-end;
}

/* Text Form Specific */
.upload-text-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 600px;
  margin: 0 auto;
  text-align: left;
}

.upload-text-textarea {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-sm);
  font-family: inherit;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--fg-primary);
  resize: vertical;
  min-height: 200px;
  transition: var(--transition-fast);
}

.upload-text-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--bg-brand-subtle);
}

.upload-text-textarea::placeholder {
  color: var(--fg-tertiary);
}

.upload-text-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upload-text-count {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Mobile responsive for upload page */
@media (max-width: 767px) {
  /* Page header */
  .page-header {
    margin-bottom: var(--space-5);
  }

  .page-title {
    font-size: var(--text-2xl);
  }

  .page-description {
    font-size: var(--text-sm);
  }

  /* Upload area */
  .upload-area {
    min-height: 200px;
    padding: var(--space-6) var(--space-4);
  }

  .upload-icon {
    width: 48px;
    height: 48px;
  }

  .upload-icon svg {
    width: 24px;
    height: 24px;
  }

  .upload-title {
    font-size: var(--text-base);
  }

  .upload-description {
    font-size: var(--text-sm);
  }

  .upload-formats {
    font-size: var(--text-xs);
  }

  /* Content type tabs */
  .ct-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: var(--space-4);
  }

  .ct-tabs::-webkit-scrollbar {
    display: none;
  }

  .ct-tab {
    flex-shrink: 0;
    padding: var(--space-3) 0;
    font-size: var(--text-sm);
    white-space: nowrap;
    gap: var(--space-2);
  }

  .ct-tab svg {
    width: 18px;
    height: 18px;
  }

  .ct-tab-badge {
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    padding: 0 4px;
  }

  .ct-panel {
    padding: var(--space-4);
  }

  /* Upload tabs */
  .upload-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .upload-tabs::-webkit-scrollbar {
    display: none;
  }

  /* URL/Text forms */
  .upload-url-form,
  .upload-text-form {
    padding: var(--space-5);
  }

  .upload-url-icon,
  .upload-area-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
  }

  .upload-url-icon svg,
  .upload-area-icon svg {
    width: 24px;
    height: 24px;
  }

  .upload-url-title {
    font-size: var(--text-base);
  }

  .upload-url-description {
    font-size: var(--text-sm);
  }

  /* Text textarea */
  .upload-text-textarea {
    min-height: 150px;
    font-size: var(--text-sm);
  }

  /* Queue */
  .queue-item {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .queue-item-icon {
    width: 32px;
    height: 32px;
  }

  .queue-item-tag {
    height: var(--badge-height-sm);
    font-size: 10px;
    padding: 0 var(--space-2);
  }

  .upload-top-header {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .upload-top-title {
    font-size: var(--text-base);
  }

  .upload-top-subtitle {
    font-size: var(--text-xs);
  }

  /* Back button */
  .upload-back-btn {
    width: 36px;
    height: 36px;
  }

  .upload-back-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Small mobile upload */
@media (max-width: 479px) {

  .upload-area {
    min-height: 160px;
    padding: var(--space-5) var(--space-3);
  }

  .upload-icon {
    width: 40px;
    height: 40px;
  }

  .upload-title {
    font-size: var(--text-base);
  }

  .upload-description {
    font-size: var(--text-sm);
  }

  .ct-tab {
    padding: var(--space-2) 0;
    font-size: 14px;
    gap: var(--space-1);
  }

  .ct-tab svg {
    width: 16px;
    height: 16px;
  }


  .ct-tab-badge {
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    padding: 0 3px;
  }

  .upload-tab {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }

  .upload-tab svg {
    width: 12px;
    height: 12px;
  }

  .upload-url-form,
  .upload-text-form {
    padding: var(--space-4);
  }

  .upload-url-icon,
  .upload-area-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
  }

  .upload-url-title {
    font-size: var(--text-sm);
  }

  .upload-url-description {
    font-size: var(--text-xs);
  }

  .ct-panel {
    padding: var(--space-3);
  }

  .queue-item-name {
    font-size: var(--text-xs);
  }
}

/* Sticky CTA Footer */
.upload-cta-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  padding: var(--space-4) var(--space-6);
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.upload-cta-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .upload-cta-footer {
    padding: var(--space-3) var(--space-4);
  }

  .upload-cta-container {
    flex-direction: column;
    gap: var(--space-3);
  }

  /* Row 1: Status text centered */
  .upload-cta-container .upload-status {
    justify-content: center;
    width: 100%;
  }

  /* Row 2: Buttons full width */
  .upload-cta-container .upload-cta-buttons {
    width: 100%;
  }

  .upload-cta-container .btn {
    flex: 1;
    justify-content: center;
  }
}


/* ==========================================
 * FILE PREVIEW CONTENT STYLES
 * Uses standardized .modal from base.css
 * ========================================== */

/* Preview body with centered content */
.preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.preview-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

.preview-pdf {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: var(--radius-lg);
}

.preview-unsupported {
  text-align: center;
  padding: var(--space-8);
}

.preview-unsupported-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-4);
}

.preview-unsupported-icon svg {
  width: 40px;
  height: 40px;
}

.preview-unsupported-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-2);
  word-break: break-all;
}

.preview-unsupported-info {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
}

.preview-unsupported-text {
  color: var(--fg-tertiary);
  font-size: var(--text-sm);
  margin: 0;
}

@media (max-width: 639px) {
  .preview-image {
    max-height: 60vh;
  }

  .preview-pdf {
    height: 60vh;
  }
}

/* ==========================================
 * PROCESSING PAGE
 * ========================================== */

.processing-container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-8) 0;
}

.processing-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.processing-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: var(--bg-brand-subtle);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

.processing-spinner {
  width: 40px;
  height: 40px;
  color: var(--fg-brand);
  animation: spin 1s linear infinite;
}

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

.processing-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-2);
}

.processing-subtitle {
  font-size: var(--text-base);
  color: var(--fg-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* Progress Bar */
.processing-progress {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.processing-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-400));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.processing-progress-text {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-8);
}

.processing-progress-text span {
  font-weight: var(--font-semibold);
  color: var(--fg-brand);
}

/* Processing Steps */
.processing-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.processing-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: var(--transition-normal);
}

.processing-step.active {
  background-color: var(--bg-brand-subtle);
  border-color: var(--border-brand);
}

.processing-step.complete {
  background-color: var(--bg-success-subtle);
  border-color: var(--color-success-200);
}

.processing-step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.processing-step-icon svg {
  width: 24px;
  height: 24px;
  display: none;
}

.processing-step-icon.pending svg.step-pending {
  display: block;
  color: var(--fg-tertiary);
}

.processing-step-icon.active svg.step-active {
  display: block;
  color: var(--fg-brand);
  animation: spin 1s linear infinite;
}

.processing-step-icon.complete svg.step-complete {
  display: block;
  color: var(--fg-success);
}

.processing-step-content {
  flex: 1;
  padding-top: var(--space-2);
}

.processing-step-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.processing-step.active .processing-step-title {
  color: var(--fg-brand);
}

.processing-step.complete .processing-step-title {
  color: var(--fg-success);
}

.processing-step-description {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

/* Processing Stats */
.processing-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-6);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-8);
}

.processing-stat {
  text-align: center;
}

.processing-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-brand);
  line-height: 1;
}

.processing-stat-label {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: var(--space-1);
}

/* Processing Complete */
.processing-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-8);
  background-color: var(--bg-success-subtle);
  border: 1px solid var(--color-success-200);
  border-radius: var(--radius-xl);
  animation: fadeIn 0.5s ease;
}

/* Liquid Glass Lite: Opacity only animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.processing-complete-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background-color: var(--bg-success);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}

.processing-complete-icon svg {
  width: 40px;
  height: 40px;
  color: var(--fg-on-success);
}

.processing-complete-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--fg-success);
  margin-bottom: var(--space-2);
}

.processing-complete-text {
  font-size: var(--text-base);
  color: var(--fg-secondary);
  margin-bottom: var(--space-6);
}

.processing-complete-text strong {
  color: var(--fg-success);
}

.processing-complete .btn {
  gap: var(--space-2);
}

@media (max-width: 639px) {
  .processing-container {
    padding: var(--space-6) 0;
  }

  .processing-icon {
    width: 64px;
    height: 64px;
  }

  .processing-spinner {
    width: 32px;
    height: 32px;
  }

  .processing-title {
    font-size: var(--text-xl);
  }

  .processing-stats {
    gap: var(--space-4);
    padding: var(--space-4);
  }

  .processing-stat-value {
    font-size: var(--text-xl);
  }
}

/* Sample Test Preview */
.processing-complete-section {
  animation: fadeIn 0.5s ease;
}

.processing-complete-section .processing-complete {
  margin-bottom: var(--space-6);
}

.sample-test-preview {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-6);
  position: relative;
}

.sample-test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
}

.sample-test-header h3 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0;
}

.sample-questions {
  padding: var(--space-4);
}

.sample-question {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  transition: var(--transition-fast);
}

.sample-question:last-child {
  margin-bottom: 0;
}

.sample-question.blurred {
  opacity: 0.5;
  filter: blur(2px);
  user-select: none;
}

.sample-question-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--bg-brand);
  color: var(--fg-on-brand);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sample-question-content {
  flex: 1;
}

.sample-question-text {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}

.sample-question-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.sample-option {
  padding: var(--space-2) var(--space-3);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.sample-test-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-4);
  background: linear-gradient(to top, var(--bg-primary) 50%, transparent);
  text-align: center;
  pointer-events: none;
}

.sample-test-overlay p {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-tertiary);
  margin: 0;
}

.processing-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.processing-actions .btn {
  justify-content: center;
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .processing-actions {
    flex-direction: row;
    justify-content: center;
  }

  .processing-actions .btn {
    min-width: 180px;
  }
}

@media (max-width: 639px) {
  .sample-question-options {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
 * TEST PAGE
 * ========================================== */

/* Mode Selection */
.test-mode-selection {
  max-width: 800px;
  margin: 0 auto;
}

.test-mode-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.test-mode-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.test-mode-subtitle {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.test-mode-content {
  text-align: center;
  margin-bottom: var(--space-8);
}

.test-mode-content h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-2);
}

.test-mode-description {
  color: var(--fg-secondary);
  margin-bottom: var(--space-8);
}

.test-mode-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .test-mode-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Liquid Glass Lite: Test mode cards */
.test-mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--card-padding);
  background-color: var(--bg-primary);
  border: 2px solid var(--border-primary);
  border-radius: var(--card-radius);
  cursor: pointer;
  transition: var(--transition-colors);
  text-align: center;
  box-shadow: var(--card-shadow);
}

/* Liquid Glass Lite: No transform on hover */
.test-mode-card:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-primary);
}

.test-mode-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}

.test-mode-card-icon svg {
  width: 32px;
  height: 32px;
}

.test-mode-card-icon.practice {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.test-mode-card-icon.test {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.test-mode-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-2);
}

.test-mode-card-description {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

.test-mode-card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4) 0;
  text-align: left;
  width: 100%;
}

.test-mode-card-features li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  padding: var(--space-2) 0;
}

.test-mode-card-features svg {
  width: 16px;
  height: 16px;
  color: var(--fg-success);
  flex-shrink: 0;
}

/* Banner at footer of mode card */
.test-mode-card-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: calc(100% + var(--card-padding) * 2);
  margin: auto calc(-1 * var(--card-padding)) calc(-1 * var(--card-padding));
  padding: var(--space-2) var(--space-3);
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.test-mode-card-banner svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.test-mode-card-banner.practice {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.test-mode-card-banner.test {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

/* Test Interface */
.test-interface {
  max-width: 700px;
  margin: 0 auto;
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.test-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.test-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.test-mode-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
}

.test-mode-badge.practice {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.test-mode-badge.test {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.test-progress-info {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
}

.test-progress-info span:first-child {
  color: var(--fg-brand);
}

.test-progress {
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.test-progress-bar {
  height: 100%;
  background: var(--bg-brand);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Question Card */
.test-question-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.test-question-number {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-tertiary);
  margin-bottom: var(--space-3);
}

.test-question-text {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

/* Question Media (images from source documents) */
.test-question-media {
  margin: 0 0 var(--space-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
}

.test-question-media img {
  max-width: 100%;
  max-height: 500px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  cursor: zoom-in;
  transition: var(--transition-fast);
  object-fit: contain;
}

.test-question-media img:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-md);
}

.test-question-media .media-caption {
  width: 100%;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: calc(-1 * var(--space-2));
}

/* Image Lightbox */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: lightboxFadeIn 0.2s ease;
}

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

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Review section media */
.test-review-item-media {
  margin: var(--space-3) 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.test-review-item-media img {
  max-width: 200px;
  max-height: 150px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  cursor: zoom-in;
  object-fit: contain;
}

/* Test Options */
.test-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.test-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
  width: 100%;
}

.test-option:hover:not(.disabled) {
  border-color: var(--border-brand);
  background-color: var(--bg-brand-subtle);
}

.test-option.selected {
  border-color: var(--border-brand);
  background-color: var(--bg-brand-subtle);
}

.test-option.correct {
  border-color: var(--color-success-500);
  background-color: var(--bg-success-subtle);
}

.test-option.incorrect {
  border-color: var(--color-error-500);
  background-color: var(--bg-error-subtle);
}

.test-option.disabled {
  cursor: default;
}

.test-option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.test-option.selected .test-option-letter {
  background-color: var(--bg-brand);
  color: var(--fg-on-brand);
}

.test-option.correct .test-option-letter {
  background-color: var(--bg-success);
  color: var(--fg-on-success);
}

.test-option.incorrect .test-option-letter {
  background-color: var(--bg-error);
  color: var(--fg-on-error);
}

.test-option-text {
  flex: 1;
  font-size: var(--text-base);
  color: var(--fg-primary);
}

.test-option-indicator {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.test-option.correct .test-option-indicator::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  background: var(--fg-success);
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/contain no-repeat;
}

.test-option.incorrect .test-option-indicator::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  background: var(--fg-error);
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Test Feedback */
.test-feedback {
  margin-top: var(--space-6);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  animation: fadeIn 0.3s ease;
}

.test-feedback.correct {
  background-color: var(--bg-success-subtle);
  border: 1px solid var(--color-success-200);
}

.test-feedback.incorrect {
  background-color: var(--bg-error-subtle);
  border: 1px solid var(--color-error-200);
}

.test-feedback.neutral {
  background-color: var(--bg-brand-subtle);
  border: 1px solid var(--color-brand-200);
}

.test-feedback.neutral .test-feedback-header span {
  color: var(--fg-brand);
}

.test-feedback-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.test-feedback-header .feedback-icon {
  width: 24px;
  height: 24px;
  display: none;
}

.test-feedback.correct .feedback-icon.correct {
  display: block;
  color: var(--fg-success);
}

.test-feedback.incorrect .feedback-icon.incorrect {
  display: block;
  color: var(--fg-error);
}

.test-feedback-header span {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
}

.test-feedback.correct .test-feedback-header span {
  color: var(--fg-success);
}

.test-feedback.incorrect .test-feedback-header span {
  color: var(--fg-error);
}

.test-feedback-explanation {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Test Navigation */
.test-navigation {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.test-navigation .btn {
  gap: var(--space-2);
}

/* Test Navigator */
.test-navigator {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
}

.test-navigator-title {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-tertiary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.test-navigator-dots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.test-navigator-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: var(--bg-primary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.test-navigator-dot:hover {
  border-color: var(--border-brand);
}

.test-navigator-dot.active {
  border-color: var(--border-brand);
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.test-navigator-dot.answered {
  background-color: var(--bg-tertiary);
}

.test-navigator-dot.correct {
  border-color: var(--color-success-500);
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.test-navigator-dot.incorrect {
  border-color: var(--color-error-500);
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

/* Test Results */
.test-results {
  max-width: 600px;
  margin: 0 auto;
  animation: fadeIn 0.5s ease;
}

.test-results-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  margin-bottom: var(--space-6);
}

.test-results-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-4);
}

.test-results-icon svg {
  width: 40px;
  height: 40px;
}

.test-results-icon.excellent {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.test-results-icon.good {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.test-results-icon.needs-work {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.test-results-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-2);
}

.test-results-subtitle {
  font-size: var(--text-base);
  color: var(--fg-secondary);
  margin-bottom: var(--space-6);
}

.test-results-score {
  margin-bottom: var(--space-6);
}

.test-results-score-circle {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  padding: var(--space-4) var(--space-6);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-2);
}

.test-results-score-value {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--fg-brand);
}

.test-results-score-total {
  font-size: var(--text-xl);
  color: var(--fg-tertiary);
  margin-left: var(--space-1);
}

.test-results-score-label {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

.test-results-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.test-results-stat {
  text-align: center;
}

.test-results-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  line-height: 1;
}

.test-results-stat-value.correct {
  color: var(--fg-success);
}

.test-results-stat-value.incorrect {
  color: var(--fg-error);
}

.test-results-stat-label {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: var(--space-1);
}

.test-results-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.test-results-actions .btn {
  justify-content: center;
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .test-results-actions {
    flex-direction: row;
    justify-content: center;
  }
}

/* Test Review */
.test-review {
  margin-top: var(--space-6);
}

.test-review-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-4);
}

.test-review-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.test-review-item {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}

.test-review-item.correct {
  border-left: 4px solid var(--color-success-500);
}

.test-review-item.incorrect {
  border-left: 4px solid var(--color-error-500);
}

.test-review-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.test-review-item-number {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--fg-tertiary);
}

.test-review-item-status {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.test-review-item-status svg {
  width: 16px;
  height: 16px;
}

.test-review-item.correct .test-review-item-status {
  color: var(--fg-success);
}

.test-review-item.incorrect .test-review-item-status {
  color: var(--fg-error);
}

.test-review-item-question {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

.test-review-item-answers {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.test-review-answer {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border-radius: var(--radius-md);
}

.test-review-answer.correct {
  background-color: var(--bg-success-subtle);
}

.test-review-answer.user-incorrect {
  background-color: var(--bg-error-subtle);
}

.test-review-answer-label {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.test-review-answer-text {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.test-review-item-explanation {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  line-height: 1.6;
  padding: var(--space-3);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin: 0;
}

@media (max-width: 639px) {
  /* Mode Selection - 2 column compact layout for mobile */
  .test-mode-header {
    margin-bottom: var(--space-4);
    gap: var(--space-3);
  }

  .test-mode-title {
    font-size: var(--text-lg);
  }

  .test-mode-content {
    margin-bottom: var(--space-4);
  }

  .test-mode-content h2 {
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
  }

  .test-mode-description {
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
  }

  .test-mode-options {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .test-mode-card {
    padding: var(--space-3);
  }

  .test-mode-card-icon {
    width: 40px;
    height: 40px;
    margin-bottom: var(--space-2);
  }

  .test-mode-card-icon svg {
    width: 20px;
    height: 20px;
  }

  .test-mode-card-title {
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
  }

  .test-mode-card-description {
    font-size: var(--text-xs);
    line-height: 1.4;
    margin-bottom: var(--space-2);
  }

  .test-mode-card-features {
    display: none;
  }

  .test-mode-card-banner {
    width: calc(100% + var(--space-3) * 2);
    margin: auto calc(-1 * var(--space-3)) calc(-1 * var(--space-3));
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    gap: var(--space-1);
  }

  .test-mode-card-banner svg {
    width: 12px;
    height: 12px;
  }

  /* Other test components */
  .test-question-card {
    padding: var(--space-4);
  }

  .test-results-card {
    padding: var(--space-5);
  }

  .test-results-title {
    font-size: var(--text-xl);
  }

  .test-results-stats {
    gap: var(--space-4);
  }

  .test-review-item {
    padding: var(--space-4);
  }

  .test-review-item-header {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .test-review-item-question {
    font-size: var(--text-sm);
  }

  /* Mobile test-taking: keep desktop font sizes, compact padding only */
  .test-options {
    gap: var(--space-2);
  }

  .test-option {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .test-option-letter {
    width: 28px;
    height: 28px;
  }
}

/* ========================================
   Text Input Questions (Short Answer & Essay)
   ======================================== */

.test-text-input-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.test-input-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
}

.test-input-label svg {
  color: var(--fg-tertiary);
}

.test-word-count {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  background-color: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.test-word-count.sufficient {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.test-text-input {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-base);
  font-family: inherit;
  line-height: 1.6;
  color: var(--fg-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  resize: vertical;
  transition: all var(--transition-fast);
}

.test-text-input:focus {
  outline: none;
  border-color: var(--fg-brand);
  box-shadow: 0 0 0 3px rgba(78, 71, 221, 0.1);
}

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

.test-text-input.short-answer {
  min-height: 100px;
}

.test-text-input.essay {
  min-height: 200px;
}

.test-text-input.disabled {
  background-color: var(--bg-secondary);
  cursor: not-allowed;
  opacity: 0.7;
}

.test-sample-answer {
  padding: var(--space-4);
  background-color: var(--bg-success-subtle);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--fg-success);
}

.test-sample-answer strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--fg-success);
  margin-bottom: var(--space-2);
}

.test-sample-answer p {
  font-size: var(--text-sm);
  color: var(--fg-primary);
  line-height: 1.6;
  margin: 0;
}

/* Review styles for text answers */
.test-review-answer.text-answer {
  background-color: var(--bg-secondary);
}

.test-review-answer.text-answer .test-review-answer-text {
  white-space: pre-wrap;
  font-weight: var(--font-regular);
}

.test-review-answer.sample-answer {
  background-color: var(--bg-brand-subtle);
  border-left: 3px solid var(--fg-brand);
}

/* Check Answer Button */
.test-check-answer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: white;
  background-color: var(--fg-brand);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: var(--space-2);
}

.test-check-answer-btn:hover:not(:disabled) {
  background-color: var(--fg-brand-emphasis);
}

.test-check-answer-btn:disabled {
  background-color: var(--bg-tertiary);
  color: var(--fg-muted);
  cursor: not-allowed;
}

.test-check-answer-btn svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   Focused Test Interface
   ======================================== */

/* Full-screen focused mode */
.app-page.test-focused-mode {
  padding-top: 0;
  min-height: 100vh;
}

.app-page.test-focused-mode .app-page-content {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

/* Focused Interface Container */
.test-focused-interface {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

/* Focused Header */
.test-focused-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: var(--space-4);
}

.test-focused-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.test-focused-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: transparent;
  border: none;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.test-focused-close:hover {
  background-color: var(--bg-secondary);
  color: var(--fg-primary);
}

.test-focused-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.test-focused-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.test-focused-mode-badge {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: var(--font-medium);
  width: fit-content;
}

.test-focused-mode-badge.practice {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.test-focused-mode-badge.test {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.test-focused-header-right {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  min-width: 60px;
  text-align: right;
  flex-shrink: 0;
}

/* Question Navigator in Header */
.test-focused-navigator {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex: 1;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding: var(--space-1) var(--space-2);
}

.test-focused-navigator::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.test-focused-navigator .test-navigator-dot {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

/* Focused Progress Bar */
.test-focused-progress {
  height: 3px;
  background-color: var(--bg-tertiary);
  width: 100%;
}

.test-focused-progress-bar {
  height: 100%;
  background-color: var(--fg-brand);
  transition: width 0.3s ease;
}

/* Focused Content Area */
.test-focused-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  overflow-y: auto;
  position: relative;
  background-color: var(--bg-secondary);
}

.test-focused-content .test-question-card {
  max-width: 720px;
  width: 100%;
  margin-bottom: var(--space-8);
}

/* Floating Navigation Buttons (center left/right) */
.test-floating-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background-color: var(--bg-primary);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  box-shadow: var(--shadow-lg);
}

.test-floating-nav-btn:hover:not(:disabled) {
  background-color: var(--bg-secondary);
  color: var(--fg-primary);
  border-color: var(--border-emphasis);
  box-shadow: var(--shadow-xl);
}

.test-floating-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

.test-floating-nav-btn.prev {
  left: var(--space-6);
}

.test-floating-nav-btn.next {
  right: var(--space-6);
}

.test-floating-nav-btn svg {
  width: 24px;
  height: 24px;
}

/* Focused Footer - Single CTA */
.test-focused-footer {
  padding: var(--space-4) var(--space-6);
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-primary, var(--border));
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.test-focused-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.test-footer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-right: var(--space-4);
}

/* Footer CTA Button - Consistent with .btn-primary */
.test-footer-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-12);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  border: none;
  background-color: var(--bg-brand);
  color: var(--fg-on-brand);
  cursor: pointer;
  min-width: 240px;
  min-height: 56px;
  box-shadow: var(--shadow-primary);
  transition: var(--transition-colors);
}

.test-footer-cta svg {
  width: 20px;
  height: 20px;
}

.test-footer-cta:hover:not(:disabled) {
  background-color: var(--color-primary-600);
  box-shadow: var(--btn-shadow-hover);
}

.test-footer-cta:active:not(:disabled) {
  background-color: var(--color-primary-700);
}

.test-footer-cta:disabled {
  background-color: var(--bg-tertiary);
  color: var(--fg-tertiary);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

.test-footer-cta.submit {
  background-color: var(--bg-success);
  box-shadow: var(--shadow-success);
}

.test-footer-cta.submit:hover:not(:disabled) {
  background-color: var(--color-success-600);
  box-shadow: var(--shadow-success-glow);
}

.test-footer-cta.submit:active:not(:disabled) {
  background-color: var(--color-success-700);
}

/* Keyboard Hint Badge on CTA */
.cta-keyboard-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  margin-left: 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: inherit;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.test-footer-cta:hover:not(:disabled) .cta-keyboard-hint {
  opacity: 1;
  background: rgba(255, 255, 255, 0.25);
}

.test-footer-cta:disabled .cta-keyboard-hint {
  display: none;
}

/* Hide floating prev/next buttons on tablet and below */
@media (max-width: 1024px) {
  .test-floating-nav-btn {
    display: none;
  }
}

/* Responsive Adjustments for Focused Interface */
@media (max-width: 639px) {
  .test-focused-header {
    padding: var(--space-2) var(--space-4);
    flex-wrap: wrap;
  }

  .test-focused-header-left {
    gap: var(--space-2);
  }

  .test-focused-header-info {
    display: none;
  }

  .test-focused-title {
    font-size: var(--text-sm);
  }

  .test-focused-navigator {
    order: 3;
    width: 100%;
    max-width: 100%;
    padding-top: var(--space-2);
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .test-focused-navigator .test-navigator-dot {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    font-size: var(--text-xs);
  }

  .test-focused-content {
    padding: var(--space-4);
  }

  /* Hide floating prev/next buttons on mobile - they take up too much space */
  .test-floating-nav-btn {
    display: none;
  }

  .test-focused-footer {
    padding: var(--space-3) var(--space-4);
  }

  .test-focused-footer-inner {
    max-width: 100%;
  }

  .test-footer-cta {
    flex: 1;
    min-width: 0;
    padding: var(--space-3) var(--space-4);
  }

  /* Hide keyboard hint on mobile */
  .cta-keyboard-hint {
    display: none;
  }
}

/* ========================================
   AI CHATBOT - Test Results Page
   ======================================== */

/* Ask AI Button in Review Items */
.test-review-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ask-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition-colors);
  box-shadow: var(--shadow-xs);
}

.ask-ai-btn:hover {
  background: var(--interactive-hover);
  border-color: var(--border-secondary);
}

.ask-ai-btn svg {
  width: 16px;
  height: 16px;
}

.ask-ai-btn img {
  width: 16px;
  height: 16px;
}

/* Floating AI Chatbot Button (FAB) */
.ai-chatbot-fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-brand);
  color: var(--fg-on-brand);
  border: none;
  border-radius: 9999px;
  box-shadow: var(--shadow-lg), var(--shadow-primary);
  cursor: pointer;
  z-index: 100;
  transition: var(--transition-colors);
}

.ai-chatbot-fab:hover {
  background: var(--color-primary-600);
  box-shadow: var(--shadow-xl), var(--shadow-primary-glow);
}

.ai-chatbot-fab svg {
  width: 24px;
  height: 24px;
}

.ai-chatbot-fab-label {
  font-size: var(--text-base);
  font-weight: 600;
}

/* AI Chatbot Side Panel */
.ai-chatbot-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  box-shadow: var(--shadow-2xl);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.ai-chatbot-panel.active {
  right: 0;
}

.ai-chatbot-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ai-chatbot-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Chatbot Header */
.ai-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-secondary);
}

.ai-chatbot-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ai-chatbot-avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
  border-radius: var(--radius-lg);
}

.ai-chatbot-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0;
}

.ai-chatbot-subtitle {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
}

.ai-chatbot-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
}

.ai-chatbot-close:hover {
  background: var(--interactive-hover);
  color: var(--fg-primary);
}

/* Chatbot Context Banner */
.ai-chatbot-context {
  padding: var(--space-3) var(--space-5);
  background: var(--bg-brand-subtle);
  border-bottom: 1px solid var(--color-primary-100);
}

.ai-chatbot-context-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-brand);
  margin-bottom: 4px;
}

.ai-chatbot-context-text {
  font-size: var(--text-sm);
  color: var(--fg-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Chatbot Messages */
.ai-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ai-chatbot-welcome {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--fg-secondary);
}

.ai-chatbot-welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
  border-radius: var(--radius-2xl);
}

.ai-chatbot-welcome h4 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0 0 var(--space-2);
}

.ai-chatbot-welcome p {
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: 0;
}

/* Chat Message Bubbles */
.ai-chat-message {
  max-width: 85%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.ai-chat-message.user {
  align-self: flex-end;
  background: var(--bg-brand);
  color: var(--fg-on-brand);
  border-bottom-right-radius: var(--radius-sm);
}

.ai-chat-message.ai {
  align-self: flex-start;
  background: var(--bg-secondary);
  color: var(--fg-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.ai-chat-message.ai.typing {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-chat-message.ai.typing span {
  width: 8px;
  height: 8px;
  background: var(--fg-tertiary);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

/* Chatbot Input */
.ai-chatbot-input-container {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-primary);
  background: var(--bg-primary);
}

.ai-chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.ai-chatbot-suggestion {
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg-brand);
  background: var(--bg-brand-subtle);
  border: 1px solid var(--color-primary-200);
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition-colors);
}

.ai-chatbot-suggestion:hover {
  background: var(--color-primary-100);
  border-color: var(--color-primary-300);
}

.ai-chatbot-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-2);
}

.ai-chatbot-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: var(--space-2) var(--space-3);
  color: var(--fg-primary);
}

.ai-chatbot-input::placeholder {
  color: var(--fg-placeholder);
}

.ai-chatbot-input:focus {
  outline: none;
}

.ai-chatbot-send {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-brand);
  color: var(--fg-on-brand);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-colors);
  flex-shrink: 0;
}

.ai-chatbot-send:hover:not(:disabled) {
  background: var(--color-primary-600);
}

.ai-chatbot-send:disabled {
  background: var(--bg-tertiary);
  color: var(--fg-tertiary);
  cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 639px) {
  .ai-chatbot-fab {
    bottom: var(--space-4);
    right: var(--space-4);
    padding: var(--space-3) var(--space-4);
  }

  .ai-chatbot-fab-label {
    display: none;
  }

  .ai-chatbot-panel {
    width: 100vw;
    right: -100vw;
  }

  .ask-ai-btn span {
    display: none;
  }

  .ask-ai-btn {
    padding: 6px 8px;
  }
}

/* ========================================
   WIT TESTS PAGE
   ======================================== */

.wit-tests-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.wit-tests-header-info h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.wit-tests-header-info p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

/* Quick Actions */
.wit-tests-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

/* Liquid Glass Lite: Quick action cards */
.wit-tests-quick-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  transition: var(--transition-colors);
  box-shadow: var(--card-shadow);
}

/* Liquid Glass Lite: No transform on hover */
.wit-tests-quick-card:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-primary);
}

.wit-tests-quick-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  flex-shrink: 0;
}

.wit-tests-quick-icon svg {
  width: 24px;
  height: 24px;
}

.wit-tests-quick-card.practice .wit-tests-quick-icon {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.wit-tests-quick-card.test .wit-tests-quick-icon {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.wit-tests-quick-content {
  flex: 1;
}

.wit-tests-quick-content h3 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.wit-tests-quick-content p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.wit-tests-quick-arrow {
  width: 20px;
  height: 20px;
  color: var(--fg-tertiary);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

/* Liquid Glass Lite: No transform animation */
.wit-tests-quick-card:hover .wit-tests-quick-arrow {
  color: var(--fg-brand);
}

/* Tests Section */
.wit-tests-section {
  margin-bottom: var(--space-8);
}

.wit-tests-section-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: var(--space-4);
}

/* Wit Tests Toolbar */
.wit-tests-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .wit-tests-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Wit Tests Search */
.wit-tests-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.wit-tests-search svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--fg-tertiary);
}

.wit-tests-search-input {
  width: 100%;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-10);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--fg-primary);
  transition: var(--transition-fast);
}

.wit-tests-search-input:focus {
  outline: none;
  border-color: var(--border-brand);
  background-color: var(--bg-primary);
}

.wit-tests-search-input::placeholder {
  color: var(--fg-tertiary);
}

/* Wit Tests Filter Dropdown */
.wit-tests-filter-wrapper {
  position: relative;
}

.wit-tests-filter-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.wit-tests-filter-toggle:hover {
  background-color: var(--interactive-hover);
  border-color: var(--border-secondary);
}

.wit-tests-filter-toggle.active {
  border-color: var(--border-secondary);
}

.wit-tests-filter-icon {
  opacity: 0.7;
}

.wit-tests-filter-label {
  white-space: nowrap;
}

.wit-tests-filter-arrow {
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.wit-tests-filter-toggle.active .wit-tests-filter-arrow {
  transform: rotate(180deg);
}

.wit-tests-filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
  padding: var(--space-2);
}

.wit-tests-filter-dropdown.active {
  display: block;
}

.wit-tests-filter-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.wit-tests-filter-item:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.wit-tests-filter-item.active {
  color: var(--fg-primary);
  font-weight: var(--font-medium);
}

.wit-tests-filter-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.wit-tests-filter-item-icon.not-started { color: var(--fg-tertiary); }
.wit-tests-filter-item-icon.in-progress { color: #f59e0b; }
.wit-tests-filter-item-icon.completed { color: #10b981; }

.wit-tests-filter-item-label {
  flex: 1;
}

.wit-tests-filter-item-check {
  color: var(--brand);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.wit-tests-filter-item.active .wit-tests-filter-item-check {
  opacity: 1;
}

.wit-tests-filter-divider {
  height: 1px;
  background-color: var(--border-primary);
  margin: var(--space-2) 0;
}

/* Legacy filter styles */
.wit-tests-filters {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.wit-tests-filters::-webkit-scrollbar {
  display: none;
}

.wit-tests-filter-btn {
  padding: var(--space-2) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition-fast);
}

.wit-tests-filter-btn:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.wit-tests-filter-btn.active {
  background-color: var(--fg-primary);
  border-color: var(--fg-primary);
  color: var(--bg-primary);
}

/* Tests List */
.wit-tests-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Test Card */
.wit-test-card {
  position: relative;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}

.wit-test-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.wit-test-card.highlight {
  animation: highlight-pulse 2s ease-out;
}

@keyframes highlight-pulse {
  0%, 100% {
    box-shadow: var(--shadow-sm);
  }
  25%, 75% {
    box-shadow: 0 0 0 3px var(--fg-brand), var(--shadow-md);
    border-color: var(--fg-brand);
  }
}

.wit-test-card.new {
  border-color: var(--border-brand);
  background: linear-gradient(135deg, var(--bg-brand-subtle) 0%, var(--bg-primary) 100%);
}

.wit-test-card.in-progress {
  border-color: var(--color-warning-300);
}

.wit-test-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.wit-test-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.wit-test-card-icon svg {
  width: 22px;
  height: 22px;
}

.wit-test-card-icon.sample {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.wit-test-card-icon.practice {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.wit-test-card-icon.test {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.wit-test-card-info {
  flex: 1;
}

.wit-test-card-info h3 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.wit-test-card-info p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.wit-test-card-desc {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* More actions dropdown */
.wit-test-card-more {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

.wit-test-card-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-tertiary);
  cursor: pointer;
  transition: all 0.2s;
}

.wit-test-card-more-btn:hover {
  background: var(--bg-secondary);
  color: var(--fg-primary);
}

.wit-test-card-more-btn svg {
  width: 18px;
  height: 18px;
}

.wit-test-card-more-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  padding: var(--space-1);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 100;
}

.wit-test-card-more-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.wit-test-card-more-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-primary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.wit-test-card-more-item:hover {
  background: var(--bg-tertiary);
}

.wit-test-card-more-item.danger {
  color: var(--fg-error);
}

.wit-test-card-more-item.danger:hover {
  background: var(--bg-error-subtle);
}

.wit-test-card-more-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.wit-test-card-more-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wit-test-card-more-item-desc {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  font-weight: var(--font-normal);
}

.wit-test-card-more-divider {
  height: 1px;
  background: var(--border-secondary);
  margin: var(--space-2) var(--space-1);
}

/* Link-style menu items (for Take as Exam) */
a.wit-test-card-more-item {
  text-decoration: none;
}

.wit-test-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.wit-test-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.wit-test-card-meta svg {
  width: 16px;
  height: 16px;
}

.wit-test-card-progress {
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-4);
  display: flex;
}

.wit-test-card-progress-bar {
  height: 100%;
  background-color: var(--bg-success);
  transition: width 0.3s ease;
}

.wit-test-card-progress-bar:first-child {
  border-radius: var(--radius-full) 0 0 var(--radius-full);
}

.wit-test-card-progress-bar:last-child {
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.wit-test-card-progress-bar:only-child {
  border-radius: var(--radius-full);
}

.wit-test-card-progress-bar.in-progress {
  background-color: var(--bg-warning);
}

.wit-test-card-progress-bar.correct {
  background-color: var(--bg-success);
}

.wit-test-card-progress-bar.wrong {
  background-color: var(--bg-error);
}

/* 4-tier score-based colors */
.wit-test-card-progress-bar.score-success {
  background-color: var(--bg-success);
}

.wit-test-card-progress-bar.score-brand {
  background-color: var(--fg-brand);
}

.wit-test-card-progress-bar.score-warning {
  background-color: var(--bg-warning);
}

.wit-test-card-progress-bar.score-danger {
  background-color: var(--bg-error);
}

.wit-test-card-progress-bar.not-started {
  background-color: var(--bg-tertiary);
}

.wit-test-card-actions {
  display: flex;
  gap: var(--space-2);
}

/* Responsive */
@media (max-width: 639px) {
  .wit-tests-header {
    flex-direction: column;
    gap: var(--space-4);
  }

  .wit-tests-header-actions {
    width: 100%;
  }

  .wit-tests-header .btn {
    width: 100%;
    justify-content: center;
  }

  .wit-tests-quick-actions {
    grid-template-columns: 1fr;
  }

  .wit-tests-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .wit-tests-filters {
    width: 100%;
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }

  /* Wit Tests Toolbar Mobile */
  .wit-tests-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
  }

  .wit-tests-search {
    flex: 1;
    min-width: 0;
    max-width: none;
  }

  .wit-tests-filter-wrapper {
    flex-shrink: 0;
  }

  .wit-tests-filter-toggle {
    padding: var(--space-3);
    height: 42px;
    width: 42px;
    justify-content: center;
  }

  .wit-tests-filter-label,
  .wit-tests-filter-arrow {
    display: none;
  }

  .wit-tests-filter-dropdown {
    left: auto;
    right: 0;
    min-width: 180px;
  }

  .wit-test-card-header {
    flex-wrap: wrap;
  }

  .wit-test-card-meta {
    gap: var(--space-3);
  }
}

/* ----- CREATE TEST MODAL ----- */
.create-test-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.create-test-form .form-group {
  margin-bottom: 0;
}

.create-test-form .form-hint {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-top: var(--space-1);
  margin-bottom: var(--space-3);
}

/* Test Type Options */
.create-test-type-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.create-test-type-option {
  cursor: pointer;
}

.create-test-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.create-test-type-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: var(--transition-colors);
}

.create-test-type-option input:checked + .create-test-type-card {
  border-color: var(--fg-brand);
  background-color: var(--bg-brand-subtle);
}

.create-test-type-card:hover {
  border-color: var(--border-hover);
}

.create-test-type-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  flex-shrink: 0;
}

.create-test-type-icon svg {
  width: 20px;
  height: 20px;
}

.create-test-type-icon.practice {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.create-test-type-icon.test {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.create-test-type-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.create-test-type-name {
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.create-test-type-desc {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

/* Question Count Buttons - Liquid Glass Lite */
.create-test-question-count {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.create-test-count-btn {
  padding: var(--space-2-5) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
}

.create-test-count-btn:hover {
  border-color: var(--border-brand);
  color: var(--fg-primary);
}

.create-test-count-btn.active {
  background-color: var(--fg-brand);
  border-color: var(--fg-brand);
  color: white;
  box-shadow: var(--shadow-primary);
}

/* Source Selection */
.create-test-sources {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 200px;
  overflow-y: auto;
}

.create-test-source-item {
  cursor: pointer;
}

.create-test-source-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Liquid Glass Lite: Source selection cards */
.create-test-source-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: var(--transition-colors);
}

.create-test-source-item input:checked + .create-test-source-card {
  border-color: var(--fg-brand);
  background-color: var(--bg-brand-subtle);
}

.create-test-source-card:hover {
  border-color: var(--border-brand);
}

.create-test-source-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  flex-shrink: 0;
}

.create-test-source-icon svg {
  width: 18px;
  height: 18px;
}

.create-test-source-icon.pdf {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

.create-test-source-icon.image {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.create-test-source-icon.doc {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.create-test-source-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.create-test-source-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-test-source-meta {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

/* Source Toggle - Exam Bank */
.create-test-source-section {
  margin-bottom: var(--space-3);
}

.create-test-source-section:last-child {
  margin-bottom: 0;
}

.create-test-source-toggle {
  cursor: pointer;
  display: block;
}

.create-test-source-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.create-test-source-toggle-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: var(--transition-colors);
}

.create-test-source-toggle-card:hover {
  border-color: var(--border-brand);
}

.create-test-source-toggle input:checked + .create-test-source-toggle-card {
  border-color: var(--fg-brand);
  background-color: var(--bg-brand-subtle);
}

.create-test-source-toggle-card.exam-bank {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(78, 71, 221, 0.05) 100%);
}

.create-test-source-toggle input:checked + .create-test-source-toggle-card.exam-bank {
  background: linear-gradient(135deg, var(--bg-brand-subtle) 0%, rgba(78, 71, 221, 0.15) 100%);
}

.create-test-source-toggle-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  background-color: var(--bg-tertiary);
  flex-shrink: 0;
}

.create-test-source-toggle-icon svg {
  width: 20px;
  height: 20px;
  color: var(--fg-secondary);
}

.create-test-source-toggle-icon.exam-bank {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.create-test-source-toggle-icon.exam-bank svg {
  color: white;
}

.create-test-source-toggle-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.create-test-source-toggle-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  display: flex;
  align-items: center;
}

.create-test-source-toggle-meta {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.create-test-source-toggle-check {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  opacity: 0;
  transition: var(--transition-colors);
}

.create-test-source-toggle-check svg {
  width: 14px;
  height: 14px;
  color: white;
}

.create-test-source-toggle input:checked ~ .create-test-source-toggle-card .create-test-source-toggle-check,
.create-test-source-toggle input:checked + .create-test-source-toggle-card .create-test-source-toggle-check {
  opacity: 1;
  background-color: var(--fg-brand);
}

/* Exam Bank Details */
.exam-bank-details {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  animation: slideDown 0.2s ease;
}

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

.exam-bank-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.exam-bank-stat {
  text-align: center;
  padding: var(--space-3);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.exam-bank-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--fg-brand);
}

.exam-bank-stat-label {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
  margin-top: 2px;
}

.exam-bank-stat.highlight .exam-bank-stat-value {
  color: var(--fg-success);
}

/* My Sources List (collapsible) */
#mySourcesList {
  margin-top: var(--space-3);
  padding-left: var(--space-2);
}

.create-test-source-section .create-test-sources {
  max-height: 180px;
}

/* Exam Bank Unlock Modal */
.exam-bank-unlock-modal {
  text-align: center;
  padding: var(--space-4);
}

.exam-bank-unlock-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.exam-bank-unlock-icon svg {
  width: 40px;
  height: 40px;
  color: white;
}

.exam-bank-unlock-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

.exam-bank-unlock-desc {
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
  line-height: 1.6;
}

.exam-bank-unlock-benefits {
  text-align: left;
  background-color: var(--bg-tertiary);
  padding: var(--space-4);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-4);
}

.exam-bank-unlock-benefit {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.exam-bank-unlock-benefit:last-child {
  margin-bottom: 0;
}

.exam-bank-unlock-benefit-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.exam-bank-unlock-benefit-icon svg {
  width: 14px;
  height: 14px;
}

.exam-bank-unlock-benefit-text {
  font-size: var(--text-sm);
  color: var(--fg-primary);
}

/* Difficulty Level - Liquid Glass Lite */
.create-test-difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.create-test-difficulty-option {
  cursor: pointer;
}

.create-test-difficulty-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.create-test-difficulty-btn {
  display: inline-block;
  padding: var(--space-2-5) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  transition: var(--transition-colors);
}

.create-test-difficulty-btn:hover {
  border-color: var(--border-brand);
  color: var(--fg-primary);
}

.create-test-difficulty-option input:checked + .create-test-difficulty-btn.easy {
  background-color: var(--bg-success-subtle);
  border-color: var(--fg-success);
  color: var(--fg-success);
}

.create-test-difficulty-option input:checked + .create-test-difficulty-btn.medium {
  background-color: var(--bg-warning-subtle);
  border-color: var(--fg-warning);
  color: var(--fg-warning);
}

.create-test-difficulty-option input:checked + .create-test-difficulty-btn.hard {
  background-color: var(--bg-error-subtle);
  border-color: var(--fg-error);
  color: var(--fg-error);
}

.create-test-difficulty-option input:checked + .create-test-difficulty-btn.mixed {
  background-color: var(--bg-brand-subtle);
  border-color: var(--fg-brand);
  color: var(--fg-brand);
}

/* Custom Input Wrapper */
.create-test-custom-input {
  margin-top: var(--space-3);
}

.create-test-custom-input .form-input {
  max-width: 200px;
}

/* Question Types */
.create-test-question-types {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.create-test-qtype-item {
  cursor: pointer;
}

.create-test-qtype-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Liquid Glass Lite: Question type cards */
.create-test-qtype-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: var(--transition-colors);
}

.create-test-qtype-item input:checked + .create-test-qtype-card {
  border-color: var(--fg-brand);
  background-color: var(--bg-brand-subtle);
}

.create-test-qtype-card:hover {
  border-color: var(--border-brand);
}

.create-test-qtype-check {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  transition: var(--transition-colors);
}

.create-test-qtype-check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: var(--transition-opacity);
}

.create-test-qtype-item input:checked + .create-test-qtype-card .create-test-qtype-check {
  background-color: var(--fg-brand);
  border-color: var(--fg-brand);
}

.create-test-qtype-item input:checked + .create-test-qtype-card .create-test-qtype-check svg {
  opacity: 1;
  color: white;
}

.create-test-qtype-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.create-test-qtype-icon svg {
  width: 16px;
  height: 16px;
}

.create-test-qtype-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

/* Source Check Icon */
.create-test-source-check {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.create-test-source-check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: var(--transition-fast);
}

.create-test-source-item input:checked + .create-test-source-card .create-test-source-check {
  background-color: var(--fg-brand);
  border-color: var(--fg-brand);
}

.create-test-source-item input:checked + .create-test-source-card .create-test-source-check svg {
  opacity: 1;
  color: white;
}

/* Form Textarea */
.form-textarea {
  width: 100%;
  padding: var(--space-3);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--fg-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  resize: vertical;
  transition: var(--transition-fast);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--fg-brand);
  box-shadow: 0 0 0 3px var(--ring-brand);
}

.form-textarea::placeholder {
  color: var(--fg-tertiary);
}

/* Responsive */
@media (max-width: 639px) {
  .create-test-question-types {
    grid-template-columns: 1fr;
  }

  .create-test-qtype-card {
    padding: var(--space-2);
  }
}

/* ========================================
   80/20 PREP PLAN PAGE STYLES
   ======================================== */

/* Header */
.prep-plan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.prep-plan-header-content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.prep-plan-header-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--fg-brand), var(--fg-success));
  border-radius: var(--radius-xl);
  color: white;
  flex-shrink: 0;
}

.prep-plan-header-icon svg {
  width: 28px;
  height: 28px;
}

.prep-plan-header-info h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin: 0 0 var(--space-1) 0;
}

.prep-plan-header-info p {
  font-size: var(--text-base);
  color: var(--fg-secondary);
  margin: 0;
}

/* Stats Cards */
.prep-plan-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.prep-plan-stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-xs);
}

.prep-plan-stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.prep-plan-stat-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.prep-plan-stat-icon svg {
  width: 18px;
  height: 18px;
}

.prep-plan-stat-icon.high {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--fg-error);
}

.prep-plan-stat-icon.medium {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--fg-warning);
}

.prep-plan-stat-icon.progress {
  background-color: rgba(34, 197, 94, 0.15);
  color: var(--fg-success);
}

.prep-plan-stat-icon.time {
  background-color: rgba(78, 71, 221, 0.15);
  color: var(--fg-brand);
}

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

.prep-plan-stat-label {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-top: auto;
}

/* Intro Banner */
.prep-plan-intro-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-8);
  background: url('../bg/bgmesh-prep Large.jpeg') center/cover no-repeat;
  border-radius: var(--card-radius);
  margin-bottom: var(--space-8);
  min-height: 140px;
  position: relative;
  overflow: hidden;
}

.prep-plan-intro-banner .prep-plan-intro-content {
  flex: 1;
  min-width: 0;
}

.prep-plan-intro-banner .prep-plan-intro-content h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: white;
  margin: 0 0 var(--space-2) 0;
}

.prep-plan-intro-banner .prep-plan-intro-content p {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  line-height: 1.6;
  max-width: 500px;
}

.prep-plan-intro-banner .prep-plan-target-date {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.8);
}

.prep-plan-intro-illustration {
  flex-shrink: 0;
  width: 180px;
  height: auto;
}

.prep-plan-intro-illustration img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Sections */
.prep-plan-section {
  margin-bottom: var(--space-8);
}

.prep-plan-section-header {
  margin-bottom: var(--space-4);
}

.prep-plan-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.prep-plan-section-title h2 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0;
}

.prep-plan-section-desc {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
}

.prep-plan-priority-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prep-plan-priority-badge.high {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--fg-error);
}

.prep-plan-priority-badge.medium {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--fg-warning);
}

.prep-plan-priority-badge.low {
  background-color: rgba(34, 197, 94, 0.15);
  color: var(--fg-success);
}

.prep-plan-priority-badge.skip {
  background-color: rgba(148, 163, 184, 0.15);
  color: var(--fg-tertiary);
}

/* Priority Summary Cards */
.prep-plan-priority-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 1023px) {
  .prep-plan-priority-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 374px) {
  .prep-plan-priority-summary {
    grid-template-columns: 1fr;
  }
}

/* Priority Card - matches analytics-stat-card style */
.prep-plan-priority-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-5);
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-xs);
}

.prep-plan-priority-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.prep-plan-priority-card-icon {
  font-size: var(--text-lg);
}

.prep-plan-priority-card-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.prep-plan-priority-card-stats {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.prep-plan-priority-card-value {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
}

.prep-plan-priority-card-desc {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Mobile: Compact priority cards for 2x2 grid */
@media (max-width: 639px) {
  .prep-plan-priority-card,
  .prep-plan-stat-card {
    padding: var(--space-3);
    gap: var(--space-1);
  }

  .prep-plan-priority-card-header,
  .prep-plan-stat-header {
    margin-bottom: var(--space-1);
  }

  .prep-plan-priority-card-value {
    font-size: var(--text-lg);
  }

  .prep-plan-stat-value {
    font-size: var(--text-lg);
  }

  .prep-plan-stat-icon {
    width: 28px;
    height: 28px;
  }

  .prep-plan-stat-icon svg {
    width: 14px;
    height: 14px;
  }
}

/* Topic Cards */
.prep-plan-topics {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Topic Card - matches wit-test-card style */
.prep-plan-topic-card {
  position: relative;
  padding: var(--space-5);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.prep-plan-topic-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.prep-plan-topic-card.high::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--fg-error);
}

.prep-plan-topic-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.prep-plan-topic-info {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.prep-plan-topic-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  flex-shrink: 0;
}

.prep-plan-topic-details h3 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0 0 var(--space-1) 0;
}

.prep-plan-topic-details p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
}

.prep-plan-topic-impact {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-warning);
  white-space: nowrap;
}

.prep-plan-topic-impact svg {
  width: 14px;
  height: 14px;
}

/* Topic Progress */
.prep-plan-topic-progress {
  margin-bottom: var(--space-4);
}

.prep-plan-topic-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-2);
}

.prep-plan-topic-progress-bar {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.prep-plan-topic-progress-fill {
  height: 100%;
  background-color: var(--fg-brand);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.prep-plan-topic-progress-fill.success {
  background-color: var(--fg-success);
}

.prep-plan-topic-progress-fill.warning {
  background-color: var(--fg-warning);
}

/* Topic Actions */
.prep-plan-topic-actions {
  display: flex;
  gap: var(--space-2);
}

/* Compact Topic Cards */
.prep-plan-topics.compact {
  gap: var(--space-2);
}

.prep-plan-topic-compact {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
}

.prep-plan-topic-compact:hover {
  border-color: var(--border-secondary);
}

.prep-plan-topic-compact-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.prep-plan-topic-compact-num {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.prep-plan-topic-compact-info h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin: 0;
}

.prep-plan-topic-compact-meta {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.prep-plan-topic-compact-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 120px;
  flex-shrink: 0;
}

.prep-plan-topic-compact-progress span {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  width: 32px;
  text-align: right;
}

.prep-plan-topic-mini-bar {
  flex: 1;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.prep-plan-topic-mini-fill {
  height: 100%;
  background-color: var(--fg-brand);
  border-radius: var(--radius-full);
}

.prep-plan-topic-mini-fill.success {
  background-color: var(--fg-success);
}

.prep-plan-topic-mini-fill.warning {
  background-color: var(--fg-warning);
}

/* Study Schedule */
.prep-plan-schedule {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.prep-plan-schedule-day {
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
}

.prep-plan-schedule-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-primary);
}

.prep-plan-schedule-day-label {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.prep-plan-schedule-day-date {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

.prep-plan-schedule-tasks {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.prep-plan-schedule-task {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.prep-plan-schedule-task:hover {
  background-color: var(--bg-tertiary);
}

.prep-plan-schedule-task-check {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.prep-plan-schedule-task-check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
}

.prep-plan-schedule-task.completed .prep-plan-schedule-task-check {
  background-color: var(--fg-success);
  border-color: var(--fg-success);
}

.prep-plan-schedule-task.completed .prep-plan-schedule-task-check svg {
  opacity: 1;
  color: white;
}

.prep-plan-schedule-task.completed .prep-plan-schedule-task-info span:first-child {
  text-decoration: line-through;
  color: var(--fg-tertiary);
}

.prep-plan-schedule-task-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

.prep-plan-schedule-task-info span:first-child {
  font-size: var(--text-sm);
  color: var(--fg-primary);
}

.prep-plan-schedule-task-time {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1023px) {
  .prep-plan-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .prep-plan-header {
    flex-direction: column;
  }

  .prep-plan-header-content {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

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

  .prep-plan-intro-banner {
    flex-direction: column;
    padding: var(--space-5);
    text-align: center;
    min-height: auto;
  }

  .prep-plan-intro-banner .prep-plan-intro-content {
    order: 2;
  }

  .prep-plan-intro-banner .prep-plan-intro-content p {
    max-width: none;
  }

  .prep-plan-intro-illustration {
    order: 1;
    width: 140px;
    margin-bottom: var(--space-3);
  }

  .prep-plan-topic-header {
    flex-direction: column;
  }

  .prep-plan-topic-compact {
    flex-direction: column;
    align-items: flex-start;
  }

  .prep-plan-topic-compact-progress {
    width: 100%;
  }

  .prep-plan-schedule-task-info {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

}

/* Source-based Sections (grouped by document) */
.prep-plan-source-section {
  margin-bottom: var(--space-5);
  background-color: var(--bg-primary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  overflow: hidden;
}

.prep-plan-source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.prep-plan-source-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.prep-plan-source-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.prep-plan-source-icon svg {
  width: 24px;
  height: 24px;
}

/* File type specific icon backgrounds - matching Sources page */
.prep-plan-source-icon.icon-pdf {
  background-color: #fef2f2;
}
.prep-plan-source-icon.icon-word {
  background-color: #eff6ff;
}
.prep-plan-source-icon.icon-excel {
  background-color: #ecfdf5;
}
.prep-plan-source-icon.icon-powerpoint {
  background-color: #fff7ed;
}
.prep-plan-source-icon.icon-audio {
  background-color: #fdf2f8;
}
.prep-plan-source-icon.icon-video {
  background-color: #f5f3ff;
}
.prep-plan-source-icon.icon-youtube {
  background-color: #fef2f2;
}
.prep-plan-source-icon.icon-website {
  background-color: #eff6ff;
}
.prep-plan-source-icon.icon-image {
  background-color: #ecfdf5;
}
.prep-plan-source-icon.icon-document {
  background-color: var(--bg-brand-subtle, #EDEDFC);
}

.prep-plan-source-info {
  flex: 1;
  min-width: 0;
}

.prep-plan-source-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0 0 var(--space-1) 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prep-plan-source-name-clickable {
  cursor: pointer;
  transition: color 0.15s ease;
}

.prep-plan-source-name-clickable:hover {
  color: var(--fg-brand);
  text-decoration: underline;
}

.prep-plan-source-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.prep-plan-source-priority-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.prep-plan-source-priority-dot .priority-dot {
  width: 6px;
  height: 6px;
  margin-right: 0;
}

.prep-plan-source-priority-dot.must-master {
  color: var(--fg-error);
}

.prep-plan-source-priority-dot.must-master .priority-dot {
  background-color: var(--fg-error);
}

.prep-plan-source-priority-dot.should-know {
  color: var(--fg-warning);
}

.prep-plan-source-priority-dot.should-know .priority-dot {
  background-color: var(--fg-warning);
}

.prep-plan-source-priority-dot.quick-review {
  color: var(--fg-success);
}

.prep-plan-source-priority-dot.quick-review .priority-dot {
  background-color: var(--fg-success);
}

/* Hide priority label text on mobile, show only number */
@media (max-width: 639px) {
  .prep-plan-source-priority-dot .priority-label {
    display: none;
  }
}

.prep-plan-source-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.prep-plan-source-progress-bar {
  width: 80px;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.prep-plan-source-progress-fill {
  height: 100%;
  background-color: var(--fg-success);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.prep-plan-source-progress-text {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--fg-secondary);
  min-width: 32px;
  text-align: right;
}

/* Collapsible source sections */
.prep-plan-source-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.prep-plan-source-section.collapsible .prep-plan-source-header {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.prep-plan-source-section.collapsible .prep-plan-source-header:hover {
  background-color: var(--bg-secondary);
}

.prep-plan-source-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--fg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.prep-plan-source-toggle:hover {
  background-color: var(--bg-primary);
  color: var(--fg-primary);
}

.prep-plan-source-toggle .toggle-icon {
  transition: transform 0.2s ease;
}

.prep-plan-source-section.collapsed .prep-plan-source-toggle .toggle-icon {
  transform: rotate(-90deg);
}

/* Preview items always visible */
.prep-plan-source-preview {
  display: flex;
  flex-direction: column;
}

/* Remaining items hidden when collapsed */
.prep-plan-source-remaining {
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.prep-plan-source-section.collapsed .prep-plan-source-remaining {
  display: none;
}

/* Show more/less button */
.prep-plan-source-show-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  background: var(--bg-primary);
  color: var(--fg-brand);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all 0.15s ease;
}

.prep-plan-source-show-more:hover {
  background: var(--bg-brand-subtle);
}

.prep-plan-source-show-more .show-more-text {
  display: inline;
}

.prep-plan-source-show-more .show-less-text {
  display: none;
}

.prep-plan-source-section:not(.collapsed) .prep-plan-source-show-more .show-more-text {
  display: none;
}

.prep-plan-source-section:not(.collapsed) .prep-plan-source-show-more .show-less-text {
  display: inline;
}

/* Remove bottom border from last preview item when collapsed */
.prep-plan-source-section.collapsed .prep-plan-source-preview .prep-plan-source-item:last-child {
  border-bottom: none;
}

.prep-plan-source-items {
  display: flex;
  flex-direction: column;
}

.prep-plan-source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-primary);
  transition: var(--transition-fast);
}

.prep-plan-source-item:last-child {
  border-bottom: none;
}

.prep-plan-source-item:hover {
  background-color: var(--bg-tertiary);
}

.prep-plan-source-item.completed {
  background-color: rgba(34, 197, 94, 0.05);
}

.prep-plan-source-item-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.prep-plan-source-item-num {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

.prep-plan-source-item-num .priority-dot {
  display: none;
}

.prep-plan-source-item-num.must-master {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

.prep-plan-source-item-num.must-master .priority-dot {
  background-color: var(--fg-error);
}

.prep-plan-source-item-num.should-know {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.prep-plan-source-item-num.should-know .priority-dot {
  background-color: var(--fg-warning);
}

.prep-plan-source-item-num.quick-review {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.prep-plan-source-item-num.quick-review .priority-dot {
  background-color: var(--fg-success);
}

.prep-plan-source-item-num.skip {
  background-color: rgba(148, 163, 184, 0.15);
  color: var(--fg-tertiary);
}

.prep-plan-source-item-num.skip .priority-dot {
  background-color: var(--fg-tertiary);
}

.prep-plan-source-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.prep-plan-source-item-title {
  font-size: var(--text-sm);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Insight chips — "why this matters" text under each item */
.prep-plan-item-insight {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.insight-chip {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  display: inline-flex;
  align-items: center;
  line-height: 1.3;
}

.insight-chip-sep {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  opacity: 0.5;
}

.insight-chip-exam {
  color: var(--fg-secondary);
}

.insight-chip-weak {
  color: var(--fg-error);
}

.insight-chip-medium {
  color: var(--fg-warning);
}

.insight-chip-strong {
  color: var(--fg-success);
}

.prep-plan-source-item.completed .prep-plan-item-insight {
  display: none;
}

.prep-plan-source-item-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.prep-plan-source-item-time {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  padding: var(--space-1) var(--space-2);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

/* Ask AI button styling */
.btn-ask-ai {
  color: var(--brand, #6366f1);
  transition: all 0.2s ease;
}

.btn-ask-ai:hover {
  color: var(--color-primary-700, #4338ca);
  background-color: var(--bg-brand-subtle, #eef2ff);
}

.btn-ask-ai svg {
  transition: transform 0.2s ease;
}

.btn-ask-ai:hover svg {
  transform: scale(1.1);
}

/* Custom checkbox for prep plan items */
.prep-plan-item-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.prep-plan-item-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.prep-plan-item-checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  background-color: var(--bg-secondary);
}

.prep-plan-item-checkbox-custom svg {
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s ease;
  color: white;
}

.prep-plan-item-checkbox:hover .prep-plan-item-checkbox-custom {
  border-color: var(--color-success-500, #10b981);
}

.prep-plan-item-checkbox input[type="checkbox"]:checked + .prep-plan-item-checkbox-custom {
  background-color: var(--color-success-500, #10b981);
  border-color: var(--color-success-500, #10b981);
}

.prep-plan-item-checkbox input[type="checkbox"]:checked + .prep-plan-item-checkbox-custom svg {
  opacity: 1;
  transform: scale(1);
}

/* Quick Quiz button styling - btn-icon-ghost with label */
.btn-quick-quiz {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-primary);
  background-color: var(--bg-secondary);
  color: var(--fg-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-quick-quiz:hover {
  color: var(--fg-primary);
  background-color: var(--interactive-hover);
  border-color: var(--border-secondary);
}

.btn-quick-quiz svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-quick-quiz:hover svg {
  transform: scale(1.1);
}

.btn-quick-quiz .spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-primary);
  border-top-color: var(--fg-secondary);
  border-radius: 50%;
  animation: spinnerSm 0.6s linear infinite;
}

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

/* Item overflow menu */
.prep-plan-item-menu {
  position: relative;
}

.prep-plan-item-menu .btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prep-plan-item-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  padding: var(--space-1);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.prep-plan-item-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.prep-plan-item-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-align: left;
}

.prep-plan-item-dropdown-item:hover {
  background-color: var(--interactive-hover);
}

.prep-plan-item-dropdown-item svg {
  color: var(--fg-secondary);
  flex-shrink: 0;
}

/* Hide Quiz in dropdown on desktop (visible as button) */
.dropdown-quiz-item {
  display: none;
}

@media (max-width: 639px) {
  /* Show Quiz in dropdown on mobile (button is hidden) */
  .dropdown-quiz-item {
    display: flex;
  }
}

/* Responsive source sections */
@media (max-width: 639px) {
  .prep-plan-source-header {
    padding: var(--space-3) var(--space-4);
  }

  .prep-plan-source-icon {
    width: 32px;
    height: 32px;
  }

  .prep-plan-source-icon svg {
    width: 18px;
    height: 18px;
  }

  .prep-plan-source-header-left {
    gap: var(--space-2);
  }

  .prep-plan-source-header-right {
    gap: var(--space-2);
  }

  /* Hide progress bar, show only percentage on mobile */
  .prep-plan-source-progress-bar {
    display: none;
  }

  .prep-plan-source-progress-text {
    flex-shrink: 0;
    white-space: nowrap;
    font-weight: var(--font-bold);
  }

  .prep-plan-source-item {
    gap: var(--space-2);
  }

  .prep-plan-source-item-left {
    flex: 1;
    min-width: 0;
  }

  .prep-plan-source-item-title {
    white-space: normal;
    word-break: break-word;
  }

  .prep-plan-source-item-right {
    flex-shrink: 0;
  }

  /* Hide Quiz button on mobile - available in dropdown */
  .prep-plan-source-item-right .btn-quick-quiz {
    display: none;
  }
}

/* ========================================
   ANALYTICS PAGE STYLES
   ======================================== */

/* Header */
.analytics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.analytics-header-content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.analytics-header-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--fg-brand), #8b5cf6);
  border-radius: var(--radius-xl);
  color: white;
  flex-shrink: 0;
}

.analytics-header-icon svg {
  width: 28px;
  height: 28px;
}

.analytics-header-info h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin: 0 0 var(--space-1) 0;
}

.analytics-header-info p {
  font-size: var(--text-base);
  color: var(--fg-secondary);
  margin: 0;
}

.analytics-period-select {
  appearance: none;
  padding: var(--space-2) var(--space-10) var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-primary);
  background-color: var(--bg-secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
}

.analytics-period-select:focus {
  outline: none;
  border-color: var(--fg-brand);
}

/* Stats Cards */
.analytics-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.analytics-stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-5);
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-xs);
}

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

.analytics-stat-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.analytics-stat-icon svg {
  width: 18px;
  height: 18px;
}

.analytics-stat-icon.tests {
  background-color: rgba(78, 71, 221, 0.15);
  color: var(--fg-brand);
}

.analytics-stat-icon.questions {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--fg-warning);
}

.analytics-stat-icon.accuracy {
  background-color: rgba(34, 197, 94, 0.15);
  color: var(--fg-success);
}

.analytics-stat-icon.time {
  background-color: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.analytics-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  line-height: 1;
}

.analytics-stat-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.analytics-stat-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  margin-bottom: calc(-1 * var(--space-1));
}

.analytics-stat-change {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  text-transform: capitalize;
}

.analytics-stat-change svg {
  width: 12px;
  height: 12px;
}

.analytics-stat-change.positive {
  color: var(--fg-success);
}

.analytics-stat-change.negative {
  color: var(--fg-error);
}

/* Charts Section */
.analytics-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.analytics-chart-card {
  padding: var(--space-5);
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

.analytics-chart-card.wide {
  grid-column: span 2;
}

.analytics-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.analytics-chart-header h3 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Analytics Tooltip */
.analytics-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.analytics-tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--fg-tertiary);
  cursor: help;
  transition: color 0.15s ease;
}

.analytics-tooltip-trigger:hover {
  color: var(--fg-brand);
}

.analytics-tooltip-trigger svg {
  width: 16px;
  height: 16px;
}

.analytics-tooltip-content {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  background: #1e293b;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-regular);
  color: rgba(255, 255, 255, 0.95);
  white-space: normal;
  width: max-content;
  max-width: 280px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

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

.analytics-tooltip-wrapper:hover .analytics-tooltip-content,
.analytics-tooltip-trigger:focus + .analytics-tooltip-content {
  opacity: 1;
  visibility: visible;
}

/* Tooltip in section header */
.analytics-section-header h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Tooltip in progress card label */
.progress-card-label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.progress-card-label .analytics-tooltip-trigger {
  width: 14px;
  height: 14px;
}

.progress-card-label .analytics-tooltip-trigger svg {
  width: 12px;
  height: 12px;
}

/* Tooltip in comparison card header */
.progress-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.progress-card-header span {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.analytics-chart-legend {
  display: flex;
  gap: var(--space-4);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.legend-item.accuracy .legend-dot {
  background-color: var(--fg-brand);
}

.legend-item.tests .legend-dot {
  background-color: var(--fg-success);
}

/* Line Chart */
.analytics-line-chart {
  display: flex;
  flex-direction: column;
}

.chart-wrapper {
  display: flex;
  overflow: hidden;
}

.chart-y-axis {
  flex-shrink: 0;
  width: 40px;
  position: relative;
  height: 180px;
}

.chart-y-axis-inner {
  position: absolute;
  top: 20px;
  bottom: 0;
  left: 0;
  right: 0;
}

.chart-y-axis-inner span {
  position: absolute;
  right: 8px;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  transform: translateY(50%);
}

.chart-scrollable {
  flex: 1;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-top: 50px;
  margin-top: -50px;
}

.chart-inner {
  min-width: 100%;
  display: inline-flex;
  flex-direction: column;
}

.chart-area {
  display: grid;
  grid-template-rows: 20px 1fr;
  grid-template-columns: 1fr;
  height: 180px;
  min-width: 100%;
  width: max-content;
}

.chart-grid {
  grid-row: 2;
  grid-column: 1;
  position: relative;
  pointer-events: none;
}

.chart-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px dashed var(--border-primary);
}

.chart-bars {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  min-width: fit-content;
}

.chart-bar-group {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 50px;
  height: 100%;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chart-bar-group:hover {
  transform: translateY(-2px);
}

/* Chart tooltip (added via JS) */
.chart-tooltip {
  position: fixed;
  background: #1e293b;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: #f8fafc;
  text-align: center;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip-title {
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 2px;
}

.chart-tooltip-score {
  color: #a5b4fc;
  font-weight: 600;
}

.chart-tooltip-date {
  color: #cbd5e1;
  font-size: var(--text-xs);
}

.chart-tooltip-hint {
  color: #94a3b8;
  font-size: var(--text-xs);
  margin-top: 4px;
}

.chart-bar-group:hover .chart-bar {
  filter: brightness(1.1);
}

.chart-bar-score {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-brand);
  white-space: nowrap;
}

/* Stat Card Tooltips */
.stat-card-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-neutral-900);
  color: #f8fafc;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.stat-card-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-neutral-900);
}

/* Stat Card Info Icon Tooltip */
.discover-stat-label,
.progress-stat-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.stat-info-icon {
  width: 14px;
  height: 14px;
  color: var(--fg-quaternary);
  cursor: help;
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.stat-info-icon svg {
  width: 100%;
  height: 100%;
}

.stat-info-icon:hover {
  color: var(--fg-tertiary);
}

.stat-info-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-neutral-900);
  color: #f8fafc;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-regular);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.stat-info-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-neutral-900);
}

.stat-info-icon:hover .stat-info-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Chart Header Tooltip */
.chart-header-tooltip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-info-icon {
  width: 16px;
  height: 16px;
  color: var(--fg-tertiary);
  cursor: help;
  position: relative;
}

.chart-info-icon:hover {
  color: var(--fg-secondary);
}

.chart-info-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-neutral-900);
  color: #f8fafc;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.chart-info-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-neutral-900);
}

.chart-info-icon:hover .chart-info-tooltip {
  opacity: 1;
  visibility: visible;
}

.chart-bar {
  width: 100%;
  max-width: 24px;
  min-height: 4px;
  background-color: var(--fg-brand);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: height 0.5s ease;
}

.chart-bar.success {
  background-color: var(--bg-success);
}

.chart-bar.warning {
  background-color: var(--bg-warning);
}

.chart-bar.danger {
  background-color: var(--bg-error);
}

.chart-labels {
  display: flex;
  justify-content: flex-start;
  padding: var(--space-2) var(--space-4);
  gap: var(--space-3);
}

.chart-label {
  flex-shrink: 0;
  width: 50px;
  font-size: var(--text-xs);
  color: var(--fg-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.2s ease;
}

.chart-label:hover {
  color: var(--fg-brand);
}

/* Chart Score Legend */
.chart-score-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-2);
}

.chart-score-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.chart-score-legend-item .legend-color {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
}

.chart-score-legend-item .legend-color.success {
  background-color: var(--bg-success);
}

.chart-score-legend-item .legend-color.brand {
  background-color: var(--bg-brand);
}

.chart-score-legend-item .legend-color.warning {
  background-color: var(--bg-warning);
}

.chart-score-legend-item .legend-color.danger {
  background-color: var(--bg-error);
}

/* Topic Performance List */
.analytics-topic-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.analytics-topic-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.analytics-topic-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.analytics-topic-name {
  font-size: var(--text-sm);
  color: var(--fg-primary);
}

.analytics-topic-score {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.analytics-topic-bar {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.analytics-topic-fill {
  height: 100%;
  background-color: var(--fg-brand);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.analytics-topic-fill.success {
  background-color: var(--fg-success);
}

.analytics-topic-fill.warning {
  background-color: var(--fg-warning);
}

/* Donut Chart */
.analytics-donut-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.donut-ring {
  position: relative;
  width: 140px;
  height: 140px;
}

.donut-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-total {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
}

.donut-label {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.donut-legend-color {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.donut-legend-text {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

/* Insights Section */
.analytics-insights {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.analytics-insight-card {
  padding: var(--space-5);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
}

.analytics-insight-card.strengths {
  border-left: 4px solid var(--fg-success);
}

.analytics-insight-card.weaknesses {
  border-left: 4px solid var(--fg-warning);
}

.analytics-insight-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.analytics-insight-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.analytics-insight-icon svg {
  width: 18px;
  height: 18px;
}

.analytics-insight-icon.success {
  background-color: rgba(34, 197, 94, 0.15);
  color: var(--fg-success);
}

.analytics-insight-icon.warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--fg-warning);
}

.analytics-insight-header h3 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0;
}

.analytics-insight-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.insight-item {
  padding: var(--space-3);
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
}

.insight-topic {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.insight-detail {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.insight-action {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-brand);
  text-decoration: none;
}

.insight-action:hover {
  text-decoration: underline;
}

/* Analytics Mobile Responsive */
@media (max-width: 639px) {
  .analytics-header {
    flex-direction: column;
    gap: var(--space-3);
  }

  .analytics-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .analytics-stat-card {
    padding: var(--space-4);
  }

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

  .analytics-chart-card {
    padding: var(--space-3);
    max-width: 100%;
    overflow: hidden;
  }

  .analytics-chart-card.wide {
    grid-column: span 1;
  }

  .analytics-chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .analytics-chart-header h3 {
    font-size: var(--text-base);
  }

  .analytics-chart-legend {
    flex-wrap: wrap;
  }

  .analytics-chart-body {
    max-width: 100%;
    overflow: hidden;
  }

  .analytics-line-chart {
    max-width: 100%;
    overflow: hidden;
  }

  .chart-wrapper {
    flex-direction: column;
    max-width: 100%;
  }

  .chart-y-axis {
    display: none;
  }

  .chart-scrollable {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart-inner {
    min-width: fit-content;
    width: max-content;
  }

  .chart-area {
    height: 140px;
    min-width: fit-content;
    width: max-content;
  }

  .chart-bars {
    gap: var(--space-2);
    padding: 0 var(--space-2);
    min-width: fit-content;
  }

  .chart-bar-group {
    flex-shrink: 0;
    width: 40px;
    max-width: 32px;
  }

  .chart-bar {
    max-width: 14px;
    margin: 0 auto;
  }

  .chart-bar-score {
    font-size: 8px;
    top: -12px;
    white-space: nowrap;
  }

  .chart-labels {
    gap: 4px;
    padding: 0;
    justify-content: space-evenly;
    width: 100%;
  }

  .chart-label {
    flex: 1;
    max-width: 32px;
    font-size: 8px;
    min-width: 0;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chart-score-legend {
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
  }

  .chart-score-legend-item {
    font-size: var(--text-xs);
  }
}

/* Activity Section */
.analytics-section {
  margin-bottom: var(--space-6);
}

.analytics-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.analytics-section-header h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0;
}

.analytics-activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.analytics-activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

.analytics-activity-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.analytics-activity-icon svg {
  width: 20px;
  height: 20px;
}

.analytics-activity-icon.success {
  background-color: rgba(34, 197, 94, 0.15);
  color: var(--fg-success);
}

.analytics-activity-icon.warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--fg-warning);
}

.analytics-activity-icon.brand {
  background-color: rgba(78, 71, 221, 0.15);
  color: var(--fg-brand);
}

.analytics-activity-content {
  flex: 1;
  min-width: 0;
}

.analytics-activity-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.analytics-activity-meta {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.analytics-activity-time {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1023px) {
  .analytics-stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .analytics-chart-card.wide {
    grid-column: span 1;
  }

  .analytics-insights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .analytics-header {
    flex-direction: column;
  }

  .analytics-header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .analytics-activity-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .analytics-activity-time {
    align-self: flex-start;
  }
}

/* ========================================
   BOOKMARKS PAGE
   Liquid Glass Lite: Bookmark management
   ======================================== */

/* Bookmarks Header */
.bookmarks-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.bookmarks-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
}

.bookmarks-subtitle {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-top: var(--space-1);
}

/* Bookmarks Stats - Matching analytics pattern */
.bookmarks-stats {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.bookmark-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  min-width: 120px;
  text-align: center;
}

.bookmark-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-brand);
  line-height: 1;
}

.bookmark-stat-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  margin-top: var(--space-1);
}

/* Bookmarks Filters */
.bookmarks-filters {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  align-items: center;
}

.filter-select {
  appearance: none;
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background-color: var(--bg-secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  color: var(--fg-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-select:hover {
  border-color: var(--border-secondary);
}

.filter-select:focus {
  outline: none;
  border-color: var(--fg-brand);
  box-shadow: 0 0 0 3px var(--bg-brand-subtle);
}

/* Practice Button */
.practice-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--gradient-primary);
  color: var(--fg-on-brand);
  border: none;
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-fast);
}

.practice-btn:hover:not(:disabled) {
  box-shadow: var(--shadow-primary);
}

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

.practice-btn svg {
  width: 18px;
  height: 18px;
}

/* Bookmarks List */
.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Bookmark Card - matches wit-test-card style */
.bookmark-card {
  position: relative;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}

.bookmark-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.bookmark-card.highlight {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(78, 71, 221, 0.15);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.bookmark-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.bookmark-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.bookmark-subject {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-brand);
  background-color: var(--bg-brand-subtle);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
}

/* Bookmark reason badges - using design system badge styles */
.bookmark-reason {
  display: inline-flex;
  align-items: center;
  height: var(--badge-height-md);
  padding: 0 var(--badge-padding);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1;
  border-radius: var(--badge-radius);
  white-space: nowrap;
  background-color: var(--bg-tertiary);
  color: var(--fg-secondary);
}

.bookmark-reason.wrong_answer {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

.bookmark-reason.difficult {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.bookmark-reason.important {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.bookmark-reason.review_later {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

/* Bookmark Card Actions */
.bookmark-card-actions {
  display: flex;
  gap: var(--space-2);
}

.bookmark-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--fg-tertiary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.bookmark-action-btn:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.bookmark-action-btn.delete:hover {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

/* Bookmark Card More Menu */
.bookmark-card-more {
  position: relative;
}

.bookmark-card-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--fg-tertiary);
  cursor: pointer;
  transition: all 0.2s;
}

.bookmark-card-more-btn:hover {
  background: var(--bg-secondary);
  color: var(--fg-primary);
}

.bookmark-card-more-btn svg {
  width: 18px;
  height: 18px;
}

.bookmark-card-more-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 140px;
  padding: var(--space-1);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 100;
}

.bookmark-card-more-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.bookmark-card-more-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-primary);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.bookmark-card-more-item:hover {
  background: var(--bg-tertiary);
}

.bookmark-card-more-item.danger {
  color: var(--fg-error);
}

.bookmark-card-more-item.danger:hover {
  background: var(--bg-error-subtle);
}

.bookmark-card-more-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Bookmark Question */
.bookmark-question {
  font-size: var(--text-base);
  color: var(--fg-primary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

/* Bookmark Options */
.bookmark-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.bookmark-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  background-color: var(--bg-tertiary);
}

.bookmark-option.correct {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.bookmark-option-marker {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: var(--bg-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.bookmark-option.correct .bookmark-option-marker {
  background-color: var(--bg-success);
  color: white;
}

/* Bookmark Notes */
.bookmark-notes {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  font-style: italic;
  padding: var(--space-3);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin-top: var(--space-3);
}

/* Bookmark Footer */
.bookmark-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

/* Bookmark Date */
.bookmark-date {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Bookmark Source (Test Name) */
.bookmark-source {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.bookmark-source a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

.bookmark-source a:hover {
  text-decoration: underline;
}

/* Empty State - Reusable Component */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  gap: 0; /* Reset any inherited gap */
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-3);
  color: var(--fg-tertiary);
}

.empty-state-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
}

.empty-state-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* Empty State - Formats Section */
.empty-state-formats {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-primary);
}

.empty-state-formats-label {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
  margin-bottom: var(--space-4);
}

.empty-state-formats-list {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

.format-badge {
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  background: var(--bg-secondary);
}

/* Empty State - How It Works Section */
.empty-state-how {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-primary);
  width: 100%;
  max-width: 600px;
}

.empty-state-how-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-6);
}

.empty-state-how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.empty-state-how-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty-state-how-item img {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-3);
}

.empty-state-how-item h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0 0 var(--space-1) 0;
}

.empty-state-how-item p {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin: 0;
}

.empty-state-tip {
  margin-top: var(--space-8);
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  max-width: 400px;
}

.empty-state-tip p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  z-index: var(--z-toast);
  animation: toastSlideUp 0.3s var(--ease-out);
  background-color: var(--color-neutral-0);
  color: var(--fg-primary);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-primary);
}

.toast-success {
  border-left: 4px solid var(--color-success-500);
}

.toast-error {
  border-left: 4px solid var(--color-error-500);
}

.toast-warning {
  border-left: 4px solid var(--color-warning-500);
}

.toast-info {
  border-left: 4px solid var(--color-info-500);
}

/* Dark mode toast */
html[data-theme="dark"] .toast {
  background-color: var(--color-neutral-900);
  border-color: var(--color-neutral-700);
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-primary);
  border-top-color: var(--fg-brand);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

/* Responsive Bookmarks */
@media (max-width: 768px) {
  .bookmarks-header {
    flex-direction: column;
    align-items: stretch;
  }

  .bookmarks-stats {
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: var(--space-2);
  }

  .bookmark-stat {
    flex: 1;
    min-width: 0;
    padding: var(--space-3);
  }

  .bookmark-stat-value {
    font-size: var(--text-lg);
  }

  .bookmark-stat-label {
    font-size: var(--text-xs);
  }

  .bookmarks-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-select {
    width: 100%;
  }

  .practice-btn {
    width: 100%;
    justify-content: center;
  }

  /* Bookmarks page: Hide stat cards on mobile */
  .bookmarks-header + .analytics-stats {
    display: none;
  }
}

/* ========================================
   AI CHATBOT COMPONENT
   Liquid Glass Lite: Floating chat widget
   ======================================== */

/* Floating Chat Button */
.chatbot-fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-fixed);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: url('../images/bg-ai.jpg') center/cover no-repeat;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 8px 32px rgba(78, 71, 221, 0.1);
  cursor: pointer;
  transition: var(--transition-colors), box-shadow 0.2s ease;
}

.chatbot-fab:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 12px 48px rgba(78, 71, 221, 0.15);
  transform: translateY(-2px);
}

.chatbot-fab svg {
  width: 28px;
  height: 28px;
}

.chatbot-fab img {
  width: 28px;
  height: 28px;
  animation: sparkle-pulse 2s ease-in-out infinite;
}

@keyframes sparkle-pulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  25% {
    transform: scale(1.1) rotate(5deg);
    opacity: 0.9;
  }
  50% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  75% {
    transform: scale(1.1) rotate(-5deg);
    opacity: 0.9;
  }
}

/* Pause animation when chatbot is open */
.chatbot-fab.active img {
  animation: none;
}

.chatbot-fab .chatbot-fab-close {
  display: none;
  color: var(--fg-primary);
}

.chatbot-fab.active .chatbot-fab-icon {
  display: none;
}

.chatbot-fab.active .chatbot-fab-close {
  display: block;
}

/* Notification Badge on FAB */
.chatbot-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 20px;
  text-align: center;
  background-color: var(--bg-error);
  color: white;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-primary);
}

/* Chatbot Overlay - Only visible on mobile */
.chatbot-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: calc(var(--z-modal) - 1);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-out), visibility var(--duration-normal);
  display: none; /* Hidden on desktop */
}

.chatbot-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Chat Panel - Right Side Panel */
.chatbot-panel {
  --chatbot-width: 420px;
  position: fixed;
  top: var(--navbar-height, 64px);
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  width: var(--chatbot-width);
  min-width: 320px;
  max-width: 800px;
  height: calc(100vh - var(--navbar-height, 64px));
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-out), width 0s;
}

.chatbot-panel.active {
  transform: translateX(0);
}

/* Resize Handle */
.chatbot-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
  transition: background-color 0.15s ease;
}

.chatbot-resize-handle:hover,
.chatbot-resize-handle.resizing {
  background-color: var(--fg-brand);
}

.chatbot-resize-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 40px;
  background: var(--border-primary);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.chatbot-resize-handle:hover::before,
.chatbot-resize-handle.resizing::before {
  opacity: 1;
  background: white;
}

/* Prevent text selection while resizing */
body.chatbot-resizing {
  cursor: ew-resize !important;
  user-select: none !important;
}

body.chatbot-resizing * {
  cursor: ew-resize !important;
}

/* Main content resizes when chatbot is open (desktop only) */
body.chatbot-open .subject-page {
  transition: margin-right var(--duration-normal) var(--ease-out);
}

body.chatbot-open .subject-content {
  margin-right: var(--chatbot-width, 420px);
  transition: margin-right var(--duration-normal) var(--ease-out);
}

body.chatbot-open .app-page .app-page-content {
  margin-right: var(--chatbot-width, 420px);
  transition: margin-right var(--duration-normal) var(--ease-out);
}

body.chatbot-open .chatbot-fab {
  right: calc(var(--chatbot-width, 420px) + var(--space-6));
  transition: right var(--duration-normal) var(--ease-out);
}

/* Chat Header */
.chatbot-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: url('../bg/bgmesh-1 Large.jpeg') center/cover no-repeat;
  color: white;
  flex-shrink: 0;
}

.chatbot-avatar {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-avatar img {
  width: 32px;
  height: 32px;
}

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

.chatbot-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  opacity: 0.9;
}

.chatbot-status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success-400);
  border-radius: var(--radius-full);
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chatbot-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  cursor: pointer;
  transition: var(--transition-colors);
}

.chatbot-header-btn:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.chatbot-header-btn svg {
  width: 18px;
  height: 18px;
}

/* Chat Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Message Bubble */
.chatbot-message {
  display: flex;
  gap: var(--space-3);
  max-width: 90%;
}

.chatbot-message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.chatbot-message-avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.chatbot-message.user .chatbot-message-avatar {
  background-color: var(--bg-tertiary);
  color: var(--fg-secondary);
}

.chatbot-message-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chatbot-message-bubble {
  padding: var(--space-3) var(--space-4);
  padding-left: 0;
  background-color: transparent;
  border-radius: var(--radius-2xl);
  border-top-left-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--fg-primary);
}

.chatbot-message.user .chatbot-message-bubble {
  background-color: var(--bg-brand);
  color: white;
  border-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-sm);
}

.chatbot-message-time {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  padding: 0 var(--space-1);
}

.chatbot-message.user .chatbot-message-time {
  text-align: right;
}

/* Message Action Buttons (Copy + Report) */
.chatbot-msg-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.chatbot-msg-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--fg-tertiary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.chatbot-msg-action-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--fg-secondary);
}

.chatbot-msg-action-btn.copied {
  color: var(--color-success-500, #22c55e);
}

.chatbot-msg-action-btn.reported {
  color: var(--color-warning-500, #f59e0b);
}

.chatbot-msg-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Chatbot action link buttons (AI tutor actionable responses) */
.chatbot-action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chatbot-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
  border-radius: 9999px;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: var(--transition-fast);
}
.chatbot-action-link:hover {
  background: var(--fg-brand);
  color: white;
}

/* Light source attribution line in chat responses */
.chatbot-light-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.chatbot-report-wrap {
  position: relative;
}

.chatbot-report-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  min-width: 200px;
  padding: var(--space-1) 0;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  animation: chatReportFadeIn 0.15s ease;
}

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

.chatbot-report-dropdown-item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  transition: var(--transition-fast);
}

.chatbot-report-dropdown-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--fg-primary);
}

/* Typing Indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-2xl);
  border-top-left-radius: var(--radius-sm);
  width: fit-content;
}

.chatbot-typing-dot {
  width: 8px;
  height: 8px;
  background-color: var(--fg-tertiary);
  border-radius: var(--radius-full);
  animation: typingPulse 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingPulse {
  0%, 60%, 100% { opacity: 0.4; }
  30% { opacity: 1; }
}

/* Source Reference in Message */
.chatbot-source-ref {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  margin-top: var(--space-2);
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-colors);
}

.chatbot-source-ref:hover {
  background-color: var(--color-primary-100);
}

.chatbot-source-ref svg {
  width: 14px;
  height: 14px;
}

/* Quick Actions Wrapper */
.chatbot-quick-actions-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-primary);
  background-color: var(--bg-secondary);
}

/* Quick Actions - Horizontal Scrollable */
.chatbot-quick-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar but keep functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.chatbot-quick-actions::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.chatbot-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
  flex-shrink: 0;
}

.chatbot-quick-btn:hover {
  background-color: var(--bg-brand-subtle);
  border-color: var(--border-brand);
  color: var(--fg-brand);
}

.chatbot-quick-btn svg {
  width: 14px;
  height: 14px;
}

/* Chat Input Area - Claude/GPT Unified Box Style */
.chatbot-input-area {
  width: 100%;
  padding: var(--space-3) var(--space-4) max(var(--space-4), env(safe-area-inset-bottom));
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-primary);
  flex-shrink: 0;
  box-sizing: border-box;
}

.chatbot-input-box {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.chatbot-input-box:focus-within {
  border-color: var(--border-brand);
  box-shadow: 0 0 0 3px rgba(78, 71, 221, 0.1);
}

.chatbot-input-row-1 {
  width: 100%;
}

.chatbot-input-row-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-secondary);
  background: var(--bg-secondary);
}

.chatbot-input-actions-left {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.chatbot-input-actions-right {
  display: flex;
  align-items: center;
}

.chatbot-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--fg-tertiary);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-lg);
  transition: var(--transition-colors);
  font-size: var(--text-sm);
}

.chatbot-action-btn:hover {
  color: var(--fg-brand);
  background: var(--bg-tertiary);
}

.chatbot-action-btn svg {
  width: 18px;
  height: 18px;
}

.chatbot-depth-toggle {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 6px 12px;
}

.chatbot-depth-toggle:hover {
  background: var(--border-primary);
}

.depth-label {
  font-weight: 500;
  color: var(--fg-secondary);
}

.chatbot-input {
  width: 100%;
  min-height: 44px;
  max-height: 200px;
  padding: 14px var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--fg-primary);
  background-color: transparent;
  border: none !important;
  border-radius: 0;
  resize: none;
  transition: var(--transition-colors);
  box-sizing: border-box;
  overflow-y: auto;
  outline: none !important;
  box-shadow: none !important;
}

.chatbot-input::placeholder {
  color: var(--fg-placeholder);
}

.chatbot-input:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.chatbot-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: var(--bg-brand);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
  background-color: var(--color-primary-600);
  transform: scale(1.05);
}

.chatbot-send-btn:disabled {
  background-color: var(--bg-tertiary);
  color: var(--fg-tertiary);
  cursor: not-allowed;
}

.chatbot-send-btn svg {
  width: 16px;
  height: 18px;
}

.chatbot-send-btn svg {
  width: 20px;
  height: 20px;
}

/* Context Banner styles are now in chatbot.js inline styles (expandable context) */

/* Welcome Screen */
.chatbot-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  text-align: center;
}

.chatbot-welcome-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.chatbot-welcome-icon img {
  width: 48px;
  height: 48px;
}

.chatbot-welcome h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0 0 var(--space-2) 0;
}

.chatbot-welcome p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0 0 var(--space-6) 0;
  max-width: 280px;
}

.chatbot-welcome-suggestions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.chatbot-suggestion-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  color: var(--fg-primary);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-colors);
}

.chatbot-suggestion-btn:hover {
  background-color: var(--bg-brand-subtle);
  border-color: var(--border-brand);
}

.chatbot-suggestion-btn svg {
  width: 18px;
  height: 18px;
  color: var(--fg-brand);
  flex-shrink: 0;
}

/* Inline Question Helper (alternative to floating) */
.question-ai-helper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-top: var(--space-4);
  background-color: var(--bg-brand-subtle);
  border: 1px solid var(--color-primary-200);
  border-radius: var(--radius-2xl);
  cursor: pointer;
  transition: var(--transition-colors);
}

.question-ai-helper:hover {
  background-color: var(--color-primary-100);
  border-color: var(--border-brand);
}

.question-ai-helper-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  color: white;
  flex-shrink: 0;
}

.question-ai-helper-icon svg {
  width: 22px;
  height: 22px;
}

.question-ai-helper-content {
  flex: 1;
}

.question-ai-helper-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-brand);
  margin-bottom: var(--space-1);
}

.question-ai-helper-desc {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.question-ai-helper-arrow {
  color: var(--fg-brand);
}

.question-ai-helper-arrow svg {
  width: 20px;
  height: 20px;
}

/* Mobile Responsive */
@media (max-width: 639px) {
  /* Show overlay on mobile */
  .chatbot-overlay {
    display: block;
  }

  .chatbot-fab {
    bottom: var(--space-4);
    right: var(--space-4);
    width: 56px;
    height: 56px;
  }

  .chatbot-fab svg {
    width: 24px;
    height: 24px;
  }

  .chatbot-panel {
    --chatbot-width: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    top: 0;
    height: 100vh;
    border-left: none;
    border-radius: 0;
  }

  /* Hide resize handle on mobile */
  .chatbot-resize-handle {
    display: none;
  }

  /* Reset desktop margins on mobile - chatbot takes full screen */
  body.chatbot-open .subject-content,
  body.chatbot-open .app-page .app-page-content {
    margin-right: 0;
  }

  body.chatbot-open .chatbot-fab {
    right: var(--space-4);
  }

  .chatbot-header {
    padding: var(--space-3) var(--space-4);
  }

  .chatbot-avatar {
    width: 40px;
    height: 40px;
  }

  .chatbot-quick-actions-wrapper {
    padding: 8px 12px;
    gap: 6px;
  }

  .chatbot-quick-actions {
    gap: 6px;
  }

  .chatbot-quick-btn {
    padding: 5px 10px;
    font-size: var(--text-xs);
  }

  .chatbot-input-area {
    padding: var(--space-3);
  }
}

/* Dark Mode Adjustments */
[data-theme="dark"] .chatbot-message-bubble {
  background-color: transparent;
}

[data-theme="dark"] .chatbot-message.user .chatbot-message-bubble {
  background-color: var(--bg-brand);
}

[data-theme="dark"] .chatbot-quick-btn {
  background-color: var(--bg-tertiary);
}

[data-theme="dark"] .chatbot-input-box {
  background-color: var(--bg-tertiary);
  border-color: var(--border-secondary);
}

[data-theme="dark"] .chatbot-input-row-2 {
  background-color: var(--bg-tertiary);
  border-color: var(--border-primary);
}

[data-theme="dark"] .chatbot-depth-toggle {
  background-color: var(--bg-secondary);
}

[data-theme="dark"] .chatbot-depth-toggle:hover {
  background-color: var(--border-primary);
}

[data-theme="dark"] .chatbot-action-btn:hover {
  background-color: var(--bg-secondary);
}

[data-theme="dark"] .chatbot-fab {
  background: url('../images/bg-ai.jpg') center/cover no-repeat;
  border-color: var(--border-secondary);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 8px 32px rgba(78, 71, 221, 0.2);
}

[data-theme="dark"] .chatbot-fab:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 12px 48px rgba(78, 71, 221, 0.3);
}

[data-theme="dark"] .chatbot-fab .chatbot-fab-close {
  color: var(--fg-primary-light, #1e293b);
}

[data-theme="dark"] .chatbot-source-ref {
  background-color: rgba(78, 71, 221, 0.2);
}

[data-theme="dark"] .question-ai-helper {
  background-color: rgba(78, 71, 221, 0.15);
  border-color: rgba(78, 71, 221, 0.3);
}

[data-theme="dark"] .question-ai-helper:hover {
  background-color: rgba(78, 71, 221, 0.25);
}

/* ==========================================
 * USER DROPDOWN MENU
 * Liquid Glass Lite: Soft shadow, no blur
 * ========================================== */

.user-dropdown-wrapper {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              visibility var(--duration-fast);
  padding-bottom: var(--space-2);
}

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

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

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

.user-dropdown-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.user-dropdown-email {
  display: block;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-divider {
  height: 1px;
  background-color: var(--border-primary);
  margin: var(--space-1) 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  transition: var(--transition-colors);
  text-decoration: none;
}

/* Button reset for dropdown items */
button.user-dropdown-item {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.user-dropdown-item:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.user-dropdown-item.active {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.user-dropdown-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.user-dropdown-item-danger {
  color: var(--fg-error);
}

.user-dropdown-item-danger:hover {
  background-color: var(--bg-error-subtle);
  color: var(--fg-error);
}

.user-dropdown-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background-color: var(--bg-error);
  color: #fff;
  font-size: 11px;
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ==========================================
 * NOTIFICATION DROPDOWN
 * ========================================== */

.notification-dropdown-wrapper {
  position: relative;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

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

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.notification-dropdown-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.notification-dropdown-actions {
  display: flex;
  gap: var(--space-2);
}

.notification-action-btn {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--fg-brand);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.notification-action-btn:hover {
  background-color: var(--bg-brand-subtle);
}

.notification-dropdown-list {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}

.notification-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background-color 0.15s;
  border-bottom: 1px solid var(--border-secondary);
}

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

.notification-item:hover {
  background-color: var(--interactive-hover);
}

.notification-item.unread {
  background-color: var(--bg-brand-subtle);
}

.notification-item.unread:hover {
  background-color: var(--bg-brand-subtle-hover, rgba(78, 71, 221, 0.15));
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-lg);
}

.notification-icon.study_reminder {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.notification-icon.achievement {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.notification-icon.test_result {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.notification-icon.system {
  background-color: var(--bg-tertiary);
  color: var(--fg-secondary);
}

.notification-icon.weekly_report {
  background-color: var(--bg-info-subtle, #dbeafe);
  color: var(--fg-info, #3b82f6);
}

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

.notification-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin-bottom: 2px;
  line-height: 1.4;
}

.notification-message {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-time {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: 4px;
}

.notification-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--fg-brand);
  flex-shrink: 0;
  margin-top: 6px;
}

.notification-dropdown-empty {
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.notification-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-3);
}

.notification-empty-text {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

.notification-dropdown-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.notification-view-all {
  display: block;
  width: 100%;
  padding: var(--space-2);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-brand);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.notification-view-all:hover {
  background-color: var(--bg-brand-subtle);
}

/* Notification badge animation */
@keyframes notification-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.app-navbar-badge.has-new {
  animation: notification-pulse 0.5s ease;
}

/* ============================================
   Notifications Page — Card Layout
   Matches wit-test-card / source-card pattern
   ============================================ */

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.notification-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.notification-card:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.notification-card.unread {
  border-color: var(--border-brand, rgba(78, 71, 221, 0.3));
  background-color: var(--bg-brand-subtle);
}

.notification-card.unread:hover {
  border-color: var(--fg-brand);
  box-shadow: var(--shadow-sm);
}

/* Card Icon — matches wit-test-card-icon pattern */
.notification-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.notification-card-icon svg {
  width: 22px;
  height: 22px;
}

.notification-card-icon.study_reminder {
  background-color: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.notification-card-icon.achievement {
  background-color: var(--bg-success-subtle);
  color: var(--fg-success);
}

.notification-card-icon.test_result {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.notification-card-icon.system {
  background-color: var(--bg-tertiary);
  color: var(--fg-secondary);
}

.notification-card-icon.weekly_report {
  background-color: var(--bg-info-subtle, #dbeafe);
  color: var(--fg-info, #3b82f6);
}

/* Card Body */
.notification-card-body {
  flex: 1;
  min-width: 0;
}

.notification-card-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  line-height: 1.4;
  margin-bottom: 2px;
}

.notification-card-message {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  line-height: 1.5;
}

.notification-card-time {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: var(--space-2);
}

/* Unread dot */
.notification-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--fg-brand);
  flex-shrink: 0;
  margin-top: var(--space-2);
}

/* Avatar sizes */
.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: var(--text-lg);
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: var(--text-2xl);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* ==========================================
 * PROFILE PAGE
 * ========================================== */

.profile-header {
  margin-bottom: var(--space-8);
}

.profile-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-primary);
  margin-bottom: var(--space-2);
}

.profile-subtitle {
  font-size: var(--text-base);
  color: var(--fg-secondary);
}

.profile-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

@media (min-width: 1024px) {
  .profile-layout {
    flex-direction: row;
    gap: var(--space-8);
  }
}

/* Profile Sidebar Navigation */
.profile-sidebar {
  width: 100%;
}

@media (min-width: 1024px) {
  .profile-sidebar {
    width: 260px;
    flex-shrink: 0;
  }
}

.profile-nav {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

@media (min-width: 1024px) {
  .profile-nav {
    flex-direction: column;
    overflow-x: visible;
    padding-bottom: 0;
  }
}

.profile-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  border-radius: var(--radius-xl);
  white-space: nowrap;
  transition: var(--transition-colors);
}

.profile-nav-link:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.profile-nav-link.active {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.profile-nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Profile Content */
.profile-content {
  flex: 1;
  min-width: 0;
}

.profile-section {
  display: none;
}

.profile-section.active {
  display: block;
}

/* Profile Card */
.profile-card {
  background-color: var(--bg-primary);
  border: var(--card-border);
  border-radius: var(--card-radius);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--card-shadow);
}

.profile-card-header {
  margin-bottom: var(--space-6);
}

.profile-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.profile-card-description {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

.profile-card-divider {
  height: 1px;
  background-color: var(--border-primary);
  margin: var(--space-6) 0;
}

/* Profile Avatar Section */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
  text-align: center;
}

@media (min-width: 640px) {
  .profile-avatar-section {
    flex-direction: row;
    text-align: left;
  }
}

.profile-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--bg-brand);
  color: white;
  border-radius: var(--radius-full);
  border: 3px solid var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
}

.profile-avatar-edit:hover {
  background-color: var(--bg-brand-emphasis);
}

.profile-avatar-edit svg {
  width: 14px;
  height: 14px;
}

.profile-avatar-info h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.profile-avatar-info p {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-bottom: var(--space-3);
}

/* Profile Form */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-row {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

/* Form Input - matches base.css .input styling */
.form-input {
  display: block;
  width: 100%;
  height: var(--input-height-md, 44px);
  padding: 0 var(--input-padding-x, 14px);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--fg-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary, #e2e8f0);
  border-radius: var(--input-radius, 10px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input::placeholder {
  color: var(--fg-placeholder, #94a3b8);
}

.form-input:hover:not(:disabled) {
  border-color: var(--border-secondary, #cbd5e1);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus, #4E47DD);
  box-shadow: 0 0 0 3px rgba(78, 71, 221, 0.15);
}

.form-input:disabled {
  background-color: var(--bg-tertiary, #f1f5f9);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Select-specific styles for form-input */
select.form-input {
  appearance: none;
  padding-right: var(--space-10, 40px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3, 12px) center;
  cursor: pointer;
}

[data-theme="dark"] .form-input {
  background-color: var(--bg-secondary, #1e293b);
  border-color: var(--border-primary, #334155);
  color: var(--fg-primary, #f1f5f9);
}

[data-theme="dark"] .form-input::placeholder {
  color: var(--fg-tertiary, #64748b);
}

[data-theme="dark"] .form-input:focus {
  border-color: var(--border-focus, #818cf8);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.form-optional {
  font-weight: var(--font-regular);
  color: var(--fg-tertiary);
}

.form-hint {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-primary);
  margin-top: var(--space-2);
}

/* Input with icon */
.input-with-icon {
  position: relative;
}

.input-with-icon .input {
  padding-right: var(--space-10);
}

.input-icon-btn {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--fg-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition-colors);
}

.input-icon-btn:hover {
  color: var(--fg-primary);
}

.input-icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Password strength indicator */
.password-strength {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.password-strength-bar {
  flex: 1;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.password-strength-bar::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background-color: var(--fg-tertiary);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out), background-color var(--duration-normal);
}

.password-strength.strength-weak .password-strength-bar::after {
  width: 25%;
  background-color: var(--fg-error);
}

.password-strength.strength-fair .password-strength-bar::after {
  width: 50%;
  background-color: var(--fg-warning);
}

.password-strength.strength-good .password-strength-bar::after {
  width: 75%;
  background-color: var(--fg-info);
}

.password-strength.strength-strong .password-strength-bar::after {
  width: 100%;
  background-color: var(--fg-success);
}

.password-strength-text {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  white-space: nowrap;
}

.password-strength.strength-weak .password-strength-text {
  color: var(--fg-error);
}

.password-strength.strength-fair .password-strength-text {
  color: var(--fg-warning);
}

.password-strength.strength-good .password-strength-text {
  color: var(--fg-info);
}

.password-strength.strength-strong .password-strength-text {
  color: var(--fg-success);
}

/* Security options */
.security-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-primary);
}

.security-option:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.security-option-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.security-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.security-option-icon svg {
  width: 20px;
  height: 20px;
}

.security-option-info h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.security-option-info p {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-neutral-300, #d1d5db);
  border-radius: var(--radius-full);
  transition: background-color 0.2s ease;
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  border-radius: var(--radius-full);
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
  background-color: var(--color-primary-500, #4E47DD);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px var(--bg-brand-subtle, rgba(78, 71, 221, 0.2));
}

/* Dark mode toggle adjustments */
[data-theme="dark"] .toggle-slider {
  background-color: var(--color-neutral-600, #4b5563);
}

[data-theme="dark"] .toggle-slider::before {
  background-color: #ffffff;
}

/* Notification settings */
.notification-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.notification-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.notification-group-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: var(--space-2);
}

.notification-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}

.notification-option-info h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.notification-option-info p {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Preference settings */
.preference-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.preference-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .preference-option {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }
}

.preference-option-info {
  flex: 1;
  min-width: 0;
}

.preference-option-info h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.preference-option-info p {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.preference-option > select,
.preference-option > .select-input {
  width: 100%;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .preference-option > select,
  .preference-option > .select-input {
    width: 200px;
  }
}

/* Theme selector */
.theme-selector {
  display: flex;
  gap: var(--space-2);
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: var(--transition-colors);
}

.theme-option:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.theme-option.active {
  border-color: var(--fg-brand);
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.theme-option svg {
  width: 20px;
  height: 20px;
}

/* Select input */
.select-input {
  min-width: 180px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

[data-theme="dark"] .select-input,
[data-theme="dark"] select.form-input,
[data-theme="dark"] .filter-select,
[data-theme="dark"] .analytics-period-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Danger zone */
.profile-card-danger {
  border-color: var(--color-error-200);
}

[data-theme="dark"] .profile-card-danger {
  border-color: var(--color-error-800);
}

.danger-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .danger-option {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.danger-option-info h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-error);
  margin-bottom: var(--space-1);
}

.danger-option-info p {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Button danger variant */
.btn-danger {
  background-color: var(--bg-error);
  color: var(--fg-on-error);
}

.btn-danger:hover {
  background-color: var(--color-error-600);
}

/* ==========================================
 * MODAL (Legacy pattern: .modal-overlay > .modal-content)
 * Standard pattern uses base.css: .modal > .modal-overlay + .modal-container
 * ========================================== */

/* Modal overlay hidden by default, show on .active */
.modal-overlay#pdfDownloadModal {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay#pdfDownloadModal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* PDF Modal consistent spacing (no border lines, uniform padding) */
#pdfDownloadModal .modal-header {
  border-bottom: none;
  padding: var(--space-5) var(--space-5) var(--space-3);
}

#pdfDownloadModal .modal-body {
  padding: 0 var(--space-5);
}

#pdfDownloadModal .modal-footer {
  border-top: none;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

#pdfDownloadModal .pdf-options {
  margin-top: 0;
}

/* Legacy modal-overlay as root container - for dynamically created modals */
.modal-overlay > .modal-content {
  position: relative;
  z-index: 1;
  background-color: var(--bg-primary, #ffffff);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

[data-theme="dark"] .modal-overlay > .modal-content {
  background-color: #1e293b;
  color: #f1f5f9;
}

/* ==========================================
 * CONFIRM DIALOG — Reusable pattern
 * Layout: Icon(top-left) X(top-right) / Title / Message / CTAs
 * Usage: WitModal.confirm(), WitModal.confirmDelete()
 * ========================================== */
.confirm-dialog {
  max-width: 420px;
}

.confirm-dialog .confirm-dialog-body {
  padding: var(--space-6);
}

.confirm-dialog .confirm-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.confirm-dialog .confirm-dialog-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-dialog .confirm-dialog-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-tertiary);
  transition: var(--transition-colors);
}

.confirm-dialog .confirm-dialog-close:hover {
  background-color: var(--interactive-hover);
  color: var(--fg-primary);
}

.confirm-dialog .confirm-dialog-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  line-height: 1.3;
  margin: 0 0 var(--space-2) 0;
}

.confirm-dialog .confirm-dialog-message {
  color: var(--fg-secondary);
  font-size: var(--text-base);
  line-height: 1.5;
  margin: 0;
}

.confirm-dialog .confirm-dialog-actions {
  display: flex;
  gap: var(--space-3);
  padding: 0 var(--space-6) var(--space-6);
}

.confirm-dialog .confirm-dialog-actions .btn {
  flex: 1;
}

@media (max-width: 639px) {
  .confirm-dialog .confirm-dialog-body {
    padding: var(--space-4);
  }
  .confirm-dialog .confirm-dialog-actions {
    padding: 0 var(--space-4) var(--space-4);
  }
}

/* PDF Download Options */
.pdf-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.pdf-option {
  cursor: pointer;
}

.pdf-option input[type="radio"] {
  display: none;
}

.pdf-option-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: all 0.15s ease;
}

.pdf-option:hover .pdf-option-content {
  border-color: var(--border-secondary);
  background-color: var(--bg-tertiary);
}

.pdf-option input[type="radio"]:checked + .pdf-option-content {
  border-color: var(--fg-brand);
  background-color: var(--bg-brand-subtle);
}

.pdf-option-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(78, 71, 221, 0.15);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.pdf-option-icon img {
  width: 24px;
  height: 24px;
}

.pdf-option input[type="radio"]:checked + .pdf-option-content .pdf-option-icon {
  background-color: var(--bg-brand);
}

.pdf-option input[type="radio"]:checked + .pdf-option-content .pdf-option-icon img {
  filter: brightness(0) invert(1);
}

.pdf-option-check {
  display: none;
  color: var(--fg-brand);
  margin-left: auto;
  flex-shrink: 0;
}

.pdf-option input[type="radio"]:checked + .pdf-option-content .pdf-option-check {
  display: flex;
}

.pdf-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pdf-option-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-primary);
}

.pdf-option-desc {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.modal-subtitle {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
}

/* Icon Picker */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: var(--text-xl);
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
}

[data-theme="dark"] .icon-option {
  border-color: #334155;
  background-color: #1e293b;
}

.icon-option:hover {
  border-color: var(--border-brand, #4E47DD);
  background-color: #f1f5f9;
}

[data-theme="dark"] .icon-option:hover {
  background-color: #334155;
}

.icon-option.selected {
  border-color: var(--border-brand, #4E47DD);
  background-color: var(--bg-brand-subtle, #EDEDFC);
}

[data-theme="dark"] .icon-option.selected {
  background-color: #312e81;
}

/* Color Picker */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-option {
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: #1e293b;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px currentColor;
}

[data-theme="dark"] .color-option.selected {
  border-color: #f1f5f9;
  box-shadow: 0 0 0 2px #1e293b, 0 0 0 4px currentColor;
}

/* ==========================================
 * CREATE TEST PAGE
 * Full page layout for test creation
 * ========================================== */

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
  transition: color var(--duration-fast);
}

.back-link:hover {
  color: var(--fg-primary);
}

.back-link svg {
  flex-shrink: 0;
}

/* Page subtitle (extends page-header) */
.page-subtitle {
  font-size: var(--text-base);
  color: var(--fg-secondary);
  margin-top: var(--space-1);
}

/* Create Test Layout */
.create-test-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 1024px) {
  .create-test-layout {
    grid-template-columns: 1fr 1fr;
  }
}

.create-test-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Card Extensions for structured cards (with header/body) */
.create-test-layout .card {
  padding: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-primary);
  gap: var(--space-3);
}

.card-header-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-top: var(--space-1);
}

.card-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.card-highlight {
  border-color: var(--border-brand);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-brand-subtle) 100%);
}

/* Button Group Select */
.btn-group-select {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.btn-select {
  padding: var(--space-2-5) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.btn-select:hover {
  border-color: var(--border-secondary);
  color: var(--fg-primary);
}

.btn-select.active {
  background: var(--bg-brand);
  border-color: var(--bg-brand);
  color: var(--fg-on-brand);
}

/* Radio-style button select */
.btn-select-radio {
  display: contents;
}

.btn-select-radio input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.btn-select-radio input:checked + .btn-select {
  background: var(--bg-brand);
  border-color: var(--bg-brand);
  color: var(--fg-on-brand);
}

/* Difficulty-specific colors */
.btn-select-radio input:checked + .btn-select.easy {
  background: var(--bg-success-subtle);
  border-color: var(--color-success-500);
  color: var(--fg-success);
}

.btn-select-radio input:checked + .btn-select.medium {
  background: var(--bg-warning-subtle);
  border-color: var(--color-warning-500);
  color: var(--fg-warning);
}

.btn-select-radio input:checked + .btn-select.hard {
  background: var(--bg-error-subtle);
  border-color: var(--color-error-500);
  color: var(--fg-error);
}

.btn-select-radio input:checked + .btn-select.mixed {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
  color: var(--fg-brand);
}

/* Switch (toggle) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-secondary);
  border-radius: var(--radius-full);
  transition: background-color var(--duration-fast);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: var(--radius-full);
  transition: transform var(--duration-fast);
  box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch-slider {
  background-color: var(--bg-brand);
}

.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Checkbox Cards */
.checkbox-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.checkbox-card {
  display: block;
  cursor: pointer;
}

.checkbox-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-card-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: all var(--duration-fast);
}

.checkbox-card-content:hover {
  border-color: var(--border-secondary);
}

.checkbox-card input:checked + .checkbox-card-content {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
}

.checkbox-card-icon {
  width: 32px;
  height: 32px;
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

.checkbox-card-icon svg {
  width: 100%;
  height: 100%;
}

.checkbox-card input:checked + .checkbox-card-content .checkbox-card-icon {
  color: var(--fg-brand);
}

.checkbox-card-info {
  flex: 1;
  min-width: 0;
}

.checkbox-card-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

.checkbox-card-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--fg-secondary);
  margin-top: var(--space-0-5);
}

.checkbox-card-check {
  width: 20px;
  height: 20px;
  background: var(--bg-primary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration-fast);
}

.checkbox-card-check svg {
  width: 12px;
  height: 12px;
  stroke: white;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.checkbox-card input:checked + .checkbox-card-content .checkbox-card-check {
  background: var(--bg-brand);
  border-color: var(--bg-brand);
}

.checkbox-card input:checked + .checkbox-card-content .checkbox-card-check svg {
  opacity: 1;
}

/* ==========================================
 * QUESTION TYPE COUNTERS
 * ========================================== */

.question-type-counters {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.question-type-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: var(--transition-colors);
}

.question-type-row:hover {
  border-color: var(--border-secondary);
}

.question-type-row.disabled {
  opacity: 0.5;
}

/* Toggle Switch */
.question-type-toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.question-type-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.question-type-slider {
  width: 40px;
  height: 22px;
  background: var(--bg-tertiary);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: var(--transition-colors);
}

.question-type-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--bg-primary);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.question-type-toggle input:checked + .question-type-slider {
  background: var(--bg-brand);
}

.question-type-toggle input:checked + .question-type-slider::after {
  transform: translateX(18px);
}

/* Question Type Info */
.question-type-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.question-type-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.question-type-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--fg-secondary);
}

.question-type-row:not(.disabled) .question-type-icon svg {
  stroke: var(--fg-brand);
}

.question-type-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.question-type-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.question-type-desc {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

/* Counter Controls */
.question-type-counter {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.counter-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-colors);
}

.counter-btn:hover {
  background: var(--interactive-hover);
  border-color: var(--border-secondary);
}

.counter-btn:active {
  transform: scale(0.95);
}

.counter-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.counter-btn svg {
  width: 14px;
  height: 14px;
  stroke: var(--fg-secondary);
}

.counter-input {
  width: 44px;
  height: 28px;
  text-align: center;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  -moz-appearance: textfield;
}

.counter-input::-webkit-outer-spin-button,
.counter-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.counter-input:focus {
  outline: none;
  border-color: var(--border-brand);
  box-shadow: 0 0 0 3px var(--border-brand-subtle);
}

.question-type-row.disabled .counter-input {
  color: var(--fg-tertiary);
}

/* Total Summary */
.question-type-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  margin-top: var(--space-3);
  background: linear-gradient(135deg, var(--bg-brand-subtle) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-brand-subtle);
  border-radius: var(--radius-lg);
}

.total-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
}

.total-value {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--fg-brand);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .question-type-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .question-type-info {
    order: 1;
    flex: 1 1 calc(100% - 56px);
  }

  .question-type-toggle {
    order: 0;
  }

  .question-type-counter {
    order: 2;
    margin-left: auto;
  }
}

/* Source List */
.source-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 300px;
  overflow-y: auto;
}

.source-list-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8);
  color: var(--fg-secondary);
  font-size: var(--text-sm);
}

.source-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  text-align: center;
}

.source-list-empty p {
  color: var(--fg-secondary);
  margin: var(--space-3) 0 var(--space-4);
}

/* Source Item (checkbox style) */
.source-item {
  display: block;
  cursor: pointer;
}

.source-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.source-item-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast);
}

.source-item-card:hover {
  border-color: var(--border-secondary);
}

.source-item input:checked + .source-item-card {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
}

.source-item-check {
  width: 20px;
  height: 20px;
  background: var(--bg-primary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.source-item-check svg {
  width: 12px;
  height: 12px;
  stroke: white;
  opacity: 0;
}

.source-item input:checked + .source-item-card .source-item-check {
  background: var(--bg-brand);
  border-color: var(--bg-brand);
}

.source-item input:checked + .source-item-card .source-item-check svg {
  opacity: 1;
}

.source-item-icon {
  width: 28px;
  height: 28px;
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

.source-item-icon svg {
  width: 100%;
  height: 100%;
}

.source-item-info {
  flex: 1;
  min-width: 0;
}

.source-item-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-item-meta {
  display: block;
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

/* Upload More Sources Link */
.source-upload-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2-5) var(--space-4);
  margin-top: var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  color: var(--fg-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: var(--transition-colors);
}

.source-upload-link:hover {
  background: var(--interactive-hover);
  border-color: var(--border-secondary);
  color: var(--fg-primary);
}

/* Special Source Item (Exam Bank in footer) */
.source-item-special {
  /* No extra margins/borders needed - card-footer handles separation */
}

.source-item-special .source-item-label {
  display: block;
  cursor: pointer;
}

.source-item-special .source-item-label input {
  display: none;
}

.source-item-special .source-item-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.source-item-special .source-item-card:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
  border-color: rgba(99, 102, 241, 0.3);
}

.source-item-special .source-item-label input:checked + .source-item-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border-color: var(--brand);
}

.source-item-special .source-item-label input:checked + .source-item-card .source-item-check {
  background: var(--brand);
  border-color: var(--brand);
}

.source-item-special .source-item-label input:checked + .source-item-card .source-item-check svg {
  opacity: 1;
}

.source-item-icon-special {
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
  color: white !important;
  padding: 6px;
  border-radius: var(--radius-md);
  width: 32px !important;
  height: 32px !important;
}

.source-item-icon-special svg {
  width: 100%;
  height: 100%;
}

/* Exam Bank Settings inside source item */
.exam-bank-settings {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.exam-bank-settings .exam-bank-summary {
  padding: var(--space-3);
  gap: var(--space-2);
}

.radio-cards-compact {
  gap: var(--space-2) !important;
}

.radio-cards-compact .radio-card {
  padding: var(--space-2) var(--space-3) !important;
}

.radio-cards-compact .radio-card-content {
  gap: var(--space-2) !important;
  font-size: var(--text-sm) !important;
}

/* Exam Bank Summary */
.exam-bank-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.exam-bank-summary-item {
  text-align: center;
}

.exam-bank-summary-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-1);
}

.exam-bank-summary-value {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

/* Radio Cards */
.radio-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.radio-card {
  display: block;
  cursor: pointer;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  background: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast);
  text-align: center;
}

.radio-card-content:hover {
  border-color: var(--border-secondary);
}

.radio-card input:checked + .radio-card-content {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
}

.radio-card-content svg {
  color: var(--fg-tertiary);
}

.radio-card input:checked + .radio-card-content svg {
  color: var(--fg-brand);
}

.radio-card-content span {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

/* Preview Grid */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.preview-item {
  text-align: center;
  padding: var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.preview-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-1);
}

.preview-value {
  display: block;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
}

/* Sticky Footer */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-primary);
  padding: var(--space-4) var(--space-6);
  z-index: var(--z-sticky);
}

.sticky-footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Button Large */
.btn-lg {
  padding: var(--space-3-5) var(--space-7);
  font-size: var(--text-base);
}

/* Badge Info variant */
.badge-info {
  background-color: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

/* ============================================
   Quick Create Test Styles
   ============================================ */

/* Quick Create Form Layout */
.quick-create-form {
  max-width: 640px;
  margin: 0 auto;
}

.quick-create-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}

.quick-create-card .card-body {
  padding: var(--space-6);
}

/* Section Styles */
.quick-create-section {
  margin-bottom: 0;
}

.quick-create-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}

/* Live Question Count Display */
.question-count-live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 var(--space-3);
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
}

.question-count-live.highlight {
  animation: countPulse 0.3s ease-out;
}

@keyframes countPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); background: var(--bg-brand); color: white; }
  100% { transform: scale(1); }
}

.quick-create-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-primary);
  margin: 0;
}

.quick-create-section-title svg {
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

.quick-create-divider {
  height: 1px;
  background: var(--border-primary);
  margin: var(--space-2) 0;
}

/* Exam Bank Toggle in Quick Create */
.exam-bank-toggle-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  background: var(--bg-secondary);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  margin-top: var(--space-3);
}

.exam-bank-toggle-row .toggle-row {
  justify-content: space-between;
}

.exam-bank-toggle-row .toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.exam-bank-toggle-row .toggle-label svg {
  color: var(--fg-tertiary);
  flex-shrink: 0;
}

.exam-bank-toggle-row .toggle-hint {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin: 0;
}

/* Quick Toggle (All Sources) */
.quick-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.quick-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--bg-brand);
  cursor: pointer;
}

.quick-toggle:hover {
  color: var(--fg-primary);
}

/* Source Chips Container */
.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.source-chips-loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  color: var(--fg-tertiary);
  font-size: var(--text-sm);
}

.source-chips-empty {
  width: 100%;
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--fg-tertiary);
}

.source-chips-empty p {
  margin-bottom: var(--space-3);
}

/* Source Chip */
.source-chip {
  display: inline-flex;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.source-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-chip-content {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  transition: all var(--duration-fast);
}

.source-chip:hover .source-chip-content {
  border-color: var(--border-secondary);
  background: var(--bg-tertiary);
}

.source-chip input:checked + .source-chip-content {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
  color: var(--fg-brand);
}

.source-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-tertiary);
}

.source-chip input:checked + .source-chip-content .source-chip-icon {
  color: var(--fg-brand);
}

.source-chip-name {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Add Source Chip */
.source-chip-add {
  text-decoration: none;
}

.source-chip-add .source-chip-content {
  border-style: dashed;
  color: var(--fg-tertiary);
}

.source-chip-add:hover .source-chip-content {
  border-color: var(--fg-brand);
  color: var(--fg-brand);
}

/* Question Count Selector - Mobile First Grid */
.question-count-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.count-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}

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

.count-btn:active {
  transform: scale(0.97);
}

.count-btn.active {
  background: var(--fg-primary);
  border-color: var(--fg-primary);
  color: var(--bg-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.count-custom {
  grid-column: span 1;
}

.count-custom input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
  text-align: center;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

/* Hide number input spinners */
.count-custom input::-webkit-outer-spin-button,
.count-custom input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.count-custom input:focus {
  outline: none;
  border-color: var(--bg-brand);
  box-shadow: 0 0 0 3px var(--bg-brand-subtle);
}

.count-custom input::placeholder {
  color: var(--fg-tertiary);
  font-weight: var(--font-normal);
}

/* Desktop: Single row with all items */
@media (min-width: 480px) {
  .question-count-selector {
    grid-template-columns: repeat(5, 1fr) minmax(70px, 1fr);
  }
}

/* Create Test Sticky Footer */
.create-test-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-primary);
  padding: var(--space-3) var(--space-4);
  z-index: var(--z-sticky);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.create-test-footer-content {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.create-test-footer-info {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.footer-question-count {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--fg-brand);
  line-height: 1;
}

.footer-question-label {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.footer-custom-badge {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  margin-left: var(--space-1);
  vertical-align: middle;
}

.create-test-footer .btn {
  flex-shrink: 0;
  gap: var(--space-2);
}

/* Add padding to page content for sticky footer */
.quick-create-form {
  padding-bottom: 100px;
}

.btn-xl {
  height: 56px;
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

/* Customize Section (Collapsible) */
.customize-section {
  margin-top: var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.customize-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  cursor: pointer;
  list-style: none;
  transition: all var(--duration-fast);
}

.customize-toggle::-webkit-details-marker {
  display: none;
}

.customize-toggle:hover {
  color: var(--fg-primary);
  background: var(--bg-secondary);
}

.customize-toggle svg {
  color: var(--fg-tertiary);
}

.customize-toggle .chevron {
  margin-left: auto;
  transition: transform var(--duration-fast);
}

.customize-section[open] .customize-toggle .chevron {
  transform: rotate(180deg);
}

.customize-content {
  padding: 0 var(--space-5) var(--space-5);
  border-top: 1px solid var(--border-primary);
}

.customize-group {
  margin-top: var(--space-6);
}

.customize-group:first-child {
  margin-top: var(--space-5);
}

.customize-group .form-label {
  display: block;
  margin-bottom: var(--space-3);
}

.customize-group .textarea {
  border-radius: var(--radius-lg);
}

/* Difficulty Chips */
.difficulty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip-radio {
  cursor: pointer;
}

.chip-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  transition: all var(--duration-fast);
}

.chip:hover {
  border-color: var(--border-secondary);
}

.chip-radio input:checked + .chip.easy {
  background: var(--bg-success-subtle);
  border-color: var(--color-success-400);
  color: var(--fg-success);
}

.chip-radio input:checked + .chip.medium {
  background: var(--bg-warning-subtle);
  border-color: var(--color-warning-400);
  color: var(--fg-warning);
}

.chip-radio input:checked + .chip.hard {
  background: var(--bg-error-subtle);
  border-color: var(--color-error-400);
  color: var(--fg-error);
}

.chip-radio input:checked + .chip.mixed {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
  color: var(--fg-brand);
}

/* Question Type Chips (Compact) */
.question-types-compact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.type-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.type-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-chip:hover {
  border-color: var(--border-secondary);
}

.type-chip.active {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
}

.type-chip-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
}

.type-chip.active .type-chip-label {
  color: var(--fg-brand);
}

.type-chip-count {
  width: 40px;
  height: 28px;
  padding: 0 var(--space-2);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-align: center;
  color: var(--fg-primary);
}

.type-chip-count:focus {
  outline: none;
  border-color: var(--bg-brand);
}

.type-chip.active .type-chip-count {
  background: var(--bg-primary);
  border-color: var(--bg-brand);
}

/* Toggle Row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  cursor: pointer;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-primary);
}

.toggle-label svg {
  color: var(--fg-tertiary);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  transition: all var(--duration-fast);
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-fast);
}

.toggle-input:checked + .toggle-switch {
  background: var(--bg-brand);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

.toggle-hint {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: var(--space-2);
  margin-left: 0;
}

/* Quick Create Mobile Responsive */
@media (max-width: 639px) {
  .quick-create-card .card-body {
    padding: 0 var(--space-3) var(--space-3);
  }

  .quick-create-section-header {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Source chips compact on mobile */
  .source-chip-content {
    padding: var(--space-1-5) var(--space-2-5);
    font-size: var(--text-sm);
    gap: var(--space-1);
  }

  .source-chip-icon svg {
    width: 14px;
    height: 14px;
  }

  .source-chip-name {
    max-width: 80px;
  }

  /* Hide live count on mobile - buttons already show selection */
  .question-count-live {
    display: none;
  }

  /* Grid already handles 3-column mobile layout */
  .question-count-selector {
    gap: var(--space-2);
  }

  .count-btn {
    height: 44px;
    font-size: var(--text-sm);
  }

  .count-custom input {
    height: 44px;
    font-size: var(--text-sm);
  }

  .btn-xl {
    height: 52px;
    font-size: var(--text-base);
  }

  .customize-content {
    padding: 0 var(--space-3) var(--space-3);
  }

  .question-types-grid {
    grid-template-columns: 1fr;
  }

  .type-chip-full .type-chip-content {
    padding: var(--space-2-5) var(--space-3);
  }

  .type-chip-full .type-chip-count {
    width: 44px;
    height: 30px;
  }

  .exam-bank-group {
    padding: var(--space-3);
  }

  .exam-bank-toggle-row {
    padding: var(--space-2) var(--space-3);
  }

  .scope-content {
    padding: var(--space-2-5) var(--space-3);
  }

  /* Sticky Footer Mobile */
  .create-test-footer {
    padding: var(--space-3);
  }

  .create-test-footer-content {
    gap: var(--space-3);
  }

  .footer-question-count {
    font-size: var(--text-xl);
  }

  .create-test-footer .btn {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
  }
}

/* Custom Checkbox for All Sources */
.custom-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--bg-primary);
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
  flex-shrink: 0;
}

.checkbox-box svg {
  width: 14px;
  height: 14px;
  color: var(--fg-on-brand);
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration-fast);
}

.custom-checkbox input:checked + .checkbox-box {
  background: var(--bg-brand);
  border-color: var(--bg-brand);
}

.custom-checkbox input:checked + .checkbox-box svg {
  opacity: 1;
  transform: scale(1);
}

.custom-checkbox:hover .checkbox-box {
  border-color: var(--bg-brand);
}

.checkbox-label {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  font-weight: var(--font-medium);
}

.custom-checkbox:hover .checkbox-label {
  color: var(--fg-primary);
}

/* Full Radius Button */
.btn-full-radius {
  border-radius: var(--radius-full) !important;
}

/* Question Types Grid (Full Names) */
.question-types-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.type-chip-full {
  display: flex;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.type-chip-full input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-chip-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast);
}

.type-chip-full:hover .type-chip-content {
  border-color: var(--border-secondary);
}

.type-chip-full.active .type-chip-content {
  background: var(--bg-brand-subtle);
  border-color: var(--bg-brand);
}

.type-chip-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
}

.type-chip-full.active .type-chip-name {
  color: var(--fg-brand);
}

.type-chip-full .type-chip-count {
  width: 48px;
  height: 32px;
  padding: 0 var(--space-2);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-align: center;
  color: var(--fg-primary);
}

.type-chip-full .type-chip-count:focus {
  outline: none;
  border-color: var(--bg-brand);
}

.type-chip-full.active .type-chip-count {
  border-color: var(--bg-brand);
}

/* Exam Bank Options */
.exam-bank-group {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  margin-top: var(--space-5);
}

.exam-bank-header {
  margin-bottom: 0;
}

/* ==========================================
 * AI GRADING BANNER
 * For test review page when AI grading is pending
 * ========================================== */

.ai-grading-banner {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-warning-subtle);
  border: 1px solid var(--border-warning);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  animation: fadeIn 0.3s ease-out;
}

.ai-grading-banner.ai-grading-complete {
  background: var(--bg-success-subtle);
  border-color: var(--border-success);
}

.ai-grading-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.ai-grading-complete .ai-grading-content {
  color: var(--fg-success);
}

.ai-grading-complete .ai-grading-content svg {
  color: var(--fg-success);
}

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

/* ==========================================
 * ESSAY LIMIT WARNING TOAST
 * ========================================== */

.essay-limit-warning {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-warning-subtle, #fef3c7);
  border: 1px solid var(--border-warning, #f59e0b);
  color: var(--fg-warning, #92400e);
  padding: 12px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  animation: slideUp 0.3s ease-out;
}

.essay-limit-warning svg {
  flex-shrink: 0;
  color: var(--fg-warning, #f59e0b);
}

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

/* ==========================================
 * DISCOVER PAGE
 * Subject overview with feature discovery
 * ========================================== */

/* Section Headers */
.discover-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.discover-section-header h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0;
}

.discover-section-header p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: var(--space-1) 0 0 0;
}

/* Welcome Section */
.discover-welcome {
  margin-bottom: var(--space-8);
}

.discover-welcome-card {
  background: linear-gradient(135deg, var(--brand, #6366f1) 0%, #8b5cf6 100%);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  color: white;
  text-align: center;
}

.discover-welcome-icon {
  font-size: 64px;
  margin-bottom: var(--space-4);
}

.discover-welcome-content h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0 0 var(--space-3) 0;
}

.discover-welcome-content p {
  font-size: var(--text-base);
  opacity: 0.9;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

.discover-welcome-cta {
  margin-top: var(--space-6);
}

.discover-welcome-cta .btn {
  background: white;
  color: var(--brand, #6366f1);
  font-weight: 600;
}

.discover-welcome-cta .btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

/* Quick Stats */
.discover-stats {
  margin-bottom: var(--space-8);
}

.discover-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (min-width: 900px) {
  .discover-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.discover-stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 120px;
}

.discover-stat-card.discover-stat-primary {
  background: linear-gradient(135deg, var(--brand, #6366f1) 0%, #8b5cf6 100%);
  border: none;
  color: white;
  grid-column: span 2;
}

@media (min-width: 768px) {
  .discover-stat-card.discover-stat-primary {
    grid-column: span 1;
  }
}

.discover-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discover-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-brand-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.discover-stat-primary .discover-stat-icon {
  background: rgba(255, 255, 255, 0.2);
}

.discover-stat-icon svg {
  width: 20px;
  height: 20px;
  color: var(--fg-brand);
}

.discover-stat-primary .discover-stat-icon svg {
  color: white;
}

.discover-stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--fg-primary);
}

.discover-stat-primary .discover-stat-value {
  color: white;
}

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

.discover-stat-primary .discover-stat-label {
  color: rgba(255, 255, 255, 0.8);
}

.discover-stat-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.discover-stat-progress-bar {
  height: 100%;
  background: white;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Getting Started */
.discover-getting-started {
  margin-bottom: var(--space-8);
}

.discover-getting-started-container {
  background: url('../bg/bgmesh-1 Large.jpeg') center/cover no-repeat;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  padding: var(--space-6);
}

.discover-getting-started-container .discover-section-header {
  margin-bottom: var(--space-2);
}

.discover-getting-started-container .discover-section-title {
  color: #ffffff;
}

.discover-getting-started-container .discover-section-subtitle {
  color: #ffffff;
}

.discover-progress-badge {
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
}

.discover-progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.discover-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand, #6366f1) 0%, #8b5cf6 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.discover-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.discover-step {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  transition: all 0.2s ease;
}

.discover-step.active {
  border-color: var(--brand, #6366f1);
  box-shadow: 0 0 0 3px var(--bg-brand-subtle);
}

/* Shimmer animation for active step CTA button */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.discover-step.active .discover-step-action .btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    var(--brand, #6366f1) 0%,
    var(--brand, #6366f1) 40%,
    #818cf8 50%,
    var(--brand, #6366f1) 60%,
    var(--brand, #6366f1) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

.discover-step.complete {
  border-color: var(--fg-success);
  background: var(--bg-success-subtle);
}

.discover-step.locked {
  opacity: 0.5;
}

.discover-step.processing {
  border-color: var(--fg-warning);
}

.discover-step-indicator {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--fg-secondary);
}

.discover-step.active .discover-step-indicator {
  background: var(--bg-brand-subtle);
  color: var(--fg-brand);
}

.discover-step.complete .discover-step-indicator {
  background: var(--fg-success);
  color: white;
}

.discover-step.complete .discover-step-indicator svg {
  width: 22px;
  height: 22px;
}

.discover-step.processing .discover-step-indicator {
  background: var(--bg-warning-subtle);
}

.discover-step-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-primary);
  border-top-color: var(--fg-warning);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.discover-step-content {
  flex: 1;
  min-width: 0;
}

.discover-step-title {
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: 2px;
}

.discover-step-desc {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.discover-step-action {
  flex-shrink: 0;
}

/* Feature Discovery */
.discover-features {
  margin-bottom: var(--space-8);
}

.discover-features-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  padding: var(--space-6);
}

.discover-features-container .discover-section-header {
  margin-bottom: var(--space-3);
}

.discover-features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .discover-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .discover-features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.discover-feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
}

.discover-feature-card:hover {
  border-color: var(--brand, #6366f1);
  box-shadow: var(--shadow-md);
}

.discover-feature-card.locked {
  opacity: 0.6;
}

.discover-feature-card.locked:hover {
  border-color: var(--border-primary);
  box-shadow: none;
}

.discover-feature-card.used {
  border-color: var(--fg-success);
}

.discover-feature-image {
  height: 120px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.discover-feature-image img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.discover-feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  bottom: -24px;
  left: var(--space-4);
  border: 2px solid var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.discover-feature-icon svg {
  width: 24px;
  height: 24px;
  color: var(--fg-brand);
}

.discover-feature-content {
  padding: var(--space-6) var(--space-4) var(--space-4);
}

.discover-feature-content h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0 0 var(--space-2) 0;
}

.discover-feature-content p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
  line-height: 1.5;
}

.discover-feature-footer {
  padding: 0 var(--space-4) var(--space-4);
}

.discover-feature-locked {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

/* Dashboard Content Wrapper - limits max width */
.dashboard-content-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.dashboard-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  width: 100%;
  min-width: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.dashboard-card-wide {
  width: 100%;
  margin-bottom: var(--space-6);
  overflow: visible;
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
}

.dashboard-card-header h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0;
}

.dashboard-card-actions select {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  background: var(--bg-secondary);
}

.dashboard-card-body {
  padding: var(--space-5);
  padding-top: calc(var(--space-5) + 50px);
  margin-top: -50px;
  overflow: visible;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Progress Tracking */
.progress-tracking-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: var(--space-4);
  height: 100%;
}

.progress-stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
}

.progress-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-brand-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.progress-stat-icon svg {
  width: 20px;
  height: 20px;
  color: var(--fg-brand);
}

.progress-stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--fg-primary);
}

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

/* Test Performance */
.test-performance-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-primary);
}

.test-performance-main {
  text-align: left;
}

.test-performance-avg {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--fg-primary);
}

.test-performance-label {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
  margin-bottom: var(--space-1);
}

.test-performance-change {
  font-size: var(--text-sm);
  font-weight: 500;
}

.test-performance-change.positive {
  color: var(--fg-success);
}

.test-performance-change.negative {
  color: var(--fg-error);
}

.test-performance-minmax {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.test-performance-stat {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.test-performance-stat .label {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

.test-performance-stat .value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-primary);
}

.test-performance-stat .value.success {
  color: var(--fg-success);
}

.test-performance-stat .value.error {
  color: var(--fg-error);
}

.test-performance-types {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.test-performance-type {
  display: grid;
  grid-template-columns: 100px 1fr 40px;
  align-items: center;
  gap: var(--space-3);
}

.type-label {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.type-bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.type-fill {
  height: 100%;
  background: var(--fg-brand);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.type-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-primary);
  text-align: right;
}

/* Score Trend Chart */
.score-trend-chart {
  position: relative;
  display: grid;
  grid-template-columns: 45px 1fr;
  grid-template-rows: 1fr 30px;
  gap: 8px;
  height: 220px;
  padding: 50px 10px 10px 0;
  margin-top: -40px;
  width: 100%;
  min-width: 0;
}

.trend-y-axis {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  padding-right: 8px;
}

.trend-y-axis span {
  position: absolute;
  right: 8px;
  transform: translateY(50%);
}

.trend-chart-area {
  grid-row: 1;
  grid-column: 2;
  position: relative;
  border-radius: var(--radius-md);
}

.trend-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-primary);
}

.trend-area-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.02) 100%);
}

.trend-line-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.trend-data-point {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  cursor: pointer;
}

.trend-point-dot {
  width: 10px;
  height: 10px;
  background: var(--fg-brand);
  border: 2px solid var(--bg-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.trend-data-point:hover .trend-point-dot {
  transform: scale(1.3);
}

/* Trend Point Tooltip */
.trend-point-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-neutral-900);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trend-point-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-neutral-900);
}

.trend-point-tooltip strong {
  font-size: var(--text-xs);
  font-weight: 600;
  color: white;
}

.trend-point-tooltip span {
  font-size: var(--text-xs);
  color: var(--color-neutral-300);
}

.trend-tooltip-date {
  color: var(--color-neutral-400);
}

.trend-data-point:hover .trend-point-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Trend tooltip edge alignment */
.trend-point-tooltip.align-left::after {
  left: 20px;
}

.trend-point-tooltip.align-right::after {
  left: auto;
  right: 20px;
}

.trend-x-axis {
  grid-row: 2;
  grid-column: 2;
  position: relative;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.trend-x-axis span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Test Performance Chart */
.test-performance-chart {
  display: flex;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow: visible;
  padding-top: 50px;
  margin-top: -50px;
}

.test-performance-chart .chart-y-axis {
  flex: 0 0 40px;
  position: relative;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  height: 180px;
}

.test-performance-chart .chart-y-axis span {
  position: absolute;
  right: 8px;
  transform: translateY(50%);
}

.chart-scrollable {
  flex: 1;
  overflow-x: auto;
  overflow-y: visible;
  padding-top: 50px;
  margin-top: -50px;
}

.chart-inner {
  min-width: 100%;
  display: inline-block;
  overflow: visible;
}

.chart-area {
  display: grid;
  grid-template-rows: 1fr;
  grid-template-columns: 1fr;
  height: 180px;
  overflow: visible;
  min-width: 100%;
  width: max-content;
}

.chart-grid {
  grid-row: 1;
  grid-column: 1;
  position: relative;
}

.chart-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-primary);
}

.chart-bars {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 16px;
  overflow: visible;
}

.chart-bar-group {
  flex: 0 0 auto;
  width: 50px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-decoration: none;
  position: relative;
}

.chart-bar {
  width: 100%;
  background: var(--fg-brand);
  border-radius: 4px 4px 0 0;
  transition: opacity 0.15s ease;
  min-height: 4px;
  position: relative;
}

.chart-bar.success {
  background: var(--bg-success);
}

.chart-bar.good {
  background: var(--bg-brand);
}

.chart-bar.warning {
  background: var(--bg-warning);
}

.chart-bar.danger {
  background: var(--bg-error);
}

.chart-bar-group:hover .chart-bar {
  opacity: 0.85;
}

/* Bar Tooltip */
.chart-bar-tooltip {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -100%) translateY(-8px);
  background: var(--color-neutral-900);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 100;
  pointer-events: none;
}

.chart-bar-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-neutral-900);
}

.chart-bar-tooltip strong {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

.chart-bar-tooltip span {
  font-size: var(--text-xs);
  color: var(--color-neutral-300);
}

.chart-bar-group:hover .chart-bar-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Tooltip edge alignment */
.chart-bar-tooltip.align-left::after {
  left: 20px;
}

.chart-bar-tooltip.align-right::after {
  left: auto;
  right: 20px;
}

.chart-labels {
  display: flex;
  gap: 8px;
  padding: 8px 16px 0;
}

.chart-label {
  flex: 1;
  min-width: 40px;
  max-width: 60px;
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-score-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.chart-score-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--fg-brand);
}

.legend-color.success {
  background: var(--bg-success);
}

.legend-color.warning {
  background: var(--bg-warning);
}

.legend-color.danger {
  background: var(--bg-error);
}

/* Analytics Chart Legend */
.analytics-chart-legend {
  display: flex;
  gap: var(--space-3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-brand);
}

.legend-dot.success {
  background: var(--bg-success);
}

.legend-dot.good {
  background: var(--bg-brand);
}

.legend-dot.warning {
  background: var(--bg-warning);
}

.legend-dot.danger {
  background: var(--bg-error);
}

/* Dashboard Empty State */
.dashboard-empty-state {
  text-align: center;
  padding: var(--space-8);
  color: var(--fg-secondary);
}

.dashboard-empty-state img {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4) auto;
  opacity: 1;
}

.dashboard-empty-state p {
  margin-bottom: var(--space-4);
}

/* Topic Mastery */
.topic-mastery-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.topic-mastery-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.topic-mastery-info {
  flex: 0 0 140px;
}

.topic-mastery-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-primary);
}

.topic-mastery-questions {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.topic-mastery-bar-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topic-mastery-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.topic-mastery-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.topic-mastery-fill.high {
  background: var(--fg-success);
}

.topic-mastery-fill.medium {
  background: var(--fg-warning);
}

.topic-mastery-fill.low {
  background: var(--fg-error);
}

.topic-mastery-value {
  flex: 0 0 40px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-primary);
  text-align: right;
}

/* Focus Areas (replaces Topic Mastery) */
.focus-icon {
  width: 20px;
  height: 20px;
  margin-right: var(--space-2);
  color: var(--fg-brand);
}

.focus-areas-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.focus-area-item {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--fg-warning);
  transition: all 0.15s ease;
}

.focus-area-item:hover {
  background: var(--bg-tertiary);
}

.focus-area-item.critical {
  border-left-color: var(--fg-error);
}

.focus-area-item.warning {
  border-left-color: var(--fg-warning);
}

.focus-area-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.focus-area-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-warning);
}

.focus-area-indicator.critical {
  background: var(--fg-error);
}

.focus-area-indicator.warning {
  background: var(--fg-warning);
}

.focus-area-indicator.moderate {
  background: var(--fg-brand);
}

.focus-area-name {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-primary);
}

.focus-area-score {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--fg-secondary);
}

.focus-area-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: calc(8px + var(--space-2));
}

.focus-area-questions {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.focus-area-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-brand);
  text-decoration: none;
  transition: all 0.15s ease;
}

.focus-area-cta:hover {
  color: var(--fg-brand-hover);
}

.focus-area-cta svg {
  width: 14px;
  height: 14px;
}

.focus-areas-tip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--bg-brand-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--fg-brand);
}

.focus-areas-tip svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Focus Mastered State */
.focus-mastered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.focus-mastered-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-success-subtle);
  border-radius: 50%;
  margin-bottom: var(--space-3);
}

.focus-mastered-icon svg {
  width: 24px;
  height: 24px;
  color: var(--fg-success);
}

.focus-mastered-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.focus-mastered-text {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

/* Study Progress (Prep Plan Overview) */
.study-progress-icon {
  width: 20px;
  height: 20px;
  margin-right: var(--space-2);
  color: var(--fg-brand);
}

.study-progress-days {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-warning-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-warning);
  margin-bottom: var(--space-4);
}

.study-progress-days svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.study-progress-overview {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.study-progress-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.study-progress-percent {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--fg-primary);
  line-height: 1;
}

.study-progress-label {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.study-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-1);
}

.study-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bg-brand) 0%, var(--fg-brand) 100%);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.study-progress-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-primary);
}

.study-progress-breakdown-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.study-progress-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.study-progress-item-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.study-progress-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.study-progress-item-dot.must-master {
  background: var(--fg-error);
}

.study-progress-item-dot.should-know {
  background: var(--fg-warning);
}

.study-progress-item-dot.quick-review {
  background: var(--fg-success);
}

.study-progress-item-name {
  font-size: var(--text-sm);
  color: var(--fg-primary);
}

.study-progress-item-stats {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.study-progress-item-count {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.study-progress-item-percent {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-secondary);
  min-width: 40px;
  text-align: right;
}

.study-progress-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--bg-brand);
  color: white;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.study-progress-cta:hover {
  background: var(--fg-brand-hover);
  color: white;
}

.study-progress-cta svg {
  width: 16px;
  height: 16px;
}

/* Study Progress - Additional styles used in JS */
.study-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bg-brand) 0%, var(--fg-brand) 100%);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.study-progress-bar-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.study-progress-stats {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
}

.study-progress-priorities {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-4);
  margin-top: var(--space-4);
  border-top: 1px solid var(--border-primary);
}

.study-priority-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

.priority-badge.must-master {
  background: var(--bg-error-subtle);
  color: var(--fg-error);
}

.priority-badge.should-know {
  background: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.priority-badge.quick-review {
  background: var(--bg-success-subtle);
  color: var(--fg-success);
}

/* Hide priority dot inside priority-badge */
.priority-badge .priority-dot {
  display: none;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--space-2);
  flex-shrink: 0;
}

/* Dot-only badge (no text) */
.priority-badge > .priority-dot:only-child {
  margin-right: 0;
}

.priority-badge.must-master .priority-dot {
  background: var(--fg-error);
}

.priority-badge.should-know .priority-dot {
  background: var(--fg-warning);
}

.priority-badge.quick-review .priority-dot {
  background: var(--fg-success);
}

.priority-badge.skip {
  background: rgba(148, 163, 184, 0.15);
  color: var(--fg-tertiary);
}

.priority-badge.skip .priority-dot {
  background: var(--fg-tertiary);
}

.priority-progress {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-secondary);
}

.study-progress-days.urgent {
  background: var(--bg-error-subtle);
  color: var(--fg-error);
}

/* Study Progress Empty State */
.study-progress-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.study-progress-empty-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 50%;
  margin-bottom: var(--space-3);
}

.study-progress-empty-icon svg {
  width: 24px;
  height: 24px;
  color: var(--fg-tertiary);
}

.study-progress-empty-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: var(--space-1);
}

.study-progress-empty-text {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin-bottom: var(--space-4);
}

/* Sidebar Feature Slider */
.sidebar-feature-slider {
  padding: var(--space-4) 0 0;
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.sidebar-slider-wrapper {
  overflow: hidden;
}

.sidebar-slider-track {
  display: flex;
  transition: transform 0.3s ease;
}

.sidebar-feature-card {
  flex: 0 0 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-feature-card:hover:not(.locked) {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.sidebar-feature-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.sidebar-feature-content {
  padding: var(--space-3) var(--space-4);
  padding-right: var(--space-8);
}

.sidebar-feature-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: 2px;
}

.sidebar-feature-desc {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  line-height: 1.4;
}

.sidebar-feature-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}

.sidebar-feature-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  opacity: 1;
}

.sidebar-feature-image svg {
  width: 32px;
  height: 32px;
  color: var(--fg-tertiary);
}

.sidebar-feature-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  z-index: 1;
}

.sidebar-feature-close:hover {
  background: rgba(0, 0, 0, 0.7);
  color: white;
}

.sidebar-feature-close svg {
  width: 12px;
  height: 12px;
}

.sidebar-feature-close-wrapper {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 10;
}

.sidebar-feature-close-wrapper .sidebar-feature-close {
  position: static;
}

.sidebar-feature-close-menu {
  display: none;
  position: fixed;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-width: 140px;
  z-index: 9999;
}

.sidebar-feature-close-menu.active {
  display: block;
}

.sidebar-feature-close-menu button {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  text-align: left;
  font-size: var(--text-sm);
  color: var(--fg-primary);
  cursor: pointer;
  transition: background 0.15s ease;
}

.sidebar-feature-close-menu button:hover {
  background: var(--interactive-hover);
}

.sidebar-feature-close-menu button:not(:last-child) {
  border-bottom: 1px solid var(--border-primary);
}

.sidebar-slider-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.sidebar-slider-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  background: var(--border-primary);
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-slider-dot:hover {
  background: var(--fg-tertiary);
}

.sidebar-slider-dot.active {
  background: var(--fg-brand);
  width: 16px;
  border-radius: 3px;
}

/* Remove border from back link */
.subject-sidebar-back {
  border-top: none;
}

/* Hide slider on mobile when sidebar is hidden */
@media (max-width: 1023px) {
  .sidebar-feature-slider {
    display: none;
  }

  .subject-sidebar.active .sidebar-feature-slider {
    display: block;
  }
}

/* Recent Activity */
.discover-activity {
  margin-bottom: var(--space-8);
}

.discover-activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.discover-activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all 0.2s ease;
}

.discover-activity-item:hover {
  border-color: var(--brand, #6366f1);
  background: var(--bg-secondary);
}

.discover-activity-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.discover-activity-icon.success {
  background: var(--bg-success-subtle);
  color: var(--fg-success);
}

.discover-activity-icon.warning {
  background: var(--bg-warning-subtle);
  color: var(--fg-warning);
}

.discover-activity-icon.error {
  background: var(--bg-error-subtle);
  color: var(--fg-error);
}

.discover-activity-icon svg {
  width: 20px;
  height: 20px;
}

.discover-activity-info {
  flex: 1;
  min-width: 0;
}

.discover-activity-title {
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-activity-meta {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.discover-activity-score {
  flex-shrink: 0;
}

/* Tips Carousel */
.discover-tips {
  margin-bottom: var(--space-8);
}

.discover-tips-carousel {
  position: relative;
  overflow: hidden;
}

.discover-tip-card {
  display: none;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
}

.discover-tip-card.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.discover-tip-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.discover-tip-content h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0 0 var(--space-2) 0;
}

.discover-tip-content p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
  line-height: 1.5;
}

.discover-tips-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.discover-tip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-primary);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.discover-tip-dot.active {
  background: var(--brand, #6366f1);
  width: 24px;
  border-radius: 4px;
}

.discover-tip-dot:hover {
  background: var(--fg-secondary);
}

/* Mobile Responsive */
@media (max-width: 639px) {
  .discover-welcome-card {
    padding: var(--space-6);
  }

  .discover-welcome-icon {
    font-size: 48px;
  }

  .discover-welcome-content h2 {
    font-size: var(--text-xl);
  }

  .discover-stat-card.discover-stat-primary {
    grid-column: span 1;
  }

  .discover-step {
    flex-wrap: wrap;
  }

  .discover-step-content {
    flex: 1 1 calc(100% - 60px);
  }

  .discover-step-action {
    width: 100%;
    margin-top: var(--space-2);
  }

  .discover-step-action .btn {
    width: 100%;
  }

  .discover-features-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
 * GLOBAL MOBILE ENHANCEMENTS
 * Additional compact styles for mobile
 * ========================================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  /* Page containers */
  .page-container,
  .practice-hub-container,
  .sources-container,
  .analytics-container {
    padding: var(--space-5);
  }

  /* Dashboard grid */
  .dashboard-grid {
    gap: var(--space-5);
  }

  /* Section margins */
  .section-margin {
    margin-bottom: var(--space-6);
  }
}

/* Mobile (<768px) */
@media (max-width: 767px) {
  /* Page containers - tighter padding */
  .page-container,
  .practice-hub-container,
  .sources-container,
  .analytics-container {
    padding: var(--space-4);
  }

  /* Dashboard grid - compact */
  .dashboard-grid {
    gap: var(--space-4);
  }

  /* Section headers - compact */
  .section-header h2,
  .dashboard-card-header h3,
  .discover-section-title {
    font-size: var(--text-lg);
  }

  /* Card bodies - less padding (preserve padding-top calculation) */
  .dashboard-card-body {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    padding-bottom: var(--space-4);
  }

  /* Stats grid - 2 columns on mobile */
  .discover-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  /* Stat cards - compact */
  .discover-stat-card {
    padding: var(--space-3);
  }

  .discover-stat-value {
    font-size: var(--text-2xl);
  }

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

  /* Progress tracking - compact */
  .progress-stat-card {
    padding: var(--space-3);
  }

  .progress-stat-value {
    font-size: var(--text-xl);
  }

  /* Getting started steps - compact */
  .discover-step {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  .discover-step-indicator {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
  }

  .discover-step-title {
    font-size: var(--text-sm);
  }

  .discover-step-desc {
    font-size: var(--text-xs);
  }

  /* Empty States - compact */
  .empty-state {
    padding: var(--space-6);
  }

  .empty-state-icon {
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-2);
  }

  .empty-state-title {
    font-size: var(--text-xl);
  }

  .empty-state-text {
    font-size: var(--text-sm);
    margin-bottom: var(--space-8);
  }

  .empty-state-actions {
    gap: var(--space-2);
  }

  .empty-state-formats {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
  }

  .empty-state-formats-label {
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
  }

  .format-badge {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }

  .empty-state-how {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
  }

  .empty-state-how-title {
    font-size: var(--text-lg);
    margin-bottom: var(--space-4);
  }

  .empty-state-how-grid {
    gap: var(--space-4);
  }

  .empty-state-how-item img {
    width: 36px;
    height: 36px;
  }

  .empty-state-how-item h4 {
    font-size: var(--text-sm);
  }

  .empty-state-how-item p {
    font-size: var(--text-xs);
  }

  /* Dashboard empty state */
  .dashboard-empty-state {
    padding: var(--space-5);
  }

  .dashboard-empty-state img {
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-3);
  }

  .dashboard-empty-state p {
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
  }

  /* Source list empty */
  .source-list-empty {
    padding: var(--space-5);
  }

  .source-list-empty p {
    font-size: var(--text-sm);
  }

  /* Source chips empty */
  .source-chips-empty {
    padding: var(--space-4);
  }

  .source-chips-empty p {
    font-size: var(--text-sm);
  }
}

/* Small Mobile (<480px) */
@media (max-width: 479px) {
  /* Page containers - minimal padding */
  .page-container,
  .practice-hub-container,
  .sources-container,
  .analytics-container {
    padding: var(--space-3);
  }

  /* Dashboard grid - tighter */
  .dashboard-grid {
    gap: var(--space-3);
  }

  /* Card headers */
  .dashboard-card-header {
    padding: var(--space-3);
  }

  .dashboard-card-header h3 {
    font-size: var(--text-base);
  }

  /* Buttons - full width on small mobile */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
  }

  /* Empty States - compact but readable */
  .empty-state {
    padding: var(--space-5);
  }

  .empty-state-icon {
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-2);
  }

  .empty-state-title {
    font-size: var(--text-lg);
  }

  .empty-state-text {
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
  }

  .empty-state-actions {
    flex-direction: column;
    width: 100%;
  }

  .empty-state-actions .btn {
    width: 100%;
  }

  .empty-state-formats {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
  }

  .empty-state-how {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
  }

  .empty-state-how-title {
    font-size: var(--text-base);
  }

  .empty-state-how-grid {
    grid-template-columns: 1fr;
  }

  .empty-state-how-item img {
    width: 36px;
    height: 36px;
  }

  .dashboard-empty-state {
    padding: var(--space-4);
  }

  .dashboard-empty-state img {
    width: 48px;
    height: 48px;
  }

  .source-list-empty {
    padding: var(--space-4);
  }
}

/* ==========================================
 * SUBSCRIPTION & PRICING
 * ========================================== */

/* Upgrade Nav Button */
.upgrade-nav-btn {
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: url('../bg/bgmesh-premium.jpeg') center/cover !important;
  color: #ffffff !important;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  border: none;
}

.upgrade-nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  color: #ffffff !important;
  text-decoration: none !important;
}

.upgrade-nav-btn:visited {
  color: #ffffff !important;
}

.upgrade-nav-btn svg {
  flex-shrink: 0;
  fill: #ffffff;
}

.upgrade-nav-btn img {
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

@media (max-width: 639px) {
  .upgrade-nav-btn {
    padding: 8px;
    font-size: 12px;
  }
}

/* Upgrade item in user dropdown - same styling as other items */
.user-dropdown-upgrade {
  /* Inherits .user-dropdown-item styling */
}

.user-dropdown-upgrade img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  /* Filter to match --fg-secondary (#64748b) color */
  filter: brightness(0) saturate(100%) invert(44%) sepia(9%) saturate(579%) hue-rotate(182deg) brightness(94%) contrast(92%);
  transition: filter var(--transition-colors);
}

.user-dropdown-upgrade:hover img {
  /* Filter to match --fg-primary (#1e293b) on hover */
  filter: brightness(0) saturate(100%) invert(12%) sepia(20%) saturate(746%) hue-rotate(182deg) brightness(96%) contrast(96%);
}

/* Plan Badge */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.plan-badge.free {
  background: var(--bg-tertiary);
  color: var(--fg-secondary);
}

.plan-badge.pro {
  background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 100%);
  color: white;
}

.plan-badge.pro svg {
  fill: currentColor;
}

.plan-badge.pro img {
  filter: brightness(0) invert(1);
}

.plan-badge.free img {
  width: 12px;
  height: 12px;
}

/* Usage Indicator */
.usage-indicator {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.usage-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.usage-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.usage-label span:first-child {
  color: var(--fg-secondary);
}

.usage-value {
  font-weight: 600;
  color: var(--fg-primary);
}

.usage-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.usage-bar-fill.warning {
  background: var(--fg-warning);
}

.usage-bar-fill.danger {
  background: var(--fg-error);
}

/* Subscription Page */
.subscription-page {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-6);
}

.subscription-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.subscription-header h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.subscription-header p {
  color: var(--fg-secondary);
  font-size: var(--text-lg);
}

/* Pricing Cards */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

.pricing-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  padding: var(--space-6);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.pricing-card.featured {
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: white;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
}

.pricing-card-header {
  margin-bottom: var(--space-4);
}

.pricing-card-name {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.pricing-card-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
}

.pricing-card-price .amount {
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--fg-primary);
}

.pricing-card-price .period {
  color: var(--fg-secondary);
  font-size: var(--text-base);
}

.pricing-card-price .savings {
  margin-left: var(--space-2);
  background: var(--bg-success-subtle);
  color: var(--fg-success);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0;
}

.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  color: var(--fg-secondary);
  font-size: var(--text-sm);
}

.pricing-features li svg {
  flex-shrink: 0;
  color: var(--fg-success);
  margin-top: 2px;
}

.pricing-features li.disabled {
  opacity: 0.5;
}

.pricing-features li.disabled svg {
  color: var(--fg-tertiary);
}

.pricing-card-action {
  margin-top: var(--space-4);
}

.pricing-card-action .btn {
  width: 100%;
}

.pricing-card-tagline {
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
  margin-top: var(--space-1);
}

.pricing-note {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--fg-tertiary);
}

/* Current Plan Badge */
.current-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--fg-secondary);
}

/* Upgrade Prompt (inline) */
.upgrade-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}

.upgrade-prompt-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.upgrade-prompt-icon {
  width: 40px;
  height: 40px;
  background: var(--brand);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.upgrade-prompt-text h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 var(--space-1) 0;
}

.upgrade-prompt-text p {
  font-size: var(--text-xs);
  color: var(--fg-secondary);
  margin: 0;
}

@media (max-width: 639px) {
  .upgrade-prompt {
    flex-direction: column;
    text-align: center;
  }

  .upgrade-prompt-content {
    flex-direction: column;
  }
}

/* ==========================================
 * BILLING SECTION (Profile Page)
 * ========================================== */

.billing-plan-section {
  margin-bottom: var(--space-6);
}

.billing-plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.billing-plan-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.billing-plan-badge .plan-badge {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
}

.billing-plan-details h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-1) 0;
}

.billing-plan-details p {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
  margin: 0;
}

.billing-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0 0 var(--space-4) 0;
  color: var(--fg-primary);
}

.billing-usage-section {
  margin-bottom: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-primary);
}

.billing-usage-grid {
  display: grid;
  gap: var(--space-4);
}

.billing-usage-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.billing-usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.billing-usage-label {
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.billing-usage-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-primary);
}

.billing-usage-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.billing-usage-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.billing-usage-fill.warning {
  background: var(--fg-warning);
}

.billing-usage-fill.danger {
  background: var(--fg-error);
}

.billing-usage-hint {
  font-size: var(--text-xs);
  color: var(--fg-tertiary);
  margin-top: var(--space-3);
}

.billing-manage-section {
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-primary);
}

.billing-manage-card {
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.billing-manage-info p {
  margin: 0 0 var(--space-4) 0;
  font-size: var(--text-sm);
  color: var(--fg-secondary);
}

.billing-manage-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Billing More Dropdown */
.billing-more-dropdown {
  position: relative;
}

.billing-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  padding: var(--space-2);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: var(--z-dropdown);
}

.billing-more-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.billing-more-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--fg-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-colors);
  white-space: nowrap;
}

.billing-more-item:hover {
  background: var(--bg-tertiary);
  color: var(--fg-primary);
}

.billing-more-item.danger {
  color: var(--fg-error);
}

.billing-more-item.danger:hover {
  background: var(--bg-error-subtle);
  color: var(--fg-error);
}

@media (max-width: 639px) {
  .billing-plan-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .billing-plan-info {
    flex-direction: column;
  }

  .billing-plan-action {
    width: 100%;
  }

  .billing-plan-action .btn {
    width: 100%;
  }

  .billing-manage-actions {
    flex-direction: column;
  }

  .billing-manage-actions .btn {
    width: 100%;
  }
}
