/* =========================================================
   Companies Act, 2013 — AIBE 2026 Revision
   style.css
   ========================================================= */

:root {
  /* Light theme palette */
  --navy:        #102a4c;
  --navy-deep:   #0b1f3a;
  --navy-soft:   #1c3c66;
  --gold:        #c9a227;
  --gold-soft:   #f3e6bd;
  --red:         #b3261e;
  --red-soft:    #f7dedb;
  --card-blue:   #eef4fb;
  --card-blue-2: #e2edf9;

  --bg:          #f6f4ee;
  --bg-grain:    #efece3;
  --surface:     #ffffff;
  --surface-2:   #f9fbfe;
  --text:        #182230;
  --text-soft:   #4a5a6e;
  --text-muted:  #708096;
  --border:      #d9dee6;
  --border-strong:#c2cad6;
  --shadow:      0 8px 28px rgba(16, 42, 76, 0.10);
  --shadow-sm:   0 3px 12px rgba(16, 42, 76, 0.08);

  --font-display: "Spectral", Georgia, serif;
  --font-body: "Mukta", "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1180px;
}

[data-theme="dark"] {
  --navy:        #0a1729;
  --navy-deep:   #060f1d;
  --navy-soft:   #16263f;
  --gold:        #e0bd4a;
  --gold-soft:   #3a3115;
  --red:         #ef6a62;
  --red-soft:    #3a1816;
  --card-blue:   #16263c;
  --card-blue-2: #1b2e48;

  --bg:          #0c1420;
  --bg-grain:    #0f1825;
  --surface:     #131e2e;
  --surface-2:   #18243688;
  --text:        #e7edf5;
  --text-soft:   #b3c0d2;
  --text-muted:  #8494a8;
  --border:      #28384f;
  --border-strong:#34465f;
  --shadow:      0 10px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm:   0 3px 14px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(201,162,39,0.08), transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(16,42,76,0.10), transparent 45%);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; font-weight: 700; }
a { color: inherit; }
.muted { color: var(--text-muted); font-size: .92rem; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .92rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .55rem 1.05rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: transform .12s ease, background .2s ease, color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); color: #21180a; border-color: var(--gold); }
.btn-primary:hover { background: #d8b43a; }
.btn-ghost { background: transparent; color: #f4f1e8; border-color: rgba(255,255,255,.4); }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-soft { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-soft:hover { border-color: var(--gold); color: var(--navy); }
[data-theme="dark"] .btn-soft:hover { color: var(--gold); }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--navy-deep), var(--navy) 60%, var(--navy-soft));
  color: #f4f1e8;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .9rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .85rem; }
.brand-mark {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--gold);
  line-height: 1;
  border: 2px solid var(--gold);
  border-radius: 12px;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-text h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: .2px; }
.brand-year { color: var(--gold); font-weight: 700; }
.subtitle { font-size: .85rem; color: #c8d3e2; font-weight: 400; margin-top: 2px; }
.header-nav { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.4rem 4rem; }
.block { margin-top: 2.6rem; }
.block-head { margin-bottom: 1.1rem; }
.block-head h2 { font-size: 1.5rem; color: var(--navy); }
[data-theme="dark"] .block-head h2 { color: var(--gold); }

/* ---------- Exam box ---------- */
.exam-box {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-sm);
}
.exam-box-title { font-size: 1.25rem; color: var(--navy); margin-bottom: 1rem; }
[data-theme="dark"] .exam-box-title { color: var(--gold); }
.exam-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.exam-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.exam-strategy { grid-column: 1 / -1; }
.exam-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; }
.exam-value { font-weight: 500; color: var(--text); }

