/* ============================================
   ClassCheck - Dark Mode Design System
   First Principles UI - Minimal, Data-focused
   ============================================ */

/* ============================================
   CSS Variables - Design Tokens
   ============================================ */

:root {
  /* Backgrounds */
  --bg-base: #212121;
  --bg-elevated: #303030;
  --bg-surface: #2a2a2a;
  --bg-hover: #3a3a3a;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #a3a3a3;
  --text-tertiary: #8a8a8a;

  /* Accent */
  --accent: #7A6BB5;
  --accent-hover: #5D4C9A;
  --accent-muted: rgba(93, 76, 154, 0.15);

  /* Grade Colors */
  --green-good: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.05);
  --yellow-mid: #eab308;
  --yellow-bg: rgba(234, 179, 8, 0.05);
  --orange-warn: #f97316;
  --orange-bg: rgba(249, 115, 22, 0.05);
  --red-bad: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.05);
  --gray-neutral: #6b7280;
  --gray-bg: rgba(107, 114, 128, 0.05);
  --blue-good: #7A6BB5;
  --blue-bg: rgba(93, 76, 154, 0.05);
  --purple-good: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.05);
  --pink-good: #6b7280;
  --pink-bg: rgba(107, 114, 128, 0.05);
  --teal-good: #14b8a6;
  --teal-bg: rgba(20, 184, 166, 0.05);
  --lime-good: #84cc16;
  --lime-bg: rgba(132, 204, 22, 0.05);
  --cyan-good: #06b6d4;
  --cyan-bg: rgba(6, 182, 212, 0.05);
  --indigo-good: #6366f1;
  --indigo-bg: rgba(99, 102, 241, 0.05);
  --rose-good: #64748b;
  --rose-bg: rgba(100, 116, 139, 0.05);
  --amber-good: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.05);
  --slate-good: #64748b;
  --slate-bg: rgba(100, 116, 139, 0.05);
  --emerald-good: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.05);
  --lightgreen-good: #4ade80;
  --lightgreen-bg: rgba(74, 222, 128, 0.06);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-default: rgba(255, 255, 255, 0.15);
  --border-strong: rgba(255, 255, 255, 0.2);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Legacy compatibility */
  --primary: #7A6BB5;
  --primary-dark: #5D4C9A;
  --secondary: #7A6BB5;
  --white: #ffffff;
  --text: #ffffff;
  --text-light: #a3a3a3;
  --gray-dark: #2a2a2a;
  --gray-light: #212121;
  --shadow: var(--shadow-sm);
}

/* Light Mode Theme */
[data-theme="light"] {
  --bg-base: #FFFEF5;
  --bg-elevated: #FFFEF5;
  --bg-surface: #FDF8F3;
  --bg-hover: #F5EFE6;

  --text-primary: #171717;
  --text-secondary: #525252;
  --text-tertiary: #6b6b6b;

  --accent: #5D4C9A;
  --accent-hover: #4A3D7A;
  --accent-muted: rgba(93, 76, 154, 0.12);

  --green-good: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.04);
  --yellow-mid: #ca8a04;
  --yellow-bg: rgba(202, 138, 4, 0.04);
  --orange-warn: #ea580c;
  --orange-bg: rgba(234, 88, 12, 0.04);
  --red-bad: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.04);
  --gray-neutral: #6b7280;
  --gray-bg: rgba(107, 114, 128, 0.04);
  --blue-good: #5D4C9A;
  --blue-bg: rgba(93, 76, 154, 0.04);
  --purple-good: #9333ea;
  --purple-bg: rgba(147, 51, 234, 0.04);
  --pink-good: #6b7280;
  --pink-bg: rgba(107, 114, 128, 0.04);
  --teal-good: #0d9488;
  --teal-bg: rgba(13, 148, 136, 0.04);
  --lime-good: #65a30d;
  --lime-bg: rgba(101, 163, 13, 0.04);
  --cyan-good: #0891b2;
  --cyan-bg: rgba(8, 145, 178, 0.04);
  --indigo-good: #4f46e5;
  --indigo-bg: rgba(79, 70, 229, 0.04);
  --rose-good: #64748b;
  --rose-bg: rgba(100, 116, 139, 0.04);
  --amber-good: #d97706;
  --amber-bg: rgba(217, 119, 6, 0.04);
  --slate-good: #475569;
  --slate-bg: rgba(71, 85, 105, 0.04);
  --emerald-good: #059669;
  --emerald-bg: rgba(5, 150, 105, 0.04);
  --lightgreen-good: #22c55e;
  --lightgreen-bg: rgba(34, 197, 94, 0.05);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-default: #E8DFD3;
  --border-strong: rgba(0, 0, 0, 0.2);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);

  --primary: #5D4C9A;
  --primary-dark: #4A3D7A;
  --white: #ffffff;
  --text: #171717;
  --text-light: #525252;
  --gray-dark: #F5EFE6;
  --gray-light: #FFFEF5;
}

/* ============================================
   Accessibility Utilities
   ============================================ */

