/* ==========================================================================
   EduResource ZA · SACAI Master Design System & Typography Stylesheet
   Supports both Light Mode & Luxury Dark Mode
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=Space+Grotesk:wght@500;600;700&family=Fira+Code:wght@400;500;600&display=swap');

:root {
  --sacai-bg: #0b1120;
  --sacai-surface: #131d31;
  --sacai-surface-alt: #1e293b;
  --sacai-surface-elevated: #24344d;
  --sacai-border: #2e3e5c;
  --sacai-border-subtle: #1e293b;
  --sacai-text: #f1f5f9;
  --sacai-text-muted: #94a3b8;
  --sacai-primary: #d6073b;
  --sacai-primary-hover: #b00530;
  --sacai-blue: #38bdf8;
  --sacai-blue-glow: rgba(56, 189, 248, 0.15);
  --sacai-green: #10b981;
  --sacai-amber: #f59e0b;
  --sacai-purple: #a855f7;
  --sacai-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sacai-font-display: 'Plus Jakarta Sans', var(--sacai-font-sans);
  --sacai-font-heading: 'Space Grotesk', var(--sacai-font-sans);
  --sacai-font-mono: 'Fira Code', 'Courier New', monospace;
  --sacai-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --sacai-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --sacai-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* Base Body Styles */
