/* ═══════════════════════════════════════════════════════════════
   UTOT — Understanding the Old Testament
   Premium Design System
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ───────────────────────────────── */
:root {
  /* Colors — Dark Parchment Theme */
  --bg-primary: #0c0b10;
  --bg-secondary: #141318;
  --bg-tertiary: #1c1a24;
  --bg-card: rgba(28, 26, 36, 0.7);
  --bg-glass: rgba(28, 26, 36, 0.45);

  --gold-50: #fdf8e8;
  --gold-100: #f5e6b8;
  --gold-200: #e8cc7a;
  --gold-300: #d4a84a;
  --gold-400: #c8963c;
  --gold-500: #b8862d;
  --gold-600: #a07424;
  --gold-accent: #d4a84a;
  --gold-glow: rgba(212, 168, 74, 0.15);

  --text-primary: #eae6df;
  --text-secondary: #a8a29e;
  --text-tertiary: #6d6862;
  --text-accent: var(--gold-300);

  --border-subtle: rgba(212, 168, 74, 0.12);
  --border-medium: rgba(212, 168, 74, 0.25);
  --border-accent: rgba(212, 168, 74, 0.4);

  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;

  /* Typography */
  --font-serif: 'Playfair Display', 'Georgia', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-gold: 0 0 20px rgba(212, 168, 74, 0.15);
  --shadow-glow: 0 0 40px rgba(212, 168, 74, 0.1);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-base: 250ms var(--ease-out);
  --transition-slow: 400ms var(--ease-out);

  /* Layout */
  --sidebar-width: 320px;
  --header-height: 64px;
  --max-content: 1200px;
  --chat-max-width: 800px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(212, 168, 74, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(212, 168, 74, 0.02) 0%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  line-height: 1.2;
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 1.75rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

p { margin-bottom: var(--space-md); }

a {
  color: var(--gold-300);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--gold-200); }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-500);
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════ */

#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: var(--bg-primary);
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

#login-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-container {
  width: 100%;
  max-width: 440px;
  padding: var(--space-xl);
  text-align: center;
}

.login-logo {
  margin-bottom: var(--space-xl);
}

.login-logo .logo-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  box-shadow: var(--shadow-gold);
  animation: float 6s ease-in-out infinite;
}

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

.login-logo h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--gold-200), var(--gold-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.login-logo .subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-style: italic;
  font-family: var(--font-serif);
}

.login-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
}

.login-card .lang-select {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-xl);
}

.lang-btn {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

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

.lang-btn.active {
  border-color: var(--gold-400);
  background: var(--gold-glow);
  color: var(--gold-300);
}

.login-input-group {
  position: relative;
  margin-bottom: var(--space-lg);
}

.login-input-group input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  padding-right: 3rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.login-input-group input:focus {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

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

.login-input-group .toggle-password {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color var(--transition-fast);
}

.login-input-group .toggle-password:hover {
  color: var(--text-secondary);
}

.login-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
  min-height: 1.2em;
  transition: opacity var(--transition-fast);
}

.btn-primary {
  width: 100%;
  padding: var(--space-md) var(--space-xl);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-300));
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: var(--bg-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: var(--space-sm);
}

.btn-primary.loading .spinner { display: inline-block; }
.btn-primary.loading .btn-text { opacity: 0.7; }

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

/* ═══════════════════════════════════════════════════════════════
   MAIN APP LAYOUT
   ═══════════════════════════════════════════════════════════════ */

#app {
  display: none;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

#app.visible {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.6s var(--ease-out);
}

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

