/* ============================================================
   NCERT Solutions &mdash; Design Tokens & Layout
   ============================================================ */

/* ----- Breadcrumb ----- */
.breadcrumb-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
}

.breadcrumb li + li::before {
  content: '/';
  margin-right: 0.5rem;
  color: var(--border);
}

.breadcrumb a {
  color: var(--primary-base);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ----- Chapter Hero ----- */
.chapter-hero {
  background: var(--white);
  padding: 2.5rem 0;
  text-align: center;
}

.chapter-hero .badge {
  margin-bottom: 0.75rem;
}

.chapter-hero h1 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.chapter-summary {
  max-width: 700px;
  margin: 0 auto 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

.chapter-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.chapter-meta .meta-sep {
  margin: 0 0.5rem;
}

@media (min-width: 768px) {
  .chapter-hero h1 {
    font-size: 2rem;
  }
}

/* ----- Two-Column NCERT Layout ----- */
.ncert-content {
  background: var(--bg-base);
  padding: 2rem 0 4rem;
}

.ncert-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .ncert-layout {
    grid-template-columns: 260px 1fr;
  }
}

/* ----- Sidebar ----- */
.ncert-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
}

.sidebar-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Exercise Quick-Jump */
.exercise-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.exercise-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all 150ms ease;
}

.exercise-nav a:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.exercise-nav a span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Chapter Navigation (other chapters) */
.chapter-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.chapter-nav a {
  padding: 0.45rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all 150ms ease;
}

.chapter-nav a:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.chapter-nav a.active-chapter {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  border-left: 3px solid var(--primary-base);
  border-radius: 0 6px 6px 0;
}

/* ----- Main Content Area ----- */
.ncert-main {
  min-width: 0; /* prevent grid blowout */
}

/* ----- Exercise Sections ----- */
.exercise-section {
  margin-bottom: 2.5rem;
}

.exercise-heading {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary-base);
}

.exercise-heading span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ----- Question Cards ----- */
.question-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.question-card:hover {
  box-shadow: var(--shadow-card);
}

.q-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.q-num {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-base);
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
}

.q-body > p {
  margin-bottom: 1rem;
  color: var(--text-primary);
  line-height: 1.7;
}

/* ----- Sub-Questions ----- */
.sub-q {
  padding: 1rem 0;
  border-bottom: 1px dashed var(--border);
}

.sub-q:last-child {
  border-bottom: none;
}

.sub-q-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

/* ----- Solution Steps ----- */
.solution {
  color: var(--text-secondary);
  line-height: 1.8;
}

.solution p {
  margin-bottom: 0.375rem;
}

.solution strong {
  color: var(--text-primary);
}

/* ----- Division Algorithm Steps ----- */
.division-box {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  font-size: 0.938rem;
  line-height: 1.8;
}

.division-box p {
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
}

/* ----- Verification Box ----- */
.verify-box {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  font-size: 0.938rem;
  line-height: 1.8;
}

.verify-box p {
  margin-bottom: 0.25rem;
}

.verify-title {
  font-weight: 600;
  color: var(--success) !important;
  margin-bottom: 0.5rem !important;
}

/* ----- Key Idea / Summary ----- */
.key-idea {
  background: var(--accent-light);
  border: 1px solid #FCD34D;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.938rem;
  color: #92400E;
  line-height: 1.6;
}

/* ----- Graph Grid (Exercise 2.1) ----- */
.graph-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
}