/* Screen reader only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 500;
  z-index: 10000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 1rem;
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* Enhanced focus styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Touch target optimization for coarse pointers (touchscreens) */
@media (pointer: coarse) {
  .btn,
  .btn-sm,
  .nav-tile,
  .modal-close,
  .theme-toggle,
  .class-delete-btn,
  button,
  [role="button"],
  a[href] {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-sm {
    padding: 0.625rem 1rem;
  }
}

/* ============================================
   Base Reset & Typography
   ============================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Auth Pages
   ============================================ */

.auth-page {
  background: var(--bg-base);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.auth-card {
  background: var(--bg-elevated);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
}

.auth-card h1 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.auth-card h2 {
  text-align: center;
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

/* ============================================
   Form Elements
   ============================================ */

.form-group {
  margin-bottom: 1.25rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

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

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23737373' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-group select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: inherit;
  gap: 0.5rem;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

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

.btn-danger {
  background: var(--red-bg);
  color: var(--red-bad);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

.btn-block {
  width: 100%;
}

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

/* ============================================
   Auth Links & Trial Info
   ============================================ */

.auth-links {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
}

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

.auth-links .separator {
  color: var(--text-tertiary);
  margin: 0 0.5rem;
}

.trial-info {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-top: 1rem;
}

.help-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.verify-message {
  text-align: center;
  margin-bottom: 1.5rem;
}

.verify-message .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.verify-message p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.verify-message strong {
  color: var(--text-primary);
}

/* ============================================
   Alerts
   ============================================ */

.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--green-bg);
  color: var(--green-good);
  border-color: rgba(34, 197, 94, 0.3);
}

.alert-error {
  background: var(--red-bg);
  color: var(--red-bad);
  border-color: rgba(239, 68, 68, 0.3);
}

.alert-warning {
  background: var(--yellow-bg);
  color: var(--yellow-mid);
  border-color: rgba(234, 179, 8, 0.3);
}

.alert-info {
  background: rgba(93, 76, 154, 0.1);
  color: var(--accent, #5D4C9A);
  border-color: rgba(93, 76, 154, 0.25);
}

.alert a {
  color: inherit;
  font-weight: 600;
}

/* ============================================
   App Layout
   ============================================ */

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============================================
   Topbar Navigation
   ============================================ */

.topbar {
  background: linear-gradient(135deg, #5D4C9A 0%, #9A4C79 100%);
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ============================================
   Public Topbar – White header (ClassCards style)
   ============================================ */
.topbar.topbar-public {
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid #E8DFD3;
  padding: 1.5rem 0;
}

.topbar-public .topbar-content {
  width: min(100% - 2rem, 75rem);
  margin-inline: auto;
  padding: 0 clamp(0.75rem, 1.5vw, 1rem);
  justify-content: space-between;
  gap: clamp(0.75rem, 1.5vw, 1rem);
}

[data-theme="dark"] .topbar.topbar-public {
  background: #1a1a1e;
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* App topbar – dark violet (subject-view etc.) */
.topbar.topbar-app,
[data-theme="dark"] .topbar.topbar-app {
  background: linear-gradient(135deg, #2d1f5e 0%, #5D4C9A 100%);
  border-bottom: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 0.5rem 1rem;
}

.topbar-app .logo-word-top {
  color: #fff !important;
}

.topbar-app .logo-word-bottom {
  color: rgba(255, 255, 255, 0.7) !important;
}

.topbar-app .public-nav-link {
  color: rgba(255, 255, 255, 0.8) !important;
  font-size: 0.9375rem;
  padding: 0.5rem 0.75rem;
}

.topbar-app .public-nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.topbar-app .public-nav-link.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.topbar-app .auth-user-name {
  color: rgba(255, 255, 255, 0.7) !important;
}

.topbar-app .auth-logout-btn {
  color: rgba(255, 255, 255, 0.6) !important;
}

.topbar-app .auth-logout-btn:hover {
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.15) !important;
}

.topbar-app .class-switcher select {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.topbar-app .lang-switcher-toggle {
  border-color: rgba(255, 255, 255, 0.25);
}

.topbar-app .lang-switcher-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.topbar-app .theme-toggle,
.topbar-app.topbar-public .theme-toggle {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: white !important;
}

.topbar-app .theme-toggle:hover,
.topbar-app.topbar-public .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

.topbar-public .topbar-logo {
  gap: 0.5rem;
}

.topbar-public .logo-icon {
  width: clamp(3rem, 6vw, 3.5rem);
  height: clamp(3rem, 6vw, 3.5rem);
}

.topbar-public .logo-word-top {
  color: #1F2937;
  font-size: 1.25rem;
  font-weight: 700;
}

.topbar-public .logo-word-bottom {
  color: #5D4C9A;
  font-size: 1rem;
  font-weight: 600;
}

[data-theme="dark"] .topbar-public .logo-word-top {
  color: white;
}

[data-theme="dark"] .topbar-public .logo-word-bottom {
  color: rgba(255, 255, 255, 0.7);
}

/* Header left group (logo + nav) */
.public-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Text-based nav links (matching ClassCards .nav-link) */
.public-nav {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

.public-nav-item {
  position: relative;
}

.public-nav-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 1.25rem;
  white-space: nowrap;
  color: #1F2937;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
  border-radius: 0.5rem;
  transition: color 0.15s, background 0.15s;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.public-nav-link:hover {
  color: #5D4C9A;
  background: rgba(93, 76, 154, 0.06);
}

.public-nav-link.active {
  color: #5D4C9A;
}

[data-theme="dark"] .public-nav-link {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .public-nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .public-nav-link.active {
  color: #B0A0E0;
}

/* Dropdown chevron */
.dropdown-chevron {
  transition: transform 0.2s;
  width: 18px;
  height: 18px;
}

.has-dropdown:hover .dropdown-chevron,
.has-dropdown:focus-within .dropdown-chevron {
  transform: rotate(180deg);
}

/* Dropdown menu */
.has-dropdown {
  position: relative;
}

.public-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: white;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(93, 76, 154, 0.1);
  padding: 1rem;
  min-width: 380px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 200;
}

.has-dropdown:hover .public-dropdown-menu,
.has-dropdown:focus-within .public-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .public-dropdown-menu {
  background: #27272A;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Dropdown items */
.public-dropdown-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  text-decoration: none;
  transition: background 0.15s;
}

.public-dropdown-item:hover {
  background: linear-gradient(135deg, #F0EDF5 0%, rgba(93, 76, 154, 0.08) 100%);
}

[data-theme="dark"] .public-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.public-dropdown-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.public-dropdown-icon svg {
  width: 26px;
  height: 26px;
}

.public-dropdown-icon[data-category="teacher"] {
  background: #E0F2F1;
  color: #00897B;
}

.public-dropdown-icon[data-category="features"] {
  background: #FFF3E0;
  color: #F57C00;
}

.public-dropdown-icon[data-category="docs"] {
  background: #FCE4EC;
  color: #E91E63;
}

.public-dropdown-icon[data-category="help"] {
  background: rgba(93, 76, 154, 0.1);
  color: #5D4C9A;
}

[data-theme="dark"] .public-dropdown-icon[data-category="teacher"] {
  background: rgba(0, 137, 123, 0.15);
}

[data-theme="dark"] .public-dropdown-icon[data-category="features"] {
  background: rgba(245, 124, 0, 0.15);
}

[data-theme="dark"] .public-dropdown-icon[data-category="docs"] {
  background: rgba(233, 30, 99, 0.15);
}

[data-theme="dark"] .public-dropdown-icon[data-category="help"] {
  background: rgba(93, 76, 154, 0.2);
}

.public-dropdown-text {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  text-align: left;
}

.public-dropdown-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: #1F2937;
  line-height: 1.2;
}

.public-dropdown-desc {
  font-size: 0.9375rem;
  color: #6B7280;
  line-height: 1.4;
}

[data-theme="dark"] .public-dropdown-title {
  color: #F5F5F5;
}

[data-theme="dark"] .public-dropdown-desc {
  color: #9CA3AF;
}

/* Mobile login link (hidden on desktop) */
.mobile-login-link {
  display: none;
}

/* Right side group */
.public-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Login button (ghost style, matching ClassCards .btn-ghost) */
.public-login-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary, #4B5563);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 1.125rem;
  cursor: pointer;
  border-radius: 0.5rem;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}

.public-login-btn:hover {
  color: #5D4C9A;
  background: rgba(93, 76, 154, 0.06);
}

[data-theme="dark"] .public-login-btn {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .public-login-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

/* Authenticated header elements */
.auth-user-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #4B5563;
}

[data-theme="dark"] .auth-user-name {
  color: rgba(255, 255, 255, 0.7);
}

.auth-logout-btn {
  font-size: 0.9375rem !important;
  padding: 0.5rem 1rem !important;
  color: #6B7280 !important;
}

.auth-logout-btn:hover {
  color: #EF4444 !important;
  background: rgba(239, 68, 68, 0.06) !important;
}

.trial-badge-topbar {
  display: inline-block;
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Register CTA in header (matching ClassCards .btn-accent) */
.public-register-btn {
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

/* Login dropdown in public header */
.topbar-public .login-dropdown-content {
  min-width: 300px;
  right: 0;
  top: calc(100% + 0.5rem);
}

.topbar-public .login-dropdown-content .form-group {
  margin-bottom: 0.75rem;
}

.topbar-public .login-dropdown-content input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.topbar-public .login-dropdown-content input::placeholder {
  color: var(--text-tertiary);
}

.topbar-public .login-dropdown-content input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Public header lang/theme */
.topbar-public .lang-switch {
  background: rgba(0, 0, 0, 0.04);
}

.topbar-public .lang-switch a {
  color: var(--text-tertiary);
}

.topbar-public .lang-switch a.active {
  background: rgba(93, 76, 154, 0.1);
  color: #5D4C9A;
}

.topbar-public .lang-switch a:hover:not(.active) {
  color: var(--text-primary);
}

.topbar-public .theme-toggle {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
}

.topbar-public .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] .topbar-public .lang-switch {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .topbar-public .lang-switch a {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .topbar-public .lang-switch a.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

[data-theme="dark"] .topbar-public .theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .topbar-public .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   Hamburger Menu Component (Mobile)
   ============================================ */

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 6px;
  transition: background 0.15s;
}

.hamburger-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: #333;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* Animated X when open */
.hamburger-btn.open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Dark theme hamburger lines */
[data-theme="dark"] .hamburger-line {
  background: rgba(255, 255, 255, 0.8);
}

/* App topbar hamburger — always white lines */
.topbar-app .hamburger-line {
  background: rgba(255, 255, 255, 0.9) !important;
}

.topbar-app .hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Mobile nav panel — slide-down, hidden by default */
.mobile-nav-panel {
  display: none;
  flex-direction: column;
  background: var(--bg-elevated, #fff);
  border-bottom: 1px solid var(--border-subtle, #e5e7eb);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.mobile-nav-panel.open {
  display: flex;
  max-height: 80vh;
  padding: 0.5rem 0;
  overflow-y: auto;
}

.mobile-nav-panel a,
.mobile-nav-panel button.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  min-height: 44px;
  color: var(--text-primary, #333);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s;
}

.mobile-nav-panel a:hover,
.mobile-nav-panel button.mobile-nav-link:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.mobile-nav-panel a.active {
  color: var(--accent, #5D4C9A);
  background: rgba(93, 76, 154, 0.08);
}

.mobile-nav-panel .mobile-nav-divider {
  height: 1px;
  background: var(--border-subtle, #e5e7eb);
  margin: 0.375rem 0;
}

.mobile-nav-panel .mobile-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mobile-nav-panel .mobile-nav-footer .lang-switch {
  display: flex;
}

.mobile-nav-panel .mobile-nav-footer .theme-toggle {
  display: flex;
}

.mobile-nav-panel .mobile-nav-user {
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6b7280);
  padding: 0.25rem 1.25rem;
}

.mobile-nav-panel .mobile-nav-cta {
  display: block;
  margin: 0.25rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--accent, #5D4C9A);
  color: white !important;
  text-align: center;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.mobile-nav-panel .mobile-nav-cta:hover {
  background: var(--accent-hover, #4a3d7a) !important;
  opacity: 0.95;
}

.mobile-nav-panel .mobile-nav-cta-outline {
  background: transparent;
  color: var(--accent, #5D4C9A) !important;
  border: 2px solid var(--accent, #5D4C9A);
}

.mobile-nav-panel .mobile-nav-cta-outline:hover {
  background: var(--accent, #5D4C9A) !important;
  color: white !important;
}

.topbar-app .mobile-nav-panel .mobile-nav-cta-outline,
[data-theme="dark"] .mobile-nav-panel .mobile-nav-cta-outline {
  color: white !important;
  border-color: rgba(255, 255, 255, 0.6);
}

.mobile-nav-panel .trial-badge-topbar {
  display: inline-block;
  margin-left: 0.5rem;
}

/* App topbar mobile nav panel — dark violet */
.topbar-app + .mobile-nav-panel,
.topbar-app .mobile-nav-panel {
  background: linear-gradient(135deg, #2d1f5e 0%, #3d2e78 100%);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.topbar-app + .mobile-nav-panel a,
.topbar-app + .mobile-nav-panel button.mobile-nav-link,
.topbar-app .mobile-nav-panel a,
.topbar-app .mobile-nav-panel button.mobile-nav-link {
  color: rgba(255, 255, 255, 0.9);
}

.topbar-app + .mobile-nav-panel a:hover,
.topbar-app + .mobile-nav-panel button.mobile-nav-link:hover,
.topbar-app .mobile-nav-panel a:hover,
.topbar-app .mobile-nav-panel button.mobile-nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.topbar-app + .mobile-nav-panel a.active,
.topbar-app .mobile-nav-panel a.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.topbar-app + .mobile-nav-panel .mobile-nav-divider,
.topbar-app .mobile-nav-panel .mobile-nav-divider {
  background: rgba(255, 255, 255, 0.1);
}

.topbar-app + .mobile-nav-panel .mobile-nav-user,
.topbar-app .mobile-nav-panel .mobile-nav-user {
  color: rgba(255, 255, 255, 0.5);
}

/* Dark theme mobile nav panel */
[data-theme="dark"] .mobile-nav-panel {
  background: var(--bg-elevated, #1e1e2e);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Public header mobile */
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  .topbar.topbar-public {
    padding: 0.5rem 0;
  }

  .topbar-public .topbar-content {
    width: 100%;
    padding: 0 0.75rem;
    flex-wrap: nowrap;
  }

  .public-header-left {
    gap: 0.5rem;
    flex: 1;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
  }

  /* Hide all desktop nav and right-side items on mobile */
  .public-nav {
    display: none !important;
  }

  .public-header-right {
    display: none !important;
  }

  .mobile-login-link {
    display: none !important;
  }

  /* Keep class-switcher visible on mobile */
  .topbar-app .class-switcher {
    display: block !important;
    margin-left: 0.25rem;
    flex: 1;
    min-width: 0;
  }

  .topbar-app .class-switcher select {
    width: 100%;
    max-width: none;
    font-size: 0.8125rem;
    padding: 0.35rem 0.5rem;
  }

  /* Ensure topbar-content is a proper flex row on mobile */
  .topbar-public .topbar-content {
    display: flex;
    align-items: center;
  }
}

.topbar-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  object-fit: contain;
}

.logo-text {
  font-weight: 600;
  font-size: 1.125rem;
}

.logo-text-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-word-top {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.logo-word-bottom {
  font-weight: 600;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
}

.topbar-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: 1rem;
}

.nav-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  min-width: 4.5rem;
  background: rgba(255,255,255,0.1);
  border-radius: 0.5rem;
  color: white;
  text-decoration: none;
  font-size: 0.7rem;
  transition: background 0.2s;
}

.nav-tile:hover, .nav-tile.active {
  background: rgba(255,255,255,0.25);
}

.nav-tile .nav-icon {
  font-size: 1.25rem;
  margin-bottom: 0.125rem;
  margin-right: 0;
  opacity: 1;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
}

.topbar-right .user-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.trial-badge-topbar {
  display: inline-block;
  background: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}

.topbar-right .theme-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
}

.topbar-right .theme-toggle:hover {
  background: rgba(255,255,255,0.25);
}

.btn-logout {
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  font-weight: 500;
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.2);
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.25);
}

/* Topbar Login Form (Public Pages) */
.topbar-login {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

.topbar-login input {
  padding: 0.375rem 0.5rem;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 0.25rem;
  background: rgba(255,255,255,0.9);
  width: 130px;
  font-size: 0.8rem;
  color: #333;
}

.topbar-login input::placeholder {
  color: #666;
}

.topbar-login input:focus {
  outline: none;
  border-color: white;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

.btn-login {
  background: white;
  color: #5D4C9A;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  font-weight: 600;
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-login:hover {
  background: rgba(255,255,255,0.9);
}

.btn-register {
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.2s;
}

.btn-register:hover {
  background: rgba(255,255,255,0.3);
}

/* Topbar Language Switch */
.topbar .lang-switch {
  background: rgba(255,255,255,0.15);
}

.topbar .lang-switch a {
  color: rgba(255,255,255,0.7);
}

.topbar .lang-switch a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

.topbar .lang-switch a:hover:not(.active) {
  color: white;
}

/* Class Switcher in Topbar */
.class-switcher {
  margin-left: 0.5rem;
}

.class-switcher select {
  padding: 0.4rem 0.75rem;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 0.375rem;
  color: #333;
  font-size: 0.875rem;
  cursor: pointer;
  max-width: 200px;
}

[data-theme="dark"] .class-switcher select {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.class-switcher select:focus {
  outline: none;
  border-color: var(--accent, #5D4C9A);
}

.class-switcher select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Legacy Sidebar (kept for class-view sidebar with class list) */
.sidebar {
  width: 260px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  display: none; /* Hidden by default - topbar replaces it */
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.sidebar-classes {
  border-top: 1px solid var(--border-subtle);
  padding: 0.75rem 0;
  max-height: 40vh;
  overflow-y: auto;
}

.sidebar-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.sidebar-class-list {
  display: flex;
  flex-direction: column;
}

.class-item {
  padding: 0.5rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.class-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.user-info {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.user-info span {
  display: block;
  color: var(--text-secondary);
}

.trial-badge {
  display: inline-block;
  background: var(--orange-bg);
  color: var(--orange-warn);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

/* Main Content - Full width with topbar */
.main-content {
  flex: 1;
  margin-left: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.main-header {
  background: var(--bg-elevated);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title h1 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.content {
  padding: 2rem;
  flex: 1;
}

/* ============================================
   Classes Grid
   ============================================ */

.class-section {
  margin-bottom: 1.5rem;
}
.class-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.class-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
}

.class-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

.class-card-wrapper {
  position: relative;
}

.class-card-wrapper .class-card {
  display: block;
}

.class-share-btn {
  position: absolute;
  top: 0.75rem;
  right: 2.5rem;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
}

.class-card-wrapper:hover .class-share-btn {
  opacity: 1;
}

.class-share-btn:hover {
  background: var(--accent-bg, rgba(93, 76, 154, 0.1));
  color: var(--accent, #5D4C9A);
  border-color: var(--accent, #5D4C9A);
}

.class-delete-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-tertiary);
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
  border: 1px solid var(--border-subtle);
}

.class-card-wrapper:hover .class-delete-btn {
  opacity: 1;
}

.class-delete-btn:hover {
  background: var(--red-bg);
  color: var(--red-bad);
  border-color: rgba(239, 68, 68, 0.3);
}

.class-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.class-subject {
  color: var(--accent);
  font-size: 0.875rem;
}

.class-meta {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* Shared Classes */
.shared-class {
  border-left: 3px solid var(--accent);
}

.shared-info {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.permission-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.permission-badge.edit {
  background: var(--green-bg);
  color: var(--green-good);
}

.permission-badge.read {
  background: var(--yellow-bg);
  color: var(--yellow-mid);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

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

/* ============================================
   Modal
   ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-default);
}

.modal-content.modal-lg {
  max-width: 700px;
}

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

.modal-header h2,
.modal-header h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-tertiary);
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-content form {
  padding: 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ============================================
   Mobile Menu Components (Legacy - kept for compatibility)
   ============================================ */

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

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

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

/* ============================================
   Responsive - Tablet (< 1024px)
   ============================================ */

@media (max-width: 1024px) {
  /* Sidebar adjustments for tablet */
  .sidebar {
    width: 220px;
  }

  /* Grid column reductions */
  .classes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Form layout optimizations */
  .content {
    padding: 1.5rem;
  }

  .main-header {
    padding: 0.875rem 1.5rem;
  }

  /* Settings two-column to single at tablet */
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  /* Topbar adjustments */
  .nav-tile {
    min-width: 4rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.65rem;
  }

  .nav-tile .nav-icon {
    font-size: 1.1rem;
  }

  .class-switcher select {
    max-width: 150px;
  }
}

/* ============================================
   Responsive - Mobile (< 768px)
   ============================================ */

@media (max-width: 768px) {
  /* Topbar responsive */
  .topbar-content {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
  }

  .topbar-logo .logo-text {
    display: none;
  }

  .topbar-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-left: 0;
    margin-top: 0.5rem;
  }

  .nav-tile {
    min-width: 3.5rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.65rem;
  }

  .nav-tile .nav-icon {
    font-size: 1rem;
  }

  .topbar-login {
    order: 2;
    margin-left: auto;
  }

  .topbar-login input {
    width: 90px;
    font-size: 0.75rem;
    padding: 0.3rem 0.4rem;
  }

  .topbar-right {
    order: 2;
  }

  .topbar-right .user-name {
    display: none;
  }

  .btn-register {
    display: none;
  }

  .class-switcher {
    order: 3;
    width: 100%;
    margin: 0.5rem 0 0 0;
  }

  .class-switcher select {
    width: 100%;
    max-width: none;
  }

  /* Keep mobile menu for class-view sidebar */
  .mobile-menu-btn {
    display: none;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .main-header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .header-title {
    display: flex;
    align-items: center;
  }

  .header-title h1 {
    font-size: 1.125rem;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-actions .btn {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
  }

  .content {
    padding: 1rem;
  }

  .modal-content {
    max-width: calc(100vw - 2rem);
    margin: 1rem;
  }

  .modal-content form {
    padding: 1rem;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }

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

  .class-share-btn,
  .class-delete-btn {
    opacity: 1;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .auth-card h1 {
    font-size: 1.25rem;
  }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

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

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

/* ============================================
   Theme Toggle
   ============================================ */

.theme-toggle {
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* Light mode scrollbars */
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg-surface); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }

/* ============================================
   Sidebar Section (for public pages)
   ============================================ */

.sidebar-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

/* ============================================
   Homepage / Public Pages Styles
   ============================================ */

/* Hero Stripe – Purple gradient band */
.hero-stripe {
  background: linear-gradient(135deg, #5D4C9A 0%, #9A4C79 100%);
  position: relative;
  overflow: visible;
  padding: 3rem 1rem 4rem;
  box-shadow: 0 4px 20px rgba(93, 76, 154, 0.3);
}

.hero-stripe::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.1) 0%, transparent 30%),
    radial-gradient(circle at 90% 80%, rgba(255,255,255,0.08) 0%, transparent 25%);
  pointer-events: none;
}

.hero-stripe .hero-tagline {
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

.hero-stripe h1 {
  color: white !important;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hero-stripe .hero-subtext {
  color: rgba(255,255,255,0.9);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-benefits {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.hero-benefit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  font-weight: 500;
}

.hero-benefit svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Hero CTA Buttons */
.btn-accent {
  background: #FFD83F;
  color: #1F2937;
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.btn-accent:hover {
  background: #FFE066;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.btn-outline-white {
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(255,255,255,0.3);
  transition: all 0.3s ease;
}

.btn-outline-white:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}

/* Hero Decorative Stars */
.hero-star {
  position: absolute;
  color: rgba(255,255,255,0.3);
  font-size: 1.5rem;
  z-index: 5;
  animation: twinkle 3s ease-in-out infinite;
  pointer-events: none;
}

.star-1 { top: 10%; left: 5%; font-size: 1.2rem; animation-delay: 0s; }
.star-2 { top: 20%; right: 8%; font-size: 1.8rem; animation-delay: 0.5s; }
.star-3 { top: 5%; left: 25%; font-size: 1rem; animation-delay: 1s; }
.star-4 { bottom: 25%; right: 15%; font-size: 1.5rem; animation-delay: 1.5s; }
.star-5 { top: 15%; right: 25%; font-size: 2rem; animation-delay: 0.3s; color: rgba(255,216,63,0.3); }
.star-6 { bottom: 30%; left: 8%; font-size: 1.3rem; animation-delay: 0.8s; }
.star-7 { top: 40%; left: 3%; font-size: 0.9rem; animation-delay: 1.2s; }
.star-8 { bottom: 15%; right: 5%; font-size: 1.1rem; animation-delay: 2s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

@keyframes starFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
  33% { transform: translateY(-10px) scale(1.2); opacity: 0.7; }
  66% { transform: translateY(5px) scale(0.9); opacity: 0.5; }
}

/* Dreamy glow stars */
.star-glow {
  text-shadow: 0 0 8px currentColor, 0 0 20px currentColor;
  filter: blur(0.3px);
}

.star-glow.g1  { top: 5%;  left: 3%;  color: rgba(255,255,255,0.7); font-size: 0.6rem; animation: twinkle 2.1s ease-in-out infinite 0.2s; }
.star-glow.g2  { top: 12%; left: 35%; color: rgba(200,180,255,0.6); font-size: 1.4rem; animation: starFloat 8s ease-in-out infinite; }

/* Content Wrapper – Cream container between hero and marketing */
.content-wrapper {
  border-radius: 1rem;
  width: min(100% - 2rem, 75rem);
  margin: 1.5rem auto 2rem;
  padding: 1rem;
  background-color: #FFFEF5;
  box-shadow: 0px 8px 13px 0px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

[data-theme="dark"] .content-wrapper {
  background-color: #1a1a1e;
}

/* Marketing Section – Purple gradient background */
.marketing-section {
  border-radius: 0.5rem;
  margin: 0;
  padding: 5rem 2rem 4rem;
  background: linear-gradient(180deg, #5C4B9A 0%, #774C99 30%, #914B97 70%, #9A4C79 100%);
  position: relative;
  overflow: visible;
  box-shadow: 0 0 40px rgba(93, 76, 154, 0.3);
}

.marketing-section::before {
  content: '';
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 160px;
  background: radial-gradient(ellipse 100% 100% at center bottom,
    rgba(122, 107, 181, 0.6) 0%,
    rgba(93, 76, 154, 0.4) 30%,
    rgba(74, 61, 122, 0.2) 60%,
    transparent 100%);
  pointer-events: none;
  filter: blur(30px);
  z-index: 10;
}

.marketing-section::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(122, 107, 181, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(154, 76, 121, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(93, 76, 154, 0.1) 0%, transparent 50%);
  animation: floatingGlow 12s ease-in-out infinite alternate;
  pointer-events: none;
}

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

.marketing-section h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2.5rem;
  color: white !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

/* Decorative Sparkles */
.sparkle {
  position: absolute;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  z-index: 5;
  animation: sparkleFloat 4s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 40px rgba(122, 107, 181, 0.6);
  pointer-events: none;
}

.sparkle-1 { top: 10%; left: 5%; font-size: 2rem; animation-delay: 0s; }
.sparkle-2 { top: 15%; right: 8%; font-size: 1.2rem; animation-delay: 1s; }
.sparkle-3 { top: 5%; right: 20%; font-size: 2.5rem; color: rgba(122, 107, 181, 0.9); animation-delay: 0.5s; }
.sparkle-4 { bottom: 20%; left: 10%; font-size: 1rem; animation-delay: 1.5s; }
.sparkle-5 { bottom: 15%; right: 5%; font-size: 1.8rem; color: rgba(154, 76, 121, 0.9); animation-delay: 2s; }

@keyframes sparkleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 0.7; }
  50% { transform: translateY(-10px) rotate(15deg) scale(1.1); opacity: 1; }
}

/* Feature Cards Grid (MagicSchool style) */
.feature-blocks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.feature-card-magicschool {
  background: linear-gradient(135deg, #FAFAF9 0%, #F5F5F4 100%);
  border: 1px solid rgba(93, 76, 154, 0.15);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
}

.feature-card-magicschool:hover {
  border-color: rgba(93, 76, 154, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}


.feature-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(93, 76, 154, 0.15);
}

.feature-card-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #5D4C9A 0%, #9A4C79 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-card-icon svg {
  width: 22px;
  height: 22px;
  stroke: white;
}

.feature-card-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1F2937;
}

.feature-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feature-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: #4B5563;
}

.feature-checklist .check-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  stroke: #5D4C9A;
}

.feature-checklist li strong {
  color: #1F2937;
  font-weight: 600;
}

.feature-checklist .feature-detail {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: rgba(93, 76, 154, 0.05);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #4B5563;
  line-height: 1.5;
  border-left: 3px solid #5D4C9A;
}

/* Dark mode for feature cards */
[data-theme="dark"] .feature-card-magicschool {
  background: linear-gradient(135deg, #1F1F23 0%, #27272A 100%);
  border-color: rgba(93, 76, 154, 0.3);
}

[data-theme="dark"] .feature-card-magicschool:hover {
  border-color: rgba(93, 76, 154, 0.5);
  background: linear-gradient(135deg, #27272A 0%, #2E2E33 100%);
}

[data-theme="dark"] .feature-card-header h3 {
  color: #F5F5F5;
}

[data-theme="dark"] .feature-checklist li {
  color: #B0B0B0;
}

[data-theme="dark"] .feature-checklist li strong {
  color: #E5E5E5;
}

[data-theme="dark"] .feature-checklist .feature-detail {
  background: rgba(93, 76, 154, 0.1);
  color: #B0B0B0;
}

/* PDF Report Preview Section */
.pdf-preview-section {
  margin: 3rem auto 0;
  max-width: 900px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.pdf-preview-section h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.pdf-preview-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.pdf-preview-card {
  display: flex;
  gap: 2rem;
  align-items: stretch;
  background: var(--bg-secondary, #f8f9fa);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: left;
}

.pdf-preview-embed {
  flex: 0 0 280px;
  min-height: 380px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  background: #fff;
}

.pdf-preview-embed iframe {
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: none;
}

.pdf-preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pdf-preview-info h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.pdf-preview-info ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.pdf-preview-info li {
  padding: 0.4rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.pdf-preview-info li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent, #5D4C9A);
  font-weight: bold;
}

.btn-outline-accent {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border: 2px solid var(--accent, #5D4C9A);
  color: var(--accent, #5D4C9A);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  width: fit-content;
}

.btn-outline-accent:hover {
  background: var(--accent, #5D4C9A);
  color: #fff;
}

@media (max-width: 768px) {
  .pdf-preview-card {
    flex-direction: column;
  }
  .pdf-preview-embed {
    flex: none;
    min-height: 300px;
  }
}

/* Screenshot Gallery */
.screenshots-section {
  margin: 3rem auto 2.5rem;
  max-width: 1100px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.screenshots-section h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.screenshots-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.screenshots-gallery {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}

.screenshot-item {
  flex: 1 1 0;
  max-width: 250px;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color, #e0e0e0);
  background: var(--bg-secondary, #f8f9fa);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.screenshot-item:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 24px rgba(93, 76, 154, 0.18);
  border-color: rgba(93, 76, 154, 0.4);
}

.screenshot-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  object-position: top;
  display: block;
}

.screenshot-label {
  padding: 0.6rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Screenshot Modal */
#screenshotModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

#screenshotModal.active {
  display: flex;
  opacity: 1;
}

#screenshotModalImg {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
  cursor: default;
}

#screenshotModal button {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

#screenshotModal button:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .screenshots-gallery {
    gap: 0.75rem;
  }
  .screenshot-item {
    flex: 1 1 calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
  }
  .screenshot-item img {
    height: 110px;
  }
  .screenshot-label {
    font-size: 0.78rem;
    padding: 0.5rem 0.4rem;
  }
}

/* Trust Badges (social proof) */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 3rem auto 0;
  max-width: 800px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.trust-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 12px;
  border: 1px solid var(--border-color, #e0e0e0);
}

.trust-badge svg {
  flex-shrink: 0;
  color: var(--accent, #5D4C9A);
}

.trust-badge div {
  display: flex;
  flex-direction: column;
}

.trust-badge strong {
  font-size: 0.9rem;
  color: var(--text-primary, #1a1a2e);
}

.trust-badge span {
  font-size: 0.8rem;
  color: var(--text-secondary, #666);
}

@media (max-width: 768px) {
  .trust-badges {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }
  .trust-badge {
    width: 100%;
    max-width: 300px;
  }
}

/* Testimonials */
.testimonials-section {
  max-width: 900px;
  margin: 4rem auto 0;
  text-align: center;
  position: relative;
  z-index: 1;
}

.testimonials-section h2 {
  color: white;
  font-size: 1.75rem;
  margin-bottom: 2rem;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.testimonial-card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.testimonial-quote {
  color: rgba(255,255,255,0.9);
  font-size: 0.9375rem;
  line-height: 1.6;
  font-style: italic;
  margin: 0;
}

.testimonial-author {
  color: rgba(255,216,63,0.9);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Comparison Table */
.comparison-section {
  max-width: 700px;
  margin: 4rem auto 0;
  text-align: center;
  position: relative;
  z-index: 1;
}

.comparison-section h2 {
  color: white;
  font-size: 1.75rem;
  margin-bottom: 2rem;
}

.comparison-table-wrapper {
  overflow-x: auto;
}

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

.comparison-table th,
.comparison-table td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.comparison-table th {
  font-weight: 700;
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.7);
}

.comparison-table th.compare-highlight {
  color: #FFD83F;
}

.comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
}

.compare-yes {
  color: #4ade80;
  font-weight: 700;
  font-size: 1.125rem;
}

.compare-no {
  color: rgba(255,255,255,0.3);
  font-size: 1.125rem;
}

.compare-partial {
  color: #fbbf24;
  font-size: 1.125rem;
}

@media (max-width: 768px) {
  .testimonials-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 0.5rem 0.625rem;
    font-size: 0.875rem;
  }
}

/* Pricing Comparison Box (inside marketing section) */
.pricing-comparison {
  max-width: 960px;
  margin: 3rem auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  position: relative;
  z-index: 1;
}

.pricing-box {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  color: white;
  display: flex;
  flex-direction: column;
}

.pricing-box.featured {
  background: rgba(255,255,255,0.15);
  border-color: #FFD83F;
  box-shadow: 0 0 30px rgba(255, 216, 63, 0.15);
}

.pricing-box h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: white;
}

.pricing-box .price {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #FFD83F;
}

.pricing-box ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  text-align: left;
  flex: 1;
}

.pricing-box ul li {
  padding: 0.4rem 0;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
}

.pricing-box ul li::before {
  content: '\2713';
  color: #FFD83F;
  font-weight: bold;
}

.pricing-box .btn-accent {
  width: 100%;
  justify-content: center;
}

.pricing-box .btn-outline-white {
  width: 100%;
  justify-content: center;
}

/* Public Page Footer */
.home-footer {
  background: var(--bg-surface);
  color: var(--text-tertiary);
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-copyright {
  font-size: 0.9rem;
}

/* Login Dropdown */
.login-dropdown {
  position: relative;
}

.login-dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  min-width: 280px;
  z-index: 200;
}

.login-dropdown-content.show {
  display: block;
}

.login-dropdown-content .form-group {
  margin-bottom: 0.75rem;
}

.login-dropdown-content input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.login-dropdown-content input::placeholder {
  color: var(--text-tertiary);
}

.login-dropdown-content input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.login-dropdown-content .btn-block {
  margin-top: 0.5rem;
}

.login-error {
  color: var(--red-bad);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

/* Language Switch */
.lang-switch {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-surface);
  padding: 0.25rem;
  border-radius: 6px;
}

.lang-switch a {
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-tertiary);
  transition: all 0.15s;
}

.lang-switch a.active {
  background: var(--bg-hover);
  color: var(--accent);
}

.lang-switch a:hover:not(.active) {
  color: var(--text-primary);
}

/* Language Switcher Dropdown (multi-language) */
.lang-switcher-dropdown {
  position: relative;
  display: inline-block;
}

.lang-switcher-toggle {
  background: none;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}

.lang-switcher-toggle:hover {
  background: var(--bg-hover, #f0f0f0);
}

.lang-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 160px;
  overflow: hidden;
}

.lang-dropdown-menu.show {
  display: block;
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary, #333);
  text-align: left;
  transition: background 0.15s;
}

.lang-dropdown-item:hover {
  background: var(--bg-hover, #f5f5f5);
}

.lang-dropdown-item.active {
  background: var(--accent-muted, #e8e0ff);
  color: var(--accent, #5D4C9A);
  font-weight: 600;
}

.lang-flag {
  font-size: 1.1rem;
}

.lang-name {
  flex: 1;
}

/* Help & Getting Started Pages */
.page-content {
  max-width: 800px;
}

.page-content h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.page-content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  color: var(--text-primary);
}

.page-content h3 {
  font-size: 1.125rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text-primary);
}

.page-content p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.page-content ul, .page-content ol {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.page-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.step-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.step-card h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-number {
  background: var(--accent);
  color: var(--white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.faq-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.faq-question {
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s;
}

.faq-question:hover {
  background: var(--bg-hover);
}

.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--text-tertiary);
}

.faq-item.open .faq-question::after {
  content: '-';
}

.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.faq-item.open .faq-answer {
  display: block;
}

/* ============================================
   Documentation Articles
   ============================================ */

.docs-article {
  max-width: 780px;
}

.docs-article h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.docs-article h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.docs-article p {
  line-height: 1.7;
  margin-bottom: 1rem;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}

.docs-table th,
.docs-table td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.docs-table th {
  background: var(--bg-secondary);
  font-weight: 600;
}

.docs-table tr:hover td {
  background: var(--bg-hover);
}

.docs-callout {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
}

.docs-callout p:last-child {
  margin-bottom: 0;
}

.docs-formula {
  background: var(--bg-tertiary, var(--bg-secondary));
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: 6px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  overflow-x: auto;
}

.docs-steps {
  margin: 1.5rem 0;
}

.docs-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.docs-nav a {
  margin-right: 1rem;
}

.docs-read-more {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.docs-read-more li {
  margin-bottom: 0.5rem;
}

.docs-read-more a {
  color: var(--accent);
  text-decoration: none;
}

.docs-read-more a:hover {
  text-decoration: underline;
}

.settings-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  margin-left: 0.5rem;
  transition: background 0.15s, color 0.15s;
  vertical-align: middle;
}

.settings-help-link:hover {
  background: var(--accent);
  color: #fff;
}

/* Homepage Responsive */
@media (max-width: 768px) {
  .content-wrapper {
    width: 100%;
    border-radius: 0;
    margin-top: 0;
    padding: 0;
    box-shadow: none;
  }

  .marketing-section {
    border-radius: 0;
  }

  .hero-stripe {
    padding: 2rem 1rem 3rem;
  }

  .hero-benefits {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .hero-star { font-size: 0.8rem !important; }
  .hero-nebula { display: none; }

  .feature-blocks-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .marketing-section {
    padding: 3rem 1rem 2.5rem;
  }

  .sparkle { display: none; }

  .pricing-comparison {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .page-content h1 {
    font-size: 1.5rem;
  }
}

/* ============================================
   Toggle Switch
   ============================================ */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================
   Promo Banner & Badge (Schuljahres-Bonus)
   ============================================ */

.promo-banner {
  background: linear-gradient(90deg, #22c55e, #16a34a);
  color: white;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.promo-banner .promo-icon {
  font-size: 1.1rem;
}

.promo-banner a {
  color: white;
  text-decoration: underline;
  margin-left: 0.5rem;
}

.promo-banner a:hover {
  opacity: 0.9;
}

.promo-badge {
  display: inline-block;
  background: #22c55e;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pricing-promo-callout {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.15));
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.pricing-promo-callout p {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.pricing-promo-callout strong {
  color: #22c55e;
}

/* ============================================
   Upgrade Hints
   ============================================ */

.upgrade-hint {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--accent, #5D4C9A);
  background: var(--accent-bg, rgba(93, 76, 154, 0.08));
}

.upgrade-hint-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.upgrade-hint-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.upgrade-hint-content p {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.upgrade-hint-content .btn {
  margin-left: auto;
  flex-shrink: 0;
}

.upgrade-hint-compact {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.upgrade-hint-compact a {
  color: var(--accent, #5D4C9A);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .upgrade-hint-content {
    flex-wrap: wrap;
  }

  .upgrade-hint-content .btn {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
}

/* Premium Gate (modal overlay for free users) */

.premium-gate {
  text-align: center;
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.premium-gate-badge {
  display: inline-block;
  background: var(--accent, #5D4C9A);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.premium-gate p {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.premium-gate-blurred {
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
  filter: blur(1px);
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
  max-width: 100%;
}

.toast.toast-out {
  animation: toast-out 0.2s ease-in forwards;
}

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

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

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

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

.toast-message {
  font-size: 0.875rem;
  color: var(--text-primary);
  word-wrap: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* Toast Types */
.toast-success {
  border-color: rgba(34, 197, 94, 0.3);
  background: var(--bg-elevated);
}

.toast-success .toast-icon {
  color: var(--green-good);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: var(--bg-elevated);
}

.toast-error .toast-icon {
  color: var(--red-bad);
}

.toast-warning {
  border-color: rgba(234, 179, 8, 0.3);
  background: var(--bg-elevated);
}

.toast-warning .toast-icon {
  color: var(--yellow-mid);
}

.toast-info {
  border-color: rgba(93, 76, 154, 0.3);
  background: var(--bg-elevated);
}

.toast-info .toast-icon {
  color: var(--accent);
}

/* Toast Responsive */
@media (max-width: 768px) {
  .toast-container {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

/* ============================================
   Centered Warning Overlay
   ============================================ */

.centered-warning-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.centered-warning-box {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.centered-warning-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.centered-warning-box p {
  margin: 0 0 1rem;
  color: #1a1a1a;
  font-size: 0.9rem;
  line-height: 1.5;
}

.centered-warning-box button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
}

.centered-warning-box button:hover {
  opacity: 0.9;
}

/* ============================================
   Confirmation & Prompt Dialogs
   ============================================ */

.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 1rem;
  animation: dialog-overlay-in 0.2s ease-out;
}

.dialog-overlay.dialog-out {
  animation: dialog-overlay-out 0.15s ease-in forwards;
}

@keyframes dialog-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dialog-overlay-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.dialog-box {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  animation: dialog-box-in 0.2s ease-out;
}

.dialog-overlay.dialog-out .dialog-box {
  animation: dialog-box-out 0.15s ease-in forwards;
}

@keyframes dialog-box-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes dialog-box-out {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
}

.dialog-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.dialog-header h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.dialog-body {
  padding: 1.5rem;
}

.dialog-message {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0;
}

.dialog-input {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dialog-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.dialog-input::placeholder {
  color: var(--text-tertiary);
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.dialog-btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.dialog-btn-cancel {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.dialog-btn-cancel:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.dialog-btn-confirm {
  background: var(--accent);
  color: var(--white);
}

.dialog-btn-confirm:hover {
  background: var(--accent-hover);
}

.dialog-btn-danger {
  background: var(--red-bad);
  color: var(--white);
}

.dialog-btn-danger:hover {
  background: #dc2626;
}

/* Dialog Responsive */
@media (max-width: 768px) {
  .dialog-box {
    max-width: calc(100vw - 2rem);
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-btn {
    width: 100%;
  }
}

/* ============================================
   Legal Pages (Datenschutz, Impressum)
   ============================================ */

.legal-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.legal-content h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.legal-updated {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.legal-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.legal-section:last-of-type {
  border-bottom: none;
}

.legal-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.legal-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
  color: var(--text-primary);
}

.legal-section p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.legal-section ul {
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.legal-section ul li {
  margin-bottom: 0.5rem;
}

.legal-section a {
  color: var(--accent);
  text-decoration: none;
}

.legal-section a:hover {
  text-decoration: underline;
}

.legal-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.legal-footer a {
  color: var(--accent);
  text-decoration: none;
}

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

.legal-footer .separator {
  color: var(--text-tertiary);
  margin: 0 1rem;
}

/* Auth Footer Links (login/register pages) */
.auth-footer-links {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.8rem;
}

.auth-footer-links a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.auth-footer-links a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

.auth-footer-links .separator {
  color: var(--text-tertiary);
  margin: 0 0.5rem;
}

/* Legal Pages Responsive */
@media (max-width: 768px) {
  .legal-content {
    padding: 1rem;
  }

  .legal-content h1 {
    font-size: 1.5rem;
  }

  .legal-section h2 {
    font-size: 1.125rem;
  }
}

/* ============================================
   Loading Spinner
   ============================================ */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

/* Table Loading Overlay (E2EE decryption) */
.table-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 10;
  gap: 1rem;
}

.table-loading-overlay .spinner {
  width: 48px;
  height: 48px;
}

.table-loading-overlay .loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.table-loading-overlay .loading-detail {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.e2ee-waiting .spinner {
  animation: pulse 2s ease-in-out infinite;
  border-color: var(--accent);
  border-top-color: transparent;
}
.e2ee-waiting .loading-text {
  color: var(--accent);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.95); }
}

/* ============================================
   Semester Filter
   ============================================ */

.semester-filter {
  display: flex;
  margin-right: 0.75rem;
}
.semester-dropdown {
  padding: 4px 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  background: var(--card-bg, #fff);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ============================================
   Onboarding Overlay
   ============================================ */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: onboardingFadeIn 0.3s ease;
}

.onboarding-overlay.fade-out {
  animation: onboardingFadeOut 0.3s ease forwards;
}

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

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

.onboarding-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 2.5rem 2rem 2rem;
  max-width: 460px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
  animation: onboardingCardIn 0.35s ease;
}

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

.onboarding-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.5rem;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

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

/* Step dots */
.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-default);
  transition: background 0.25s, transform 0.25s;
}

.onboarding-dot.active {
  background: var(--accent);
  transform: scale(1.25);
}

/* Steps */
.onboarding-step {
  display: none;
  animation: onboardingStepIn 0.3s ease;
}

.onboarding-step.active {
  display: block;
}

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

.onboarding-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.onboarding-step h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.onboarding-step p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.onboarding-subtitle {
  font-size: 0.8125rem !important;
  color: var(--text-tertiary) !important;
  margin-bottom: 1.5rem !important;
}

.onboarding-hint {
  font-size: 0.8125rem !important;
  color: var(--text-tertiary) !important;
  margin-top: 1rem !important;
}

.onboarding-btn {
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  transition: transform 0.15s, box-shadow 0.15s;
}

.onboarding-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(93, 76, 154, 0.4);
}

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

/* Pulsing indicator for highlighting elements */
.onboarding-indicator {
  position: absolute;
  border-radius: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 0 rgba(93, 76, 154, 0.4);
  animation: onboardingPulse 1.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 10001;
}

@keyframes onboardingPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(93, 76, 154, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(93, 76, 154, 0);
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .onboarding-card {
    padding: 2rem 1.25rem 1.5rem;
    margin: 1rem;
    border-radius: 12px;
  }

  .onboarding-step h2 {
    font-size: 1.2rem;
  }

  .onboarding-icon {
    font-size: 2.5rem;
  }

  .onboarding-btn {
    width: 100%;
  }
}

/* ================================
   Demo Mode Styles
   ================================ */

.demo-banner {
  background: linear-gradient(135deg, #e6a817, #d4940f);
  color: #fff;
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  border-radius: 8px;
  margin: 0.75rem 1rem 0;
}

/* Demo Subject Tabs */
.demo-subject-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-surface, #f8f9fa);
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
}

.demo-tab {
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary, #64748b);
  background: transparent;
  transition: all 0.15s;
}

.demo-tab:hover {
  background: var(--bg-elevated, #fff);
  color: var(--text-primary, #1a1a2e);
}

.demo-tab.active {
  background: var(--accent, #5D4C9A);
  color: #fff;
}

[data-theme="dark"] .demo-subject-tabs {
  background: var(--bg-surface, #1e293b);
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent, #5D4C9A);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  text-transform: uppercase;
}

.demo-nav-locked {
  opacity: 0.6;
  cursor: default;
}

.demo-tour-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle, rgba(255,255,255,0.5));
  background: transparent;
  color: var(--text-primary, #fff);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 0.5rem;
}
.demo-tour-btn:hover {
  background: var(--accent, #5D4C9A);
  border-color: var(--accent, #5D4C9A);
  color: #fff;
}

/* ================================
   Demo Tour Styles
   ================================ */

.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
}

.tour-tooltip {
  z-index: 9999;
  background: #fff;
  color: #1a1a2e;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  max-width: 340px;
  width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .tour-tooltip {
  background: #2a2a3e;
  color: #e0e0e0;
}

.tour-step-indicator {
  font-size: 0.75rem;
  color: var(--accent, #5D4C9A);
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tour-text {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.tour-skip {
  background: none;
  border: none;
  color: var(--text-light, #888);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.4rem 0;
}

.tour-skip:hover {
  color: var(--text, #333);
}

.tour-next {
  background: var(--accent, #5D4C9A);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tour-next:hover {
  opacity: 0.9;
}

.tour-cta {
  background: linear-gradient(135deg, var(--accent, #5D4C9A), #7B6BB5);
}

.tour-highlight {
  position: relative;
  z-index: 9999;
  box-shadow: 0 0 0 3px var(--accent, #5D4C9A), 0 0 16px rgba(93, 76, 154, 0.4) !important;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .demo-banner {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0.5rem 0;
  }

  .tour-tooltip {
    max-width: 300px;
    padding: 1rem;
  }
}

/* ============================================
   REPORTS SIDEBAR (Dashboard)
   ============================================ */

.dashboard-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.dashboard-main-content {
  flex: 1;
  min-width: 0;
}

.reports-sidebar {
  width: 340px;
  min-width: 340px;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-elevated, var(--bg-surface));
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
}

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

.reports-sidebar-header h3 {
  margin: 0;
  font-size: 1rem;
}

.reports-sidebar-close {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  line-height: 1;
}

.reports-section {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.reports-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

/* Docs Help Links in Sidebar */
.docs-help-section {
  border-bottom: none;
}

.docs-help-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.docs-help-link:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.docs-help-link svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.docs-help-link:hover svg {
  opacity: 1;
  stroke: var(--accent);
}

.docs-help-all {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.docs-help-all:hover {
  text-decoration: underline;
}

.report-config-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
}

.report-config-label {
  font-size: 0.8125rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.report-config-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.report-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm, 4px);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}

.report-settings-btn:hover {
  color: var(--accent);
  background: var(--bg-hover, rgba(93, 76, 154, 0.1));
}

.report-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm, 4px);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.report-remove-btn:hover {
  color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.1);
}

.report-item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Report Settings Modal */
.report-settings-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.report-settings-modal-overlay.active {
  display: flex;
}

.report-settings-modal {
  background: var(--bg-elevated, var(--bg-surface));
  border-radius: var(--radius-md, 8px);
  padding: 1.75rem;
  width: 90%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.report-settings-modal h3 {
  margin: 0 0 1.25rem 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.report-mode-selector {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-sm, 4px);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.report-mode-selector label {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  border: none;
}

.report-mode-selector input[type="radio"] {
  display: none;
}

.report-mode-selector input[type="radio"]:checked + span {
  background: var(--accent);
  color: white;
}

.report-mode-selector label span {
  display: block;
  padding: 0.5rem 0.75rem;
}

.report-settings-field {
  margin-bottom: 1rem;
}

.report-settings-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.report-settings-field select,
.report-settings-field input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  border-radius: var(--radius-sm, 4px);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  min-height: 40px;
}

.report-settings-dates {
  display: flex;
  gap: 0.75rem;
}

.report-settings-dates .report-settings-field {
  flex: 1;
}

.report-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.report-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.report-subject {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-meta {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm, 4px);
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-download:hover {
  background: var(--bg-hover, rgba(93, 76, 154, 0.1));
}

.report-item.report-new {
  border-left: 3px solid var(--accent);
  background: rgba(139, 92, 246, 0.08);
}

.report-new-badge {
  font-size: 0.65em;
  background: var(--accent);
  color: white;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  margin-left: 4px;
  flex-shrink: 0;
}

.reports-empty {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  text-align: center;
  padding: 1rem 0;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-subtle);
  border-radius: 20px;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* Reports toggle button (visible on smaller screens) */
.reports-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.reports-toggle-btn svg {
  flex-shrink: 0;
}

.reports-backdrop {
  display: none;
}

/* Mobile: sidebar as overlay */
@media (max-width: 1023px) {
  .reports-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-height: 100vh;
    width: 340px;
    min-width: 0;
  }

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

  .reports-sidebar-close {
    display: block;
  }

  .reports-backdrop.active {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.4);
  }
}

/* Large screens: sidebar always visible, hide toggle button entirely */
@media (min-width: 1024px) {
  .reports-toggle-btn {
    display: none;
  }
}
