/* ==========================================================================
   SCIENCE OF MATERIALS — MIDTERM STUDY SUITE
   Department of Mechanical Engineering, University of Tehran
   Instructor: Prof. A. Sadeghi | Prepared by: Sina Sharifi (TA)
   Theme: Classic Academic Dark Blue & Gold
   ========================================================================== */

:root {
  --bg-deep: #070d1e;
  --bg-main: #0b152d;
  --bg-card: #101c3d;
  --bg-card-alt: #14244d;
  --bg-card-hover: #192e62;
  --border-classic: rgba(212, 175, 55, 0.35);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --border-gold-glow: rgba(212, 175, 55, 0.65);
  --accent-gold: #d4af37;
  --accent-gold-light: #f3e5ab;
  --accent-gold-dark: #aa820a;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-crimson: #f43f5e;
  --accent-indigo: #818cf8;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-gold: #f5d061;
  --font-serif: 'Cinzel', 'Playfair Display', 'Georgia', 'Cambria', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --shadow-classic: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-gold: 0 0 15px rgba(212, 175, 55, 0.15);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(20, 36, 77, 0.6) 0%, transparent 75%),
    linear-gradient(rgba(212, 175, 55, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Classic Academic Dividers & Borders */
.classic-rule {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--accent-gold) 50%, transparent 100%);
  margin: 2rem 0;
  border: none;
  position: relative;
}

.classic-rule::after {
  content: "✦";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-main);
  padding: 0 12px;
  color: var(--accent-gold);
  font-size: 1rem;
}

.classic-border-box {
  border: 1px solid var(--border-classic);
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-classic);
}

.classic-border-box::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: calc(var(--radius-md) - 2px);
  pointer-events: none;
}

/* Master Header & Navigation */
.site-header {
  background: rgba(11, 21, 45, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-classic);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.5rem;
  transition: var(--transition-smooth);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text-main);
}

.nav-logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #0b152d);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

.nav-brand-text h1 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-gold);
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.nav-brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-gold-light);
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--border-classic);
}

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

/* Main Container Layout */
.master-wrapper {
  max-width: 1360px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem 1.5rem;
}

/* Master Cover Page Hero Banner */
.cover-hero {
  text-align: center;
  padding: 3.5rem 2rem;
  margin-bottom: 3rem;
  background: linear-gradient(180deg, rgba(16, 28, 61, 0.95) 0%, rgba(11, 21, 45, 0.98) 100%);
  border: 1px solid var(--border-classic);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(212, 175, 55, 0.04);
  position: relative;
  overflow: hidden;
}

.cover-hero::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  pointer-events: none;
}

.cover-hero::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px dashed rgba(212, 175, 55, 0.1);
  pointer-events: none;
}

.university-crest {
  margin: 0 auto 1.5rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.university-crest svg {
  filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.4));
}

.university-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.department-subtitle {
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.course-badge {
  display: inline-block;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--border-classic);
  color: var(--accent-gold-light);
  padding: 0.35rem 1.25rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.course-main-title {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.7), 0 0 25px rgba(212, 175, 55, 0.2);
}

.course-doc-type {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--accent-gold);
  font-style: italic;
  margin-bottom: 1.75rem;
}

/* Attributions Grid */
.attribution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 900px;
  margin: 2rem auto 0;
  text-align: left;
}

.attribution-card {
  background: rgba(7, 13, 30, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.35rem;
  position: relative;
}

.attribution-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-gold);
}

.attribution-role {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.attribution-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.attribution-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
}

/* Midterm Scope Callout */
.scope-callout {
  margin-top: 2rem;
  padding: 1.2rem;
  background: rgba(30, 58, 138, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: #bae6fd;
  max-width: 850px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.scope-callout svg {
  flex-shrink: 0;
  color: var(--accent-cyan);
}

/* Quick Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border-classic);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-classic);
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Chapter Directory Cards Grid */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-classic);
}

.chapter-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-gold), transparent);
  opacity: 0;
  transition: var(--transition-smooth);
}

.chapter-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-classic);
  background: var(--bg-card-alt);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--shadow-gold);
}

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

.chapter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chapter-num-badge {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-gold);
  text-transform: uppercase;
  background: rgba(212, 175, 55, 0.1);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.chapter-problem-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
}

.chapter-card-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.chapter-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-grow: 1;
  line-height: 1.55;
}

.chapter-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.tag-pill {
  font-size: 0.72rem;
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.chapter-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-gold-light);
  padding-top: 0.75rem;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
  transition: var(--transition-smooth);
}

.chapter-card:hover .chapter-card-btn {
  color: #ffffff;
  border-top-color: var(--accent-gold);
}

/* Chapter Hero Section (on chapter pages) */
.chapter-hero {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-main) 100%);
  border: 1px solid var(--border-classic);
  border-radius: var(--radius-md);
  padding: 2.25rem 2rem;
  margin-bottom: 2rem;
  position: relative;
  box-shadow: var(--shadow-classic);
}

.chapter-hero::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: calc(var(--radius-md) - 2px);
  pointer-events: none;
}

.chapter-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chapter-hero h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: #ffffff;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

.chapter-overview-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 950px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Controls Toolbar */
.toolbar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-classic);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 65px;
  z-index: 90;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
}

.search-input {
  background: rgba(7, 13, 30, 0.8);
  border: 1px solid var(--border-classic);
  color: var(--text-main);
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  width: 240px;
  outline: none;
  transition: var(--transition-smooth);
}

