/* ============================================
   AP Course Platform - Global Styles
   嘉定一中 × 留学邦 联合出品
   ============================================ */

/* --- CSS Variables --- */
:root {
  /* Brand Colors */
  --primary: #1a3a5c;        /* 嘉定一中深蓝 */
  --primary-light: #2a5a8c;
  --primary-dark: #0f2440;
  --accent: #e8b931;         /* 金色点缀 */
  --accent-light: #f0d060;

  /* Neutral Colors */
  --bg: #f5f7fa;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --text-muted: #95a5a6;
  --border: #e1e8ed;
  --border-light: #f0f3f5;

  /* Status Colors */
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;

  /* Layout */
  --max-width: 1200px;
  --nav-height: 64px;
  --sidebar-width: 280px;

  /* Typography */
  --font-main: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-heading: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Transitions */
  --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Navigation --- */
.navbar {
  background: var(--primary);
  color: white;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
}

.navbar-brand img {
  height: 40px;
  width: auto;
}

.navbar-brand .school-name {
  letter-spacing: 1px;
}

.navbar-brand .course-label {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.3);
  font-weight: 400;
  font-size: 0.95rem;
  opacity: 0.9;
}

.navbar-nav {
  margin-left: auto;
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.navbar-nav a {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.navbar-nav a:hover,
.navbar-nav a.active {
  color: white;
  border-bottom-color: var(--accent);
}

/* --- Hero Section --- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(232,185,49,0.1) 0%, transparent 60%);
  pointer-events: none;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  position: relative;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
  position: relative;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
}

.hero-badge {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.2);
}

/* --- Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

/* --- Course Cards (Homepage) --- */
.courses-section {
  padding: 4rem 0;
}

.courses-section h2 {
  text-align: center;
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.courses-section .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 3rem;
  font-size: 1rem;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 2rem;
}

.course-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.course-card-header {
  padding: 2rem;
  color: white;
  position: relative;
}

.course-card-header.calc {
  background: linear-gradient(135deg, #1a3a5c, #2a6ab0);
}

.course-card-header.micro {
  background: linear-gradient(135deg, #1a5c3a, #2ab06a);
}

.course-card-header .card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
}

.course-card-header h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.course-card-header .card-subtitle {
  opacity: 0.9;
  font-size: 0.95rem;
}

.course-card-body {
  padding: 1.5rem 2rem 2rem;
}

.course-card-body .card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-item .stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.course-card-body .card-desc {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

.course-card-body .card-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topic-tag {
  background: var(--bg);
  color: var(--text-light);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
}

/* --- Course Page Layout --- */
.course-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-height));
}

.course-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  overflow-y: auto;
  flex-shrink: 0;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  color: var(--text);
  font-size: 0.9rem;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: var(--bg);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-link.active {
  background: rgba(26, 58, 92, 0.06);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-link .link-icon {
  width: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sidebar-link.active .link-icon {
  color: var(--primary);
}

.sidebar-link .link-status {
  margin-left: auto;
  font-size: 0.7rem;
}

.status-complete {
  color: var(--success);
}

.status-progress {
  color: var(--warning);
}

/* --- Main Content --- */
.course-content {
  flex: 1;
  padding: 2rem 3rem;
  max-width: 900px;
}

.course-content h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.course-content h2 {
  font-size: 1.4rem;
  color: var(--primary);
  margin: 2rem 0 1rem;
}

.course-content h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin: 1.5rem 0 0.75rem;
}

.content-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.content-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Video Player --- */
.video-container {
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 2rem;
  position: relative;
  aspect-ratio: 16/9;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  font-size: 1.2rem;
  flex-direction: column;
  gap: 1rem;
}

.video-placeholder .play-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background var(--transition);
}

.video-placeholder .play-icon:hover {
  background: rgba(255,255,255,0.25);
}

/* --- PPT Preview --- */
.ppt-section {
  margin-bottom: 2rem;
}

.ppt-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-white);
}

.ppt-preview iframe {
  width: 100%;
  height: 500px;
  border: none;
}

.ppt-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 500;
}

.ppt-download {
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.ppt-download:hover {
  background: var(--primary-light);
  color: white;
}

/* --- Unit Card Grid --- */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
}

.unit-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
  color: inherit;
}

.unit-card .unit-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.unit-card h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.unit-card p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.unit-card .unit-resources {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.unit-card .unit-resources span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* --- Progress Bar --- */
.progress-bar-container {
  background: var(--border-light);
  border-radius: 50px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 50px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.3rem;
}

/* --- Quiz Styles --- */
.quiz-container {
  max-width: 800px;
}

.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.quiz-question h4 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9rem;
}

.quiz-option:hover {
  border-color: var(--primary-light);
  background: rgba(26, 58, 92, 0.03);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: rgba(26, 58, 92, 0.08);
}

.quiz-option input[type="radio"] {
  accent-color: var(--primary);
}

.quiz-submit {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: 1rem;
}

.quiz-submit:hover {
  background: var(--primary-light);
}

/* --- Practice Links --- */
.practice-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.practice-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.practice-link:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  color: inherit;
}

.practice-link .link-title {
  font-weight: 500;
}

.practice-link .link-arrow {
  color: var(--text-muted);
  transition: transform var(--transition);
}

.practice-link:hover .link-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* --- Stage Layout (Microeconomics) --- */
.stage-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}

.stage-tab {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.stage-tab:hover {
  color: var(--primary);
}

.stage-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* --- Footer --- */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.8);
  padding: 2rem;
  text-align: center;
  margin-top: auto;
}

.footer .footer-brand {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.footer .copyright {
  font-size: 0.8rem;
  opacity: 0.6;
}

.footer a {
  color: rgba(255,255,255,0.8);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }

  .navbar-brand .course-label {
    display: none;
  }

  .navbar-nav {
    gap: 1rem;
    font-size: 0.85rem;
  }

  .hero {
    padding: 3rem 1rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .course-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 1rem;
  }

  .course-layout {
    flex-direction: column;
  }

  .course-sidebar {
    width: 100%;
    position: relative;
    height: auto;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 300px;
  }

  .course-content {
    padding: 1.5rem;
  }

  .unit-grid {
    grid-template-columns: 1fr;
  }

  .course-card-body .card-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }

  .course-card-header {
    padding: 1.25rem;
  }

  .course-card-body {
    padding: 1rem 1.25rem 1.25rem;
  }
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none; }

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeIn 0.4s ease forwards;
}

/* --- Notes Section --- */
.notes-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.notes-section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--primary);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.note-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.note-item:hover {
  background: rgba(26, 58, 92, 0.05);
  text-decoration: none;
  color: inherit;
}

.note-item .note-icon {
  font-size: 1.2rem;
}

.note-item .note-info {
  flex: 1;
}

.note-item .note-title {
  font-weight: 500;
}

.note-item .note-type {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--text-light);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .separator {
  color: var(--text-muted);
}

/* --- Tabs --- */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --- Section Cards Grid (Unit Overview) --- */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
}

.section-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
  color: inherit;
}

.section-card .section-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-light);
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.section-card h3 {
  font-size: 0.95rem;
  margin: 0 0 0.3rem;
  color: var(--text);
  line-height: 1.4;
}

.section-card .section-cn {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 0.6rem;
}

.section-card .section-resources {
  display: flex;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.section-card .section-resources span {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

/* --- Section Detail Quiz Styles --- */
.quiz-option.correct {
  border-color: var(--success);
  background: rgba(39,174,96,0.08);
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: rgba(231,76,60,0.08);
}

/* --- Video Watermark --- */
.video-watermark-wrap {
  position: relative;
}

.video-watermark {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 4px;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
