/* ==========================================================================
   CHSE Odisha Class 11 (1st Year) IT — Shared Stylesheet
   Matches NextNote design system (--ng-navy, --emerald, Montserrat)
   ========================================================================== */

:root {
  --chse-navy: var(--ng-navy-dark, #141464);
  --chse-navy-deep: var(--ng-navy-deep, #0A0A3C);
  --chse-sky: var(--ng-sky, #5AB4E1);
  --chse-gold: var(--ng-gold, #E1B41E);
  --chse-emerald: #059669;
  --chse-emerald-dark: #065f46;
  --unit-accent: #059669;
  --unit-accent-dark: #065f46;
  --unit-accent-soft: #ecfdf5;
  --unit-border-soft: #a7f3d0;
  --chse-surface: #ffffff;
  --chse-muted-bg: #f8fafc;
  --chse-ink: #0f172a;
  --chse-slate: #475569;
  --chse-border: #e2e8f0;
  --chse-radius: 16px;
}

/* Unit Accent Themes */
.theme-hub     { --unit-accent: #1d4ed8; --unit-accent-dark: #141464; --unit-accent-soft: #eff6ff; --unit-border-soft: #bfdbfe; }
.theme-unit1   { --unit-accent: #059669; --unit-accent-dark: #065f46; --unit-accent-soft: #ecfdf5; --unit-border-soft: #a7f3d0; }
.theme-unit2   { --unit-accent: #0284c7; --unit-accent-dark: #0c4a6e; --unit-accent-soft: #f0f9ff; --unit-border-soft: #bae6fd; }
.theme-unit3   { --unit-accent: #6d28d9; --unit-accent-dark: #4c1d95; --unit-accent-soft: #f5f3ff; --unit-border-soft: #ddd6fe; }
.theme-unit4   { --unit-accent: #c2410c; --unit-accent-dark: #7c2d12; --unit-accent-soft: #fff7ed; --unit-border-soft: #fed7aa; }

/* Page Hero */
.chse-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--chse-navy-deep) 0%, var(--chse-navy) 52%, var(--unit-accent-dark) 100%);
  color: #ffffff;
  padding: 2.5rem 0 2.25rem;
  border-bottom: 4px solid var(--chse-gold);
}

.chse-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 88% 18%, rgba(90, 180, 225, 0.22), transparent 45%),
              radial-gradient(circle at 12% 85%, rgba(225, 180, 30, 0.16), transparent 42%);
  pointer-events: none;
}

.chse-hero .container { position: relative; z-index: 1; }

.chse-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.9rem;
}

.chse-breadcrumb a {
  color: #bae6fd;
  text-decoration: none;
}
.chse-breadcrumb a:hover { color: #ffffff; text-decoration: underline; }

.chse-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.chse-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.34rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.chse-pill-badge.gold {
  background: rgba(225, 180, 30, 0.2);
  border-color: rgba(225, 180, 30, 0.65);
  color: #fde68a;
}

.chse-hero h1 {
  font-size: clamp(1.65rem, 3.1vw, 2.55rem);
  font-weight: 800;
  line-height: 1.22;
  margin-bottom: 0.65rem;
  color: #ffffff;
}

.chse-hero-sub {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(241, 245, 249, 0.92);
  max-width: 820px;
  margin-bottom: 1.25rem;
}

.chse-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.chse-stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.chse-stat-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
}

.chse-stat-box .stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(226, 232, 240, 0.8);
}

.chse-stat-box .stat-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 0.15rem;
}

/* Sticky Quick Navigation Bar */
.quick-nav-bar {
  position: sticky;
  top: var(--chse-nav-h, 64px);
  z-index: 90;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--chse-border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  padding: 0.55rem 0;
}

.quick-nav-scroll {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.quick-nav-scroll::-webkit-scrollbar { display: none; }

.quick-nav-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.9rem;
  min-height: 36px;
  border-radius: 999px;
  background: var(--chse-muted-bg);
  border: 1px solid var(--chse-border);
  color: var(--chse-ink);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.quick-nav-pill:hover,
.quick-nav-pill.active {
  background: var(--unit-accent);
  border-color: var(--unit-accent);
  color: #ffffff;
}

/* Main Content Layout & Cards */
.chse-main-wrap {
  background: #f1f5f9;
  padding: 2rem 0 3rem;
}

.chse-main-wrap .row > [class*="col-"] {
  min-width: 0;
}

.note-section-card {
  background: var(--chse-surface);
  border: 1px solid var(--chse-border);
  border-radius: var(--chse-radius);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
  padding: 1.65rem 1.75rem;
  margin-bottom: 1.65rem;
  scroll-margin-top: calc(var(--chse-nav-h, 64px) + 64px);
  min-width: 0;
  overflow-wrap: break-word;
}

.note-section-card code,
.note-section-card a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .chse-hero {
    padding: 1.75rem 0 1.5rem;
  }
  .chse-hero-actions .btn {
    flex: 1 1 calc(50% - 0.35rem);
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .chse-stat-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
    margin-top: 1.1rem;
  }
  .chse-stat-box {
    padding: 0.6rem 0.75rem;
  }
  .chse-stat-box .stat-value {
    font-size: 0.94rem;
  }
  .chse-main-wrap {
    padding: 1.25rem 0 2.25rem;
  }
  .note-section-card {
    padding: 1.15rem 0.95rem;
    border-radius: 14px;
    margin-bottom: 1.15rem;
  }
  .chapter-banner {
    padding: 0.85rem 0.95rem;
  }
  .pdf-embed-box iframe {
    height: 340px;
  }
  .chse-sidebar {
    position: static;
  }
}

@media (max-width: 575.98px) {
  .chse-hero-actions .btn {
    flex: 1 1 100%;
  }
  .pointer-grid,
  .mindmap-grid,
  .quiz-options,
  .unit-pager-grid {
    grid-template-columns: 1fr !important;
  }
  .mindmap-shell {
    padding: 0.9rem 0.75rem;
  }
  .mindmap-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .mindmap-toolbar .d-flex {
    width: 100%;
  }
  .mindmap-toolbar .btn {
    flex: 1;
  }
  .diagram-figure {
    padding: 0.75rem 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .diagram-figure svg {
    min-width: 560px;
  }
  .diagram-figure figcaption {
    position: sticky;
    left: 0;
  }
  .custom-table thead th,
  .custom-table td {
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    white-space: normal;
  }
  .quiz-wrapper {
    padding: 0.9rem 0.75rem;
  }
}

.chapter-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--unit-accent-soft), #ffffff);
  border: 1px solid var(--unit-border-soft);
  border-left: 6px solid var(--unit-accent);
  margin-bottom: 1.35rem;
}