/* ── Header ──────────────────────────────────────────────── */
.app-header {
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.header-logo .logo-sm {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.header-logo span {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-300);
}

.header-nav {
  display: flex;
  gap: var(--space-xs);
}

.nav-tab {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

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

.nav-tab.active {
  background: var(--gold-glow);
  color: var(--gold-300);
  border: 1px solid var(--border-accent);
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-lang-select {
  display: flex;
  gap: 2px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 2px;
}

.header-lang-btn {
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-lang-btn:hover { color: var(--text-secondary); }

.header-lang-btn.active {
  background: var(--bg-card);
  color: var(--gold-300);
}

.btn-logout {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ── Main Content Area ───────────────────────────────────── */
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1;
}

.view.active {
  display: flex;
  flex-direction: column;
  animation: viewFadeIn 0.3s var(--ease-out);
}

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

/* ═══════════════════════════════════════════════════════════════
   HOME / WELCOME VIEW
   ═══════════════════════════════════════════════════════════════ */

.home-view {
  align-items: center;
  padding: var(--space-3xl) var(--space-xl);
}

.home-hero {
  text-align: center;
  max-width: 700px;
  margin-bottom: var(--space-3xl);
}

.home-hero h1 {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--gold-100), var(--gold-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-hero .hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  font-family: var(--font-serif);
  font-style: italic;
  line-height: 1.6;
}

.home-stats {
  display: flex;
  gap: var(--space-xl);
  margin-top: var(--space-2xl);
  justify-content: center;
  flex-wrap: wrap;
}

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

.stat-number {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-300);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Starter Questions */
.home-starters {
  width: 100%;
  max-width: 800px;
}

.home-starters h3 {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.starters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
}

.starter-card {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  overflow: hidden;
}

.starter-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--gold-glow), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.starter-card:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.starter-card:hover::before {
  opacity: 1;
}

.starter-card .card-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  display: block;
}

.starter-card .card-text {
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════
   CHAT VIEW
   ═══════════════════════════════════════════════════════════════ */

.chat-view {
  height: calc(100vh - var(--header-height));
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: var(--chat-max-width);
  margin: 0 auto;
  width: 100%;
  padding: 0 var(--space-md);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.chat-message {
  display: flex;
  gap: var(--space-md);
  animation: messageIn 0.3s var(--ease-out);
  max-width: 100%;
}

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

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 4px;
}

.chat-message.assistant .message-avatar {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  color: var(--bg-primary);
}

.chat-message.user .message-avatar {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

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

.chat-message.user .message-content {
  display: flex;
  justify-content: flex-end;
}

.message-bubble {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  line-height: 1.65;
  font-size: 0.95rem;
  max-width: 85%;
}

.chat-message.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: var(--radius-sm);
}

.chat-message.user .message-bubble {
  background: linear-gradient(135deg, rgba(212, 168, 74, 0.15), rgba(212, 168, 74, 0.08));
  border: 1px solid var(--border-medium);
  border-top-right-radius: var(--radius-sm);
  color: var(--gold-50);
}

/* Message content formatting */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

.message-bubble h3 { font-size: 1.05rem; }
.message-bubble h4 { font-size: 0.95rem; }

.message-bubble p { margin-bottom: var(--space-sm); }
.message-bubble p:last-child { margin-bottom: 0; }

.message-bubble ul, .message-bubble ol {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.message-bubble li { margin-bottom: var(--space-xs); }

.message-bubble strong { color: var(--gold-200); }

.message-bubble code {
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.message-bubble a {
  color: var(--gold-300);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message-bubble a:hover {
  color: var(--gold-200);
}

.message-bubble blockquote {
  border-left: 3px solid var(--gold-500);
  padding-left: var(--space-md);
  margin: var(--space-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-md) var(--space-lg);
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
  padding: var(--space-md) 0 var(--space-xl);
  position: relative;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.chat-input-wrapper textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  padding: var(--space-sm) var(--space-md);
  max-height: 150px;
  min-height: 24px;
}

.chat-input-wrapper textarea::placeholder {
  color: var(--text-tertiary);
}

.btn-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--bg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-send:hover {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-300));
  box-shadow: var(--shadow-gold);
}

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

.chat-disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: var(--space-sm);
}

/* ═══════════════════════════════════════════════════════════════
   CURRICULUM VIEW
   ═══════════════════════════════════════════════════════════════ */

.curriculum-view {
  padding: var(--space-xl);
  overflow-y: auto;
  height: calc(100vh - var(--header-height));
}

.curriculum-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.curriculum-header h2 {
  margin-bottom: var(--space-sm);
  color: var(--gold-200);
}

.curriculum-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Search bar */
.curriculum-search {
  max-width: 500px;
  margin: 0 auto var(--space-2xl);
  position: relative;
}

.curriculum-search input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  padding-left: 2.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-fast);
}

.curriculum-search input:focus {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.curriculum-search .search-icon {
  position: absolute;
  left: var(--space-lg);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

/* Timeline */
.timeline-container {
  max-width: var(--max-content);
  margin: 0 auto;
  position: relative;
}

/* Timeline line */
.timeline-container::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--gold-500), var(--border-subtle), var(--gold-500));
  transform: translateX(-50%);
}