@media (min-width: 640px) {
  .graph-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.graph-box {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.graph-visual {
  background: var(--white);
  border-radius: 6px;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
}

.graph-svg {
  width: 100%;
  max-height: 120px;
  display: block;
}

.graph-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.graph-answer {
  font-size: 0.875rem;
  color: var(--primary-base);
  font-weight: 600;
}

/* ----- Chapter Pager (Prev / Next) ----- */
.chapter-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

.chapter-pager:has(.pager-prev:only-child) {
  grid-template-columns: 1fr;
}

.pager-link {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transition: all 150ms ease;
  text-decoration: none;
}

.pager-link:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.pager-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.pager-title {
  font-size: 0.938rem;
  font-weight: 600;
  color: var(--primary-base);
}

.pager-next {
  text-align: right;
}

/* ----- Mobile sidebar &mdash; collapse into accordion ----- */
@media (max-width: 1023px) {
  .ncert-sidebar {
    display: none;
  }
}

/* ============================================================
   NCERT HUB PAGE &mdash; Subject & Class Cards
   ============================================================ */

.ncert-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ncert-class-group {
  margin-bottom: 3rem;
}

.ncert-subject-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .ncert-subject-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ncert-subject-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-decoration: none;
  transition: all 200ms ease;
}

.ncert-subject-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary-base);
}

.ncert-subject-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.subject-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 14px;
  color: var(--white);
}

.subject-icon.maths   { background: var(--primary-base); }
.subject-icon.science { background: #059669; }
.subject-icon.english { background: #7C3AED; }
.subject-icon.sst     { background: #DC2626; }

.subject-info h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.subject-info p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.subject-status {
  font-size: 0.8125rem;
  font-weight: 500;
}

.subject-status.ready { color: var(--primary-base); }
.subject-status.soon  { color: var(--text-muted); }

/* Class Pills */
.class-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.class-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.938rem;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  transition: all 150ms ease;
  text-decoration: none;
}

.class-pill:hover:not(.disabled) {
  border-color: var(--primary-base);
  color: var(--primary-base);
  box-shadow: var(--shadow-card-hover);
}

.class-pill.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.class-pill small {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   CLASS 10 MATHS &mdash; Chapter Cards Grid
   ============================================================ */

.chapter-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chapter-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-decoration: none;
  transition: all 200ms ease;
}

.chapter-card:hover {
  transform: translateX(4px);
  border-color: var(--primary-base);
  box-shadow: var(--shadow-card);
}

.ch-num {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-base);
  background: var(--primary-light);
  border-radius: 12px;
}

.ch-body {
  flex: 1;
  min-width: 0;
}

.ch-body h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.ch-exercises {
  font-size: 0.8125rem;
  color: var(--primary-base);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.ch-topics {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.ch-arrow {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 200ms ease;
}

.chapter-card:hover .ch-arrow {
  transform: translateX(3px);
  color: var(--primary-base);
}

/* ============================================================
   SQUARE ROOT &mdash; with overline (vinculum)
   ============================================================ */
.sqrt {
  display: inline-flex;
  align-items: stretch;
  white-space: nowrap;
  vertical-align: middle;
}
.sqrt-sym {
  font-size: 1.1em;
  line-height: 1;
  margin-right: -1px;
}
.sqrt-body {
  display: inline-block;
  border-top: 1.5px solid var(--text-primary);
  padding-top: 1px;
  margin-top: 2px;
}

/* ============================================================
   COORDINATE GRID &mdash; SVG coordinate plane diagrams
   ============================================================ */
.coord-diagram {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  text-align: center;
  margin: 1rem 0;
}
.coord-svg {
  width: 100%;
  max-width: 340px;
  max-height: 320px;
}
.coord-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ============================================================
   DIAGRAMS &mdash; For Geometry chapters (Circles, Triangles, etc.)
   ============================================================ */

.diagram-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 1rem 0;
  align-items: start;
}

@media (min-width: 640px) {
  .diagram-row {
    grid-template-columns: 260px 1fr;
  }
}

.diagram-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}

.diagram-svg {
  width: 100%;
  max-height: 240px;
  display: block;
}

.diagram-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-weight: 500;
}

.diagram-explanation {
  line-height: 1.75;
}

.diagram-explanation p {
  margin-bottom: 0.25rem;
}

.diagram-explanation strong {
  color: var(--text-primary);
}

/* Compact diagram for inline use */
.diagram-inline {
  display: inline-block;
  max-width: 200px;
  margin: 0.5rem;
  vertical-align: top;
}

/* Diagram inside solution boxes */
.solution .diagram-row {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