.chapter-banner h2 {
  font-size: clamp(1.22rem, 2.2vw, 1.55rem);
  font-weight: 800;
  color: var(--chse-ink);
  margin: 0;
}

.chapter-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chapter-meta-badges span {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--unit-border-soft);
  color: var(--unit-accent-dark);
}

.section-heading-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  background: var(--unit-accent-soft);
  color: var(--unit-accent-dark);
  border: 1px solid var(--unit-border-soft);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
}

.note-section-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--chse-navy);
  margin: 1.35rem 0 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #f1f5f9;
}

.note-section-card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 1rem 0 0.45rem;
}

/* Callout & Definition Boxes */
.definition-box {
  background: #f8fafc;
  border-left: 5px solid var(--chse-navy);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.15rem;
  margin: 1rem 0;
}

.callout-box-amber {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 5px solid #d97706;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin: 1rem 0;
  color: #78350f;
}

.callout-box-blue {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid #2563eb;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin: 1rem 0;
  color: #1e3a8a;
}

.callout-box-green {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-left: 5px solid #059669;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin: 1rem 0;
  color: #064e3b;
}

/* Scannable Pointers Grid */
.pointer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.pointer-card {
  background: var(--chse-muted-bg);
  border: 1px solid var(--chse-border);
  border-top: 3px solid var(--unit-accent);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  min-width: 0;
}

.pointer-card h4,
.pointer-card .pc-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--chse-ink);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pointer-card ul,
.pointer-card ol {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
  color: #334155;
}

.pointer-card li { margin-bottom: 0.32rem; }

/* Responsive Tables */
.custom-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border: 1px solid var(--chse-border);
  border-radius: 12px;
  margin: 1rem 0;
}

.custom-table-wrap .custom-table {
  display: table !important;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #ffffff;
}

.custom-table thead th {
  background: var(--chse-navy);
  color: #ffffff;
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 0.9rem;
  white-space: nowrap;
}

.custom-table td {
  padding: 0.68rem 0.9rem;
  border-top: 1px solid var(--chse-border);
  vertical-align: top;
  color: #1e293b;
}

.custom-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

/* Code & SQL Blocks */
.code-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1e293b;
  margin: 1rem 0;
  background: #0f172a;
}

.code-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
}

.code-card pre {
  margin: 0;
  padding: 0.95rem 1.05rem;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  overflow-x: auto;
}

.copy-code-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  border-radius: 6px;
  padding: 0.18rem 0.55rem;
  font-size: 0.74rem;
  cursor: pointer;
}
.copy-code-btn:hover { background: rgba(255, 255, 255, 0.22); }

/* SVG Diagram & Infographic Figures */
.diagram-figure {
  background: #ffffff;
  border: 1px solid var(--chse-border);
  border-radius: 14px;
  padding: 1rem;
  margin: 1.25rem 0;
  text-align: center;
  box-shadow: inset 0 1px 0 #ffffff, 0 4px 12px rgba(15, 23, 42, 0.04);
}

