/* Modern Universal Design System for JGEC Mathematics-III Portal */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-elevated: #1f2937;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-primary: #6366f1; /* Indigo */
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4; /* Cyan */
  --accent-success: #10b981; /* Emerald */
  --accent-warning: #f59e0b; /* Amber */
  --accent-danger: #ef4444; /* Rose */
  --accent-purple: #a855f7;
  
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.85) 100%);
  --gradient-glow: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.18), transparent 70%);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-elevated: #ffffff;
  --bg-glass: rgba(0, 0, 0, 0.03);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(99, 102, 241, 0.25);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  --gradient-glow: radial-gradient(circle at 50% -20%, rgba(99, 102, 241, 0.08), transparent 70%);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: var(--gradient-glow);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Typography Headings */
h1, h2, h3, h4, .brand-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Background Ambient Glow */
.bg-ambient-blob {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}
.blob-1 { top: -100px; left: 10%; background: var(--accent-primary); }
.blob-2 { top: 40%; right: 5%; background: var(--accent-secondary); }
.blob-3 { bottom: 10%; left: 20%; background: var(--accent-purple); }

/* App Container */
.app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

/* Top Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 25, 0.85);
}
[data-theme="light"] .navbar {
  background: rgba(248, 250, 252, 0.9);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-info span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

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

.btn-icon {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.btn-primary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-primary);
  color: white;
  padding: 0.6rem 1.15rem;
  min-height: 42px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary-pill:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Hero Section */
.hero {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
  position: relative;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.85rem;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--text-secondary);
  max-width: 760px;
  margin: 0 auto 1.75rem;
  line-height: 1.55;
}

/* Hero Stats Bar */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0;
}

.stat-card {
  background: var(--gradient-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition-fast);
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}
.stat-card:hover::before { opacity: 1; }

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Study Progress Widget */
.progress-card {
  background: var(--gradient-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.progress-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-percent {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-success);
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
[data-theme="light"] .progress-bar-bg {
  background: rgba(0, 0, 0, 0.08);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
  border-radius: var(--radius-full);
  transition: width 0.5s ease-in-out;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.progress-subtext {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Control Bar: Search & Filters */
.controls-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  margin-bottom: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem 0.85rem 2.85rem;
  color: var(--text-primary);
  font-size: 1rem; /* Prevent iOS zoom */
  outline: none;
  transition: var(--transition-fast);
}
.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.search-input::placeholder { color: var(--text-muted); }

/* Filter Tabs */
.filter-tabs-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
}

.module-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  min-height: 38px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.2);
}
.filter-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.status-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.select-filter {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  min-height: 38px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* Modules & Topic Layout */
.module-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 5rem;
}

.module-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-subtle);
  position: relative;
}

.module-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.module-number-badge {
  background: var(--gradient-primary);
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.module-heading {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  color: var(--text-primary);
}

.module-lecture-hours {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.module-syllabus-desc {
  width: 100%;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--bg-glass);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
  margin-top: 0.5rem;
}

/* Topics Grid - Responsive Breakpoints */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

/* Topic Card */
.topic-card {
  background: var(--gradient-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}
.topic-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md);
}
.topic-card.completed {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.05) 0%, rgba(15, 23, 42, 0.85) 100%);
}