.search-input:focus {
  border-color: var(--accent-gold);
  width: 280px;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

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

.select-filter {
  background: rgba(7, 13, 30, 0.8);
  border: 1px solid var(--border-classic);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.btn-classic {
  background: linear-gradient(180deg, #182b59 0%, #0d1736 100%);
  border: 1px solid var(--border-classic);
  color: var(--accent-gold-light);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-classic:hover {
  background: linear-gradient(180deg, #223c7c 0%, #132247 100%);
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.btn-classic.btn-gold {
  background: linear-gradient(180deg, #d4af37 0%, #aa820a 100%);
  color: #070d1e;
  border-color: #f3e5ab;
  font-weight: 700;
}

.btn-classic.btn-gold:hover {
  background: linear-gradient(180deg, #e5c04e 0%, #bc9315 100%);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

/* Diagrams Showcase Container */
.diagram-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-classic);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  position: relative;
  box-shadow: var(--shadow-classic);
}

.diagram-panel-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-gold);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 0.5rem;
}

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

.diagram-item {
  background: rgba(7, 13, 30, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  transition: var(--transition-smooth);
}

.diagram-item:hover {
  border-color: var(--border-classic);
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.diagram-svg-wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto 0.75rem auto;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #080f24;
  padding: 0.5rem;
  border: 1px solid rgba(212, 175, 55, 0.1);
}

.diagram-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

.diagram-caption strong {
  color: var(--text-gold);
  font-style: normal;
}

/* Problem Cards Container */
.problem-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.problem-card {
  background: var(--bg-card);
  border: 1px solid var(--border-classic);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  position: relative;
  box-shadow: var(--shadow-classic);
  transition: var(--transition-smooth);
}

.problem-card::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: calc(var(--radius-md) - 2px);
  pointer-events: none;
}

.problem-card:hover {
  border-color: var(--border-gold-glow);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(212, 175, 55, 0.1);
}

.problem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  padding-bottom: 0.75rem;
}

.problem-num-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.problem-badge {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-gold);
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--border-classic);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.problem-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.difficulty-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
}

.diff-fundamental {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.diff-intermediate {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.diff-advanced {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.problem-actions-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-bookmark {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-bookmark:hover, .btn-bookmark.active {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: rgba(212, 175, 55, 0.1);
}

.problem-statement {
  font-size: 1rem;
  line-height: 1.7;
  color: #ffffff;
  margin-bottom: 1.25rem;
}

.problem-statement p {
  margin-bottom: 0.75rem;
}

.problem-statement ul, .problem-statement ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.problem-statement li {
  margin-bottom: 0.35rem;
}

.solution-toggle-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.btn-toggle-solution {
  background: linear-gradient(180deg, #172554 0%, #0f172a 100%);
  border: 1px solid var(--border-classic);
  color: var(--accent-gold-light);
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.btn-toggle-solution:hover {
  background: linear-gradient(180deg, #1e3a8a 0%, #172554 100%);
  border-color: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

.btn-toggle-solution svg {
  transition: transform 0.25s ease;
}

.btn-toggle-solution.expanded svg {
  transform: rotate(180deg);
}

/* Solution Box */
.solution-container {
  display: none;
  margin-top: 1.25rem;
  padding: 1.5rem;
  background: rgba(7, 13, 30, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-sm);
  position: relative;
  animation: fadeIn 0.3s ease;
}

.solution-container.visible {
  display: block;
}

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

.solution-heading {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  padding-bottom: 0.5rem;
}

.solution-step {
  margin-bottom: 1rem;
  font-size: 0.925rem;
  line-height: 1.65;
}

.solution-step-title {
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.final-answer-box {
  margin-top: 1.25rem;
  padding: 0.85rem 1.15rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  color: #a7f3d0;
  font-size: 0.95rem;
  font-weight: 500;
}

.final-answer-box strong {
  color: #34d399;
  font-family: var(--font-serif);
}

/* Formula & Math Display Styling */
.formula-block {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #e2e8f0;
}

/* Modal Formula Compendium */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-classic);
  border-radius: var(--radius-md);
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  position: relative;
}

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

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--accent-gold);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Master Formula Table */
.formula-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.formula-table th, .formula-table td {
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(212, 175, 55, 0.2);
  text-align: left;
}

.formula-table th {
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent-gold);
  font-family: var(--font-serif);
  font-weight: 600;
}

.formula-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Chapter Bottom Navigation */
.chapter-bottom-nav {
  margin-top: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-classic);
  border-bottom: 1px solid var(--border-classic);
}

.chapter-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-classic);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.chapter-nav-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  color: var(--accent-gold-light);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Master Footer */
.site-footer {
  margin-top: 5rem;
  padding: 3rem 1.5rem;
  background: rgba(7, 13, 30, 0.95);
  border-top: 1px solid var(--border-classic);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.site-footer p {
  margin-bottom: 0.5rem;
}

.footer-gold-text {
  color: var(--accent-gold);
  font-family: var(--font-serif);
  font-weight: 600;
}

/* Floating Back to Top Button */
.btn-back-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-classic);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
  z-index: 95;
}

.btn-back-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-back-top:hover {
  background: var(--accent-gold);
  color: #070d1e;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .course-main-title {
    font-size: 2rem;
  }
  .nav-brand-text p {
    display: none;
  }
  .toolbar-container {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-left, .toolbar-right {
    justify-content: space-between;
  }
  .search-input {
    width: 100%;
  }
  .chapter-bottom-nav {
    flex-direction: column;
  }
  .chapter-nav-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Print Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .site-header, .toolbar-container, .btn-toggle-solution, .site-footer, .btn-back-top {
    display: none !important;
  }
  .problem-card {
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: avoid;
    box-shadow: none !important;
  }
  .solution-container {
    display: block !important;
    background: #f8f9fa !important;
    color: #000000 !important;
    border-left: 3px solid #333333 !important;
  }
}