.diagram-figure svg {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.diagram-figure figcaption {
  margin-top: 0.65rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--chse-slate);
}

/* Interactive Visual Mindmap Canvas */
.mindmap-shell {
  background: linear-gradient(180deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid var(--unit-border-soft);
  border-radius: 16px;
  padding: 1.25rem;
  margin: 1.25rem 0;
}

.mindmap-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.mindmap-root-node {
  max-width: 520px;
  margin: 0 auto 1.25rem;
  text-align: center;
  background: linear-gradient(135deg, var(--chse-navy), var(--unit-accent-dark));
  color: #ffffff;
  padding: 0.85rem 1.35rem;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(20, 20, 100, 0.18);
  position: relative;
}

.mindmap-root-node::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 2px;
  height: 14px;
  background: var(--unit-accent);
  transform: translateX(-50%);
}

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

.mindmap-branch {
  background: #ffffff;
  border: 1px solid var(--chse-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.mindmap-branch-head {
  width: 100%;
  border: 0;
  text-align: left;
  padding: 0.72rem 0.95rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}

.mindmap-branch[data-tone="emerald"] .mindmap-branch-head { background: #059669; }
.mindmap-branch[data-tone="navy"]    .mindmap-branch-head { background: #1e3a8a; }
.mindmap-branch[data-tone="sky"]     .mindmap-branch-head { background: #0284c7; }
.mindmap-branch[data-tone="violet"]  .mindmap-branch-head { background: #6d28d9; }
.mindmap-branch[data-tone="amber"]   .mindmap-branch-head { background: #b45309; }
.mindmap-branch[data-tone="rose"]    .mindmap-branch-head { background: #be123c; }
.mindmap-branch[data-tone="teal"]    .mindmap-branch-head { background: #0f766e; }

.mindmap-branch-body {
  padding: 0.75rem 0.95rem;
}

.mindmap-branch.is-collapsed .mindmap-branch-body {
  display: none;
}

.mindmap-branch-body ul {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.85rem;
  color: #334155;
}

.mindmap-branch-body li {
  margin-bottom: 0.32rem;
}

/* Interactive MCQ Quiz Cards */
.quiz-wrapper {
  background: #f8fafc;
  border: 1px solid var(--chse-border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-top: 1rem;
}

.quiz-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--chse-border);
}

.quiz-card {
  background: #ffffff;
  border: 1px solid var(--chse-border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.9rem;
}

.quiz-q {
  font-weight: 700;
  color: var(--chse-ink);
  margin-bottom: 0.65rem;
  font-size: 0.95rem;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
}

.quiz-option {
  text-align: left;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.87rem;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--unit-accent);
  background: var(--unit-accent-soft);
}

.quiz-option.is-correct {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
  font-weight: 700;
}

.quiz-option.is-wrong {
  background: #fee2e2;
  border-color: #dc2626;
  color: #7f1d1d;
}

.quiz-explain {
  display: none;
  margin-top: 0.65rem;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.84rem;
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  color: #1e3a8a;
}

.quiz-explain.show { display: block; }

/* Textbook PDF Viewer Card */
.pdf-ref-card {
  background: linear-gradient(135deg, #f8fafc, #ecfdf5);
  border: 1px solid #a7f3d0;
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}

.pdf-embed-box {
  display: none;
  margin-top: 0.9rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.pdf-embed-box.open { display: block; }

.pdf-embed-box iframe {
  width: 100%;
  height: 520px;
  border: 0;
}

/* Sidebar */
.chse-sidebar {
  position: sticky;
  top: 132px;
}

.sidebar-widget {
  background: #ffffff;
  border: 1px solid var(--chse-border);
  border-radius: 14px;
  padding: 1.15rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.sidebar-widget h5 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--chse-navy);
  margin-bottom: 0.85rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--unit-accent-soft);
}

.sidebar-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-list li { margin-bottom: 0.4rem; }

.sidebar-nav-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.5rem 0.72rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  background: #f8fafc;
  border: 1px solid transparent;
}

.sidebar-nav-list a:hover {
  background: var(--unit-accent-soft);
  color: var(--unit-accent-dark);
}

.sidebar-nav-list a.active {
  background: var(--unit-accent);
  color: #ffffff;
}

/* Prev / Hub / Next Pager */
.unit-pager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.unit-pager-card {
  display: block;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid var(--chse-border);
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
  color: var(--chse-ink);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.unit-pager-card:hover {
  transform: translateY(-2px);
  border-color: var(--unit-accent);
  color: var(--unit-accent-dark);
}

@media print {
  .quick-nav-bar,
  .chse-sidebar,
  .pdf-ref-card button,
  .quiz-header-bar button,
  .copy-code-btn {
    display: none !important;
  }
  .mindmap-branch.is-collapsed .mindmap-branch-body {
    display: block !important;
  }
  .note-section-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