.topic-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.topic-category-pill {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.topic-complete-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  user-select: none;
  min-height: 28px;
}
.topic-complete-check input[type="checkbox"] {
  accent-color: var(--accent-success);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.topic-complete-check:hover { color: var(--text-secondary); }

.topic-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.topic-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Video Showcase Box inside Card */
.video-preview-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.video-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.educator-tag {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}
.educator-tag.gp { color: #93c5fd; }
.educator-tag.gs { color: #fdba74; }
.educator-tag.nptel { color: #86efac; }

.video-action-btns {
  display: flex;
  gap: 0.5rem;
}

.btn-watch-modal {
  flex: 1;
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 0.6rem 0.85rem;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
.btn-watch-modal:hover {
  filter: brightness(1.1);
  transform: scale(1.02);
}

.btn-yt-direct {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.6rem 0.75rem;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}
.btn-yt-direct:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

/* Notes Trigger Button */
.btn-open-notes {
  width: 100%;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #38bdf8;
  padding: 0.55rem 0.85rem;
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: var(--transition-fast);
  margin-top: 0.25rem;
}
.btn-open-notes:hover {
  background: rgba(6, 182, 212, 0.22);
  border-color: #06b6d4;
  color: #7dd3fc;
  transform: translateY(-1px);
}

/* Secondary Links & Verified Resources */
.topic-resources-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
}

.resources-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.resource-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.resource-chip {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.74rem;
  padding: 0.3rem 0.65rem;
  min-height: 28px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}
.resource-chip:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  transform: translateY(-1px);
}
.resource-chip.nptel {
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.resource-chip.gfg {
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}
.resource-chip.mit {
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* Quick Formula Accordion */
.formula-toggle-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  padding: 0.35rem 0;
  min-height: 32px;
  text-align: left;
  transition: var(--transition-fast);
}
.formula-toggle-btn:hover { color: #a5b4fc; }

.formula-drawer {
  display: none;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.8rem;
  color: #e2e8f0;
  line-height: 1.6;
  border: 1px dashed var(--border-subtle);
  font-family: monospace;
}
.formula-drawer.open { display: block; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 920px;
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: scale(0.95);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-backdrop.active .modal-dialog { transform: scale(1); }

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: var(--transition-fast);
}
.modal-close-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal-video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  background: #000;
}

.modal-video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* Study Notes Modal Specifics */
.modal-notes-dialog {
  max-width: 900px;
}

.modal-notes-body {
  padding: 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(85vh - 120px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.notes-section-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.notes-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.notes-list {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.notes-derivation-step {
  background: var(--bg-glass);
  border-left: 3px solid var(--accent-primary);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.notes-example-box {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.notes-example-q {
  font-weight: 700;
  color: #6ee7b7;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.notes-example-sol {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.notes-tips-badge {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: #fde68a;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.btn-print-notes {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-print-notes:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
}

/* Reference Books Section */
.resources-section {
  margin-top: 3.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.section-title {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.book-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: var(--transition-fast);
}
.book-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.book-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.book-author {
  font-size: 0.82rem;
  color: var(--accent-secondary);
}

.book-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Footer */
.app-footer {
  margin-top: 4rem;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

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

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}
.footer-links a:hover { color: var(--accent-primary); }

/* No results state */
.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  grid-column: 1 / -1;
}

/* ===================================================
   RESPONSIVE DESIGN FOR UNIVERSAL DEVICES
   =================================================== */

/* Tablet & iPad (Portrait & Landscape: 768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .app-container {
    padding: 0 1.5rem 3rem;
  }
  
  .topics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .modal-dialog {
    max-width: 90vw;
  }
}

/* Mobile Devices & Small Tablets (< 768px) */
@media (max-width: 767px) {
  .app-container {
    padding: 0 1rem 3rem;
  }

  .navbar {
    padding: 0.75rem 0;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .brand-info h1 {
    font-size: 1rem;
  }

  .brand-info span {
    display: none; /* Keep navbar clean on small screens */
  }

  .btn-pill-text {
    display: none; /* Icon only on mobile */
  }
  .btn-primary-pill {
    padding: 0.5rem 0.75rem;
  }

  .hero {
    padding: 1.5rem 0 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

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

  .filter-tabs-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .module-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
  }

  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .status-filters {
    width: 100%;
  }
  .select-filter {
    width: 100%;
  }

  .modal-dialog {
    width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-md);
  }

  .modal-notes-body {
    padding: 1rem;
  }
}

/* Print Stylesheet for Printing Study Notes as PDF */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  
  .navbar, .hero, .controls-container, .module-section, .resources-section, .app-footer, .bg-ambient-blob, .btn-print-notes, .modal-close-btn, .modal-footer {
    display: none !important;
  }

  .modal-backdrop {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
    opacity: 1 !important;
  }

  .modal-dialog {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    max-height: none !important;
  }

  .modal-notes-body {
    padding: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .notes-section-box {
    border: 1px solid #ddd !important;
    background: #fff !important;
    color: #000 !important;
    page-break-inside: avoid;
    margin-bottom: 1.5rem;
  }

  .notes-section-title {
    color: #000 !important;
  }

  .notes-list, .notes-derivation-step, .notes-example-sol {
    color: #111 !important;
  }

  .notes-example-box {
    border: 1px solid #bbb !important;
    background: #f9f9f9 !important;
  }
}