.week-card {
  position: relative;
  width: calc(50% - 30px);
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  margin-bottom: var(--space-xl);
}

.week-card:nth-child(odd) {
  margin-left: 0;
}

.week-card:nth-child(even) {
  margin-left: auto;
}

/* Timeline dot */
.week-card::after {
  content: '';
  position: absolute;
  top: var(--space-lg);
  width: 14px;
  height: 14px;
  background: var(--gold-400);
  border: 3px solid var(--bg-primary);
  border-radius: 50%;
  z-index: 1;
}

.week-card:nth-child(odd)::after {
  right: -37px;
}

.week-card:nth-child(even)::after {
  left: -37px;
}

.week-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.week-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gold-glow);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-300);
  margin-bottom: var(--space-sm);
}

.week-topic {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.week-period {
  font-size: 0.8rem;
  color: var(--gold-400);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.week-description {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.week-books {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.book-tag {
  padding: 2px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ── Week Detail Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: var(--space-xl);
  animation: fadeIn 0.2s var(--ease-out);
}

.modal-overlay.visible {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s var(--ease-out);
}

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

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

.modal-header h2 {
  font-size: 1.5rem;
  color: var(--gold-200);
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  border-color: var(--error);
  color: var(--error);
}

.modal-body {
  padding: var(--space-xl);
}

.modal-section {
  margin-bottom: var(--space-xl);
}

.modal-section h3 {
  color: var(--gold-300);
  margin-bottom: var(--space-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* PDF embed */
.pdf-viewer {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pdf-viewer iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* File download list */
.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  color: var(--text-primary);
}

.file-item:hover {
  border-color: var(--border-medium);
  background: var(--bg-tertiary);
}

.file-icon {
  font-size: 1.5rem;
}

.file-info {
  flex: 1;
}

.file-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.file-type {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* Ask about this week button */
.btn-ask-week {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: linear-gradient(135deg, rgba(212, 168, 74, 0.15), rgba(212, 168, 74, 0.05));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  color: var(--gold-300);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-ask-week:hover {
  background: linear-gradient(135deg, rgba(212, 168, 74, 0.25), rgba(212, 168, 74, 0.1));
  box-shadow: var(--shadow-gold);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .timeline-container::before { display: none; }
  .week-card { width: 100%; margin-left: 0 !important; }
  .week-card::after { display: none; }
  .week-card:nth-child(even) { margin-left: 0; }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  h1 { font-size: 1.8rem; }
  .home-hero h1 { font-size: 2rem; }

  .app-header {
    padding: 0 var(--space-md);
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-height);
    padding-top: var(--space-sm);
    padding-bottom: var(--space-sm);
  }

  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-bottom: var(--space-sm);
  }

  .nav-tab {
    font-size: 0.82rem;
    padding: var(--space-xs) var(--space-md);
  }

  .header-right {
    gap: var(--space-sm);
  }

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

  .curriculum-view {
    padding: var(--space-md);
  }

  .modal-content {
    border-radius: var(--radius-lg);
  }

  .modal-overlay {
    padding: var(--space-sm);
  }

  .chat-input-wrapper {
    border-radius: var(--radius-md);
  }

  .message-bubble {
    max-width: 92%;
  }

  .home-stats {
    gap: var(--space-lg);
  }
}

@media (max-width: 480px) {
  .header-logo span { display: none; }

  .login-container { padding: var(--space-md); }

  .login-card { padding: var(--space-lg); }

  .home-hero h1 { font-size: 1.6rem; }

  .header-lang-select { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.text-gold { color: var(--gold-300); }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