body.sacai-guide-body, body.sacai-mock-body {
  margin: 0;
  padding: 0;
  background-color: var(--sacai-bg);
  color: var(--sacai-text);
  font-family: var(--sacai-font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Watermark and View-Only Protection */
body.sacai-guide-body::before, body.sacai-mock-body::before {
  content: "EDURESOURCE ZA · SACAI CURRICULUM ARCHIVE · LICENSED VIEW ONLY";
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-family: var(--sacai-font-heading);
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.018);
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

/* Global Container */
.sacai-guide-container, .sacai-mock-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* Header & Nav */
.sacai-nav-header {
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sacai-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
}

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

.sacai-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #ffffff;
  font-family: var(--sacai-font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.sacai-badge-sm {
  background: var(--sacai-primary);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 6px;
}

.sacai-nav-breadcrumbs {
  font-size: 0.85rem;
  color: var(--sacai-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sacai-nav-breadcrumbs a {
  color: var(--sacai-blue);
  text-decoration: none;
  transition: color 0.2s;
}

.sacai-nav-breadcrumbs a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Hero Section */
.sacai-guide-hero {
  background: linear-gradient(180deg, #131d31 0%, #0b1120 100%);
  border: 1px solid var(--sacai-border);
  border-radius: 16px;
  padding: 2.75rem 2.25rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--sacai-shadow-md);
  position: relative;
  overflow: hidden;
}

.sacai-guide-hero::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 350px;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(214, 7, 59, 0.12), transparent 70%);
  pointer-events: none;
}

.sacai-guide-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(214, 7, 59, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 1.25rem;
}

.sacai-guide-hero h1 {
  font-family: var(--sacai-font-display);
  font-size: 2.35rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
}

.sacai-guide-subtitle {
  font-size: 1.08rem;
  color: #cbd5e1;
  line-height: 1.6;
  max-width: 860px;
  margin: 0 0 1.75rem;
}

.sacai-guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--sacai-text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.25rem;
}

.sacai-guide-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Sections & Content */
.sacai-guide-section {
  background: var(--sacai-surface);
  border: 1px solid var(--sacai-border);
  border-radius: 14px;
  padding: 2.25rem;
  margin-bottom: 2.25rem;
  box-shadow: var(--sacai-shadow-sm);
}

.sacai-guide-section h2 {
  font-family: var(--sacai-font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--sacai-border);
}

.sacai-guide-section h3 {
  font-family: var(--sacai-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sacai-blue);
  margin: 1.75rem 0 0.85rem;
}

.sacai-guide-section p {
  color: #e2e8f0;
  margin-bottom: 1.15rem;
}

.sacai-guide-section ul, .sacai-guide-section ol {
  color: #cbd5e1;
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.sacai-guide-section li {
  margin-bottom: 0.5rem;
}

/* Callouts & Alert Boxes */
.sacai-callout {
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid;
}

.sacai-callout-info {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.35);
  color: #e0f2fe;
}

.sacai-callout-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fef3c7;
}

.sacai-callout h4 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-tag {
  background: var(--sacai-blue);
  color: #0b1120;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}

/* Formula & Calculation Boxes */
.formula-box, .calc-step-box {
  background: #080d1a;
  border-left: 4px solid var(--sacai-blue);
  border-radius: 0 10px 10px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  color: #f8fafc;
}

/* Code Blocks */
.code-block {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  font-family: var(--sacai-font-mono);
  font-size: 0.92rem;
  color: #38bdf8;
  overflow-x: auto;
  margin: 1.25rem 0;
  line-height: 1.6;
}

/* Tables */
.market-table, .diet-table, .costing-table, .egd-table, .norm-table, .agri-table, .acc-table, .punnett-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

.market-table th, .diet-table th, .costing-table th, .egd-table th, .norm-table th, .agri-table th, .acc-table th, .punnett-table th {
  background: #17243c;
  color: var(--sacai-blue);
  padding: 11px 14px;
  text-align: left;
  border: 1px solid var(--sacai-border);
  font-weight: 700;
}

.market-table td, .diet-table td, .costing-table td, .egd-table td, .norm-table td, .agri-table td, .acc-table td, .punnett-table td {
  padding: 10px 14px;
  border: 1px solid var(--sacai-border);
  background: var(--sacai-surface);
  color: #cbd5e1;
}

.market-table tr:nth-child(even) td, .diet-table tr:nth-child(even) td, .costing-table tr:nth-child(even) td, 
.egd-table tr:nth-child(even) td, .norm-table tr:nth-child(even) td, .agri-table tr:nth-child(even) td {
  background: #0e172a;
}

/* Mock Exam Header & Cards */
.sacai-exam-paper-header {
  background: #131d31;
  border: 1px solid var(--sacai-border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.sacai-exam-badge {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--sacai-primary);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.sacai-exam-paper-header h2 {
  font-size: 1.15rem;
  color: var(--sacai-text-muted);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.sacai-exam-paper-header h1 {
  font-family: var(--sacai-font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 1.25rem;
}

.sacai-exam-meta-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: #cbd5e1;
  background: #0b1120;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--sacai-border);
}

.sacai-memo-toggle-btn {
  background: #0284c7;
  color: #ffffff;
  border: none;
  font-family: var(--sacai-font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
  transition: all 0.2s ease;
}

.sacai-memo-toggle-btn:hover {
  background: #0369a1;
  transform: translateY(-2px);
}

.sacai-question-card {
  background: var(--sacai-surface);
  border: 1px solid var(--sacai-border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.sacai-question-card h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 1rem;
}

.sacai-mcq-options {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0;
}

.sacai-mcq-options li {
  background: #080d1a;
  border: 1px solid var(--sacai-border);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  color: #e2e8f0;
}

.sacai-q-mark {
  text-align: right;
  font-weight: 800;
  color: var(--sacai-blue);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* Footer */
.sacai-footer {
  background: #080d1a;
  border-top: 1px solid var(--sacai-border);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--sacai-text-muted);
  font-size: 0.88rem;
  margin-top: 4rem;
}

.sacai-footer a {
  color: var(--sacai-blue);
  text-decoration: none;
  margin: 0 0.5rem;
}

.sacai-footer a:hover {
  text-decoration: underline;
  color: #ffffff;
}

/* Dark mode image container fixes */
.sacai-dark-card-img {
  background: #ffffff !important;
  border-radius: 10px;
  padding: 12px;
  display: inline-block;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* KaTeX Overrides for dark backgrounds */
.katex {
  color: #38bdf8 !important;
  font-size: 1.1em;
}

.katex-display {
  margin: 1rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}