/* ---------- Chapter nav ---------- */
.chapter-nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.chapter-btn {
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .42rem .85rem;
  cursor: pointer;
  transition: all .18s ease;
}
.chapter-btn:hover { border-color: var(--gold); color: var(--navy); }
[data-theme="dark"] .chapter-btn:hover { color: var(--gold); }
.chapter-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
[data-theme="dark"] .chapter-btn.active { background: var(--gold); color: #1a1304; border-color: var(--gold); }

/* ---------- Controls ---------- */
.controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 92px;
  z-index: 30;
}
.control-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.control-row + .control-row { margin-top: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; flex: 1 1 220px; }
.field label { font-size: .78rem; font-weight: 600; color: var(--text-soft); }
.field input, .field select {
  font-family: var(--font-body);
  font-size: .95rem;
  padding: .6rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.control-actions { align-items: center; }
.result-count { font-size: .85rem; color: var(--text-muted); margin-left: auto; font-weight: 500; }

/* ---------- Important chips ---------- */
.chip-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  background: var(--gold-soft);
  color: #6b551b;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: .4rem .85rem;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease;
}
[data-theme="dark"] .chip { color: var(--gold); background: var(--gold-soft); }
.chip:hover { transform: translateY(-2px); background: var(--gold); color: #20180a; }

.gold-tag { color: var(--gold); }

/* ---------- Section cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.1rem; }
.card {
  background: var(--card-blue);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: .65rem;
  position: relative;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card.very-important { border-left: 5px solid var(--red); }
.card.important { border-left: 5px solid var(--gold); }
.card.basic { border-left: 5px solid var(--navy-soft); }
.card.low { border-left: 5px solid var(--border-strong); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.sec-no {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--navy);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .15rem .6rem;
  white-space: nowrap;
}
[data-theme="dark"] .sec-no { color: var(--gold); }
.bookmark-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; line-height: 1; color: var(--text-muted);
  transition: transform .12s ease, color .18s ease;
}
.bookmark-btn:hover { transform: scale(1.15); }
.bookmark-btn.marked { color: var(--gold); }

.card-title { font-size: 1.08rem; color: var(--text); }
.card-chapter { font-size: .76rem; color: var(--text-muted); font-weight: 500; }

.imp-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .22rem .55rem;
  border-radius: 999px;
  align-self: flex-start;
}
.imp-very { background: var(--red); color: #fff; }
.imp-imp { background: var(--gold); color: #221a07; }
.imp-basic { background: var(--navy-soft); color: #fff; }
.imp-low { background: var(--border-strong); color: var(--text); }

.card-meaning { font-size: .94rem; color: var(--text-soft); }

.toggle-details {
  align-self: flex-start;
  font-size: .82rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .4rem .8rem;
  cursor: pointer;
  transition: all .18s ease;
}
[data-theme="dark"] .toggle-details { color: var(--gold); }
.toggle-details:hover { border-color: var(--gold); }

.card-details { display: none; flex-direction: column; gap: .7rem; padding-top: .3rem; border-top: 1px dashed var(--border-strong); margin-top: .3rem; }
.card.open .card-details { display: flex; }

.detail-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  color: var(--gold);
}
[data-theme="dark"] .detail-label { color: var(--gold); }
.detail-block p, .detail-block li { font-size: .9rem; color: var(--text-soft); }
.detail-block ul { padding-left: 1.15rem; margin-top: .2rem; }
.detail-block li { margin-bottom: .2rem; }

.card-mcq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .8rem .9rem;
}
.card-mcq .q { font-weight: 600; font-size: .9rem; color: var(--text); margin-bottom: .45rem; }
.card-mcq ol { padding-left: 1.2rem; }
.card-mcq ol li { font-size: .88rem; margin-bottom: .15rem; }
.mcq-answer {
  margin-top: .6rem;
  font-size: .88rem;
  color: var(--text-soft);
  background: var(--card-blue-2);
  border-radius: 7px;
  padding: .55rem .7rem;
  display: none;
}
.mcq-answer.show { display: block; }
.mcq-answer strong { color: var(--navy); }
[data-theme="dark"] .mcq-answer strong { color: var(--gold); }

.related-links { display: flex; flex-wrap: wrap; gap: .35rem; }
.related-links button {
  font-family: var(--font-body);
  font-size: .78rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: .2rem .5rem;
  cursor: pointer;
  color: var(--text-soft);
}
.related-links button:hover { border-color: var(--gold); color: var(--navy); }
[data-theme="dark"] .related-links button:hover { color: var(--gold); }

.empty-state { text-align: center; color: var(--text-muted); padding: 2rem; font-size: 1rem; }

.card.flash { animation: flash 1.1s ease; }
@keyframes flash {
  0%, 100% { box-shadow: var(--shadow-sm); }
  30%      { box-shadow: 0 0 0 4px var(--gold); }
}

/* ---------- MCQ Practice ---------- */
.mcq-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.mcq-score { font-weight: 700; color: var(--navy); }
[data-theme="dark"] .mcq-score { color: var(--gold); }
.mcq-list { display: grid; gap: 1rem; }
.mcq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
}
.mcq-item .qno { color: var(--gold); font-weight: 700; font-family: var(--font-display); }
.mcq-item .qtext { font-weight: 600; margin: .2rem 0 .8rem; }
.mcq-options { display: grid; gap: .45rem; }
.mcq-option {
  text-align: left;
  font-family: var(--font-body);
  font-size: .92rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .55rem .85rem;
  cursor: pointer;
  color: var(--text);
  transition: all .15s ease;
}
.mcq-option:hover { border-color: var(--gold); }
.mcq-option.correct { background: #e2f4e6; border-color: #2e9d52; color: #155f30; }
.mcq-option.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); }
[data-theme="dark"] .mcq-option.correct { background: #14331f; color: #74d896; border-color: #2e9d52; }
.mcq-explain {
  margin-top: .7rem;
  font-size: .88rem;
  color: var(--text-soft);
  border-left: 3px solid var(--gold);
  padding: .4rem .8rem;
  background: var(--surface-2);
  border-radius: 0 7px 7px 0;
  display: none;
}
.mcq-explain.show { display: block; }
.mcq-reveal {
  margin-top: .8rem;
  font-size: .82rem;
  font-weight: 600;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .45rem .9rem;
  cursor: pointer;
}
[data-theme="dark"] .mcq-reveal { background: var(--gold); color: #1a1304; }

/* ---------- Flowcharts ---------- */
.flow-wrap { margin-bottom: 1.8rem; }
.flow-title { font-size: 1.1rem; color: var(--navy); margin-bottom: .8rem; }
[data-theme="dark"] .flow-title { color: var(--gold); }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; }
.flow-node {
  position: relative;
  background: var(--card-blue);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: .7rem 1.6rem .7rem 1rem;
  font-size: .88rem;
  font-weight: 500;
  margin: 0 1.5rem .8rem 0;
  display: flex; align-items: center;
}
.flow-node::after {
  content: "➜";
  position: absolute;
  right: -1.3rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 700;
}
.flow-node:last-child { margin-right: 0; }
.flow-node:last-child::after { content: ""; }
.flow-end { border-left-color: var(--gold); background: var(--gold-soft); color: #5e4a14; font-weight: 700; }
[data-theme="dark"] .flow-end { color: var(--gold); }

/* ---------- Mind map ---------- */
.mindmap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.mm-center {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  padding: .9rem 1.8rem;
  border-radius: 999px;
  border: 3px solid var(--gold);
  margin-bottom: 1.6rem;
}
[data-theme="dark"] .mm-center { background: var(--gold); color: #1a1304; }
.mm-branches { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; }
.mm-branches li {
  background: var(--card-blue);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
}
[data-theme="dark"] .mm-branches li { color: var(--text); }

/* ---------- Disclaimer & footer ---------- */
.disclaimer {
  margin-top: 3rem;
  background: var(--red-soft);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
}
.disclaimer p { color: var(--red); font-size: .9rem; font-weight: 500; }
[data-theme="dark"] .disclaimer p { color: var(--red); }
.site-footer {
  background: var(--navy-deep);
  color: #aab8cc;
  text-align: center;
  padding: 1.6rem 1rem;
  font-size: .85rem;
  border-top: 3px solid var(--gold);
}

/* ---------- Floating buttons ---------- */
.fab {
  position: fixed;
  width: 50px; height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.35rem;
  z-index: 60;
  box-shadow: var(--shadow);
  display: grid; place-items: center;
  transition: transform .15s ease, background .2s ease;
}
.fab:hover { transform: translateY(-3px); }
.fab-theme { right: 1.3rem; bottom: 5rem; background: var(--navy); color: var(--gold); }
[data-theme="dark"] .fab-theme { background: var(--gold); color: var(--navy-deep); }
.fab-top { right: 1.3rem; bottom: 1.3rem; background: var(--gold); color: var(--navy-deep); opacity: 0; pointer-events: none; }
.fab-top.show { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .exam-grid { grid-template-columns: 1fr 1fr; }
  .controls { position: static; }
  .header-inner { justify-content: center; text-align: center; }
  .brand { flex-direction: column; text-align: center; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .exam-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .header-nav { width: 100%; justify-content: center; }
  .brand-text h1 { font-size: 1.25rem; }
  .result-count { margin-left: 0; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .controls, .chapter-nav, .fab, .header-nav,
  .toggle-details, .bookmark-btn, .mcq-reveal, .mcq-toolbar,
  #bookmarksOnlyBtn, .control-actions, .chip-cloud { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .mcq-item, .exam-box, .mindmap { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .card-details { display: flex !important; }
  .mcq-answer, .mcq-explain { display: block !important; }
  .container { max-width: 100%; }
  a { text-decoration: none; }
}

/* =========================================================
   HOST-THEME DEFENSIVE OVERRIDES
   Keeps the page rendering correctly when embedded inside a
   site (e.g. WordPress) whose theme injects its own
   h1–h6 / link / list / spacing CSS — often with !important.
   These rules use higher specificity + !important so the
   component always wins, regardless of stylesheet load order.
   ========================================================= */

.site-header, .site-header *,
.container, .container * { box-sizing: border-box; }

/* --- Header text must stay light on the navy bar --- */
.site-header .brand-text h1 {
  color: #f4f1e8 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
  font-family: var(--font-display) !important;
  font-size: 1.5rem !important;
  text-shadow: none !important;
}
.site-header .brand-text h1 .brand-year { color: var(--gold) !important; }
.site-header .subtitle { color: #c8d3e2 !important; margin: 2px 0 0 !important; font-family: var(--font-body) !important; }
.site-header .brand-mark { color: var(--gold) !important; }
.site-header .header-nav .btn { text-decoration: none !important; }
.site-header .header-nav .btn-ghost { color: #f4f1e8 !important; }
.site-header .header-nav .btn-primary { color: #21180a !important; }

/* --- Section / block headings (light backgrounds) --- */
.block-head h2,
.exam-box-title,
.flow-title { color: var(--navy) !important; }
[data-theme="dark"] .block-head h2,
[data-theme="dark"] .exam-box-title,
[data-theme="dark"] .flow-title { color: var(--gold) !important; }

/* --- Card text colours --- */
.card .card-title { color: var(--text) !important; margin: 0 !important; }
.card .sec-no { color: var(--navy) !important; }
[data-theme="dark"] .card .sec-no { color: var(--gold) !important; }
.card .detail-label { color: var(--gold) !important; }
.card p, .card li { color: var(--text-soft) !important; }

/* --- MCQ + mindmap + flow text --- */
.mcq-item .qtext { color: var(--text) !important; }
.mm-center { color: #fff !important; }
[data-theme="dark"] .mm-center { color: #1a1304 !important; }
.mm-branches li { color: var(--navy) !important; }
[data-theme="dark"] .mm-branches li { color: var(--text) !important; }
.flow-end { color: #5e4a14 !important; }
[data-theme="dark"] .flow-end { color: var(--gold) !important; }

/* --- Neutralise theme list bullets / margins inside components --- */
.card-details ul { list-style: disc !important; }
.mm-branches, .mcq-options, .flow, .chip-cloud, .chapter-nav, .related-links { list-style: none !important; margin-top: 0 !important; }
.mm-branches { padding-left: 0 !important; }

/* --- Stop theme link styling leaking into our buttons/links --- */
.container a, .site-header a { box-shadow: none !important; }
.container a:hover { text-decoration: none !important; }

/* --- Keep our own width; ignore theme content max-width on these --- */
.site-header, .site-footer { max-width: none !important; width: 100% !important; }

/* --- Inputs/selects: prevent theme form-control overrides --- */
.field input, .field select {
  width: 100% !important;
  max-width: 100% !important;
  background-image: none !important;
  box-shadow: none !important;
}