/* Custom styles for The Curious Scholar Partnership Accounting Interactive Web App v2.0 */

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

:root {
  --primary: #1e3a8a;       /* Deep Navy */
  --primary-light: #3b82f6; /* Accent Blue */
  --accent: #f97316;        /* Warm Saffron */
  --success: #10b981;       /* Emerald Green */
  --danger: #ef4444;        /* Crimson Red */
  --bg-dark: #0f172a;       /* Slate 900 */
  --bg-light: #f8fafc;      /* Slate 50 */
  --text-dark: #0f172a;
  --text-light: #f8fafc;
}

html {
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  overflow: hidden;
  height: 100%;
  width: 100%;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .font-serif {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.title-serif {
  font-family: 'Playfair Display', serif;
}

/* Slide Transition System */
.slides-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.75s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.75s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: transform, opacity;
  display: flex;
  min-height: 0;
}

.slide-active {
  z-index: 10;
}

.slide-inactive {
  z-index: 1;
}

/* Custom Scrollbar for scrollable panes inside slides */
.scrollable-pane {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  scroll-padding-bottom: 7.5rem;
  scroll-padding-top: 4.5rem;
}

.scrollable-pane > *:last-child {
  margin-bottom: 0.25rem;
}

.scrollable-pane::-webkit-scrollbar {
  width: 6px;
}

.scrollable-pane::-webkit-scrollbar-track {
  background: transparent;
}

.scrollable-pane::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.slider-affected.ledger-amt-cell .amt-value {
  color: #fbbf24;
}

.ledger-section.revealed .slider-affected.ledger-amt-cell {
  background: rgba(251, 191, 36, 0.06);
  border-radius: 4px;
}

/* Solver amount reveal / mask — always XOR mask vs value (never both) */
.solver-reveal-hint strong {
  font-weight: 600;
}

.ledger-amt-cell > .amt-value {
  display: none;
}

.ledger-amt-cell > .amt-mask {
  display: inline;
  color: #64748b;
  letter-spacing: 0.12em;
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  user-select: none;
}

.ledger-section.revealed .ledger-amt-cell > .amt-value,
.ledger-amt-cell.amt-shown > .amt-value {
  display: inline;
}

.ledger-section.revealed .ledger-amt-cell > .amt-mask,
.ledger-amt-cell.amt-shown > .amt-mask {
  display: none;
}

.section-reveal-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.section-reveal-btn:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.55);
}

.section-reveal-btn:active {
  transform: scale(0.96);
}

.ledger-section.revealed .section-reveal-btn {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.ledger-section-header {
  align-items: flex-start;
}

.ledger-section-header h4 {
  flex: 1;
  min-width: 0;
  padding-right: 0.5rem;
}

.solver-insight-banner.insight-hidden {
  border-color: rgba(100, 116, 139, 0.25) !important;
  background: rgba(15, 23, 42, 0.5) !important;
  color: #94a3b8 !important;
}

.solver-insight-banner .insight-placeholder strong {
  font-weight: 600;
  color: #cbd5e1;
}

/* Indian Accounting Ledger Styling */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

@media (max-width: 768px) {
  .ledger-table {
    font-size: 0.8125rem;
  }

  .ledger-table th,
  .ledger-table td {
    padding: 0.4rem 0.5rem;
  }
}

.ledger-table th {
  background-color: rgba(30, 58, 138, 0.4);
  color: #93c5fd;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #3b82f6;
}

.ledger-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Standard Indian Double Underline for Ledger Totals */
.ledger-total {
  font-weight: 700;
  border-top: 1px solid rgba(255, 255, 255, 0.4) !important;
  border-bottom: 3px double rgba(255, 255, 255, 0.8) !important;
  background-color: rgba(255, 255, 255, 0.03);
}

/* Custom Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 3.5rem;
  height: 2rem;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .4s;
  border-radius: 2rem;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 1.5rem;
  width: 1.5rem;
  left: 0.25rem;
  bottom: 0.25rem;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-light);
}

input:checked + .toggle-slider:before {
  transform: translateX(1.5rem);
}

/* Slider Input Customization */
.custom-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #334155;
  outline: none;
  transition: background 0.45s ease-in-out;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-light);
  cursor: pointer;
  border: 2px solid #ffffff;
  transition: transform 0.1s ease;
}

.custom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Typeform-style Option Buttons */
.option-btn {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-btn:hover {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateX(4px);
}

.option-btn.selected-correct {
  background-color: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.option-btn.selected-incorrect {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

/* Progress Indicators */
.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
}

.progress-dot.active {
  background-color: var(--primary-light);
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

/* Navigation Overlay */
.nav-arrow {
  background-color: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s ease;
}

.nav-arrow:hover {
  background-color: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

/* Fixed chrome: keep content readable underneath */
.bottom-nav-controls {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lecture-home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(51, 65, 85, 0.9);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  pointer-events: auto;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lecture-home-link i {
  color: #60a5fa;
}

.lecture-home-link:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(59, 130, 246, 0.45);
  color: #fff;
}

.keyboard-hints {
  flex-wrap: wrap;
  row-gap: 0.5rem;
  color: #94a3b8;
}

.keyboard-hints kbd {
  color: #cbd5e1;
}

@media (max-width: 640px) {
  .keyboard-hints {
    display: none;
  }

  .lecture-top-chrome {
    max-width: calc(100% - 1.5rem);
  }

  .lecture-home-link span {
    display: none;
  }

  #active-module-badge {
    max-width: calc(100% - 4.5rem);
  }

  #active-module-badge > div {
    max-width: 100%;
    overflow: hidden;
  }
}

/* Readable body copy — avoid ultra-thin weights for teaching text */
.prose-readable,
.scenario-copy,
.concept-highlights-panel p,
.option-btn span.leading-relaxed {
  font-weight: 400;
  color: #cbd5e1;
}

/* Lecture body typography — teaching slides need room to breathe */
.lecture-body p,
.lecture-body li {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #cbd5e1;
}

.lecture-body .text-xs,
.lecture-body .text-\[10px\] {
  font-size: 0.95rem !important;
  line-height: 1.55 !important;
}

.lecture-body .text-sm {
  font-size: 1.05rem !important;
}

.lecture-body .ledger-table {
  font-size: 1rem;
}

.summary-metrics-grid .text-xl {
  font-size: 1.5rem;
}

.summary-metrics-grid .text-\[10px\] {
  font-size: 0.75rem !important;
}

.solver-pane-pad {
  padding-bottom: clamp(6.5rem, 12vh, 8rem) !important;
}

/*
 * Split scenario / solver slides must fill the slide box — never the
 * browser viewport again (nested h-screen/w-screen caused overflow).
 */
.slide-split {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  min-height: 0;
}

.scenario-pane {
  justify-content: safe center;
  box-sizing: border-box;
}

.scenario-left-content,
.scenario-right-content {
  transform: none;
  box-sizing: border-box;
  max-width: min(36rem, 100%);
  width: 100%;
}

/* Optical lift via padding (never translateY) — tall desktops only */
@media (min-width: 768px) and (min-height: 900px) {
  .scenario-left-content {
    padding-bottom: clamp(1rem, 6vh, 4rem);
  }

  .scenario-right-content {
    padding-bottom: clamp(0.5rem, 3vh, 2rem);
  }

  .content-lift {
    padding-bottom: clamp(0.5rem, 4vh, 2.5rem);
  }
}

/* Short / laptop heights: pin content to top so boxes stay on-screen */
@media (min-width: 768px) and (max-height: 899px) {
  .scenario-pane {
    justify-content: flex-start !important;
  }

  .scenario-left-content,
  .scenario-right-content {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0.25rem;
  }

  .content-lift {
    padding-bottom: 0;
  }

  .solver-pane-pad {
    padding-bottom: clamp(5.5rem, 10vh, 7rem) !important;
  }

  .badge-clearance {
    padding-top: clamp(2.5rem, 5vh, 3.25rem) !important;
  }

  .theory-slide-frame {
    justify-content: flex-start;
    padding-top: clamp(3.5rem, 7vh, 5rem);
    padding-bottom: clamp(6rem, 12vh, 8rem);
  }

  .toc-panel {
    padding-top: clamp(2.75rem, 5vh, 4rem);
  }
}

@media (max-height: 780px) {
  .scenario-pane {
    justify-content: flex-start !important;
  }

  .lecture-body p,
  .lecture-body li {
    font-size: 1rem;
    line-height: 1.6;
  }
}

.control-pane-pad {
  padding-bottom: 5.5rem !important;
}

/* Keep fixed top badge clear of slide content beneath it */
.badge-clearance {
  padding-top: clamp(3rem, 6vh, 3.75rem) !important;
}

.theory-slide-frame {
  box-sizing: border-box;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding:
    clamp(4.75rem, 9vh, 6rem)
    clamp(1rem, 3vw, 1.75rem)
    clamp(7.25rem, 14vh, 9rem);
}

.theory-slide-inner {
  width: 100%;
  max-width: 64rem;
}

.theory-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: clamp(0.85rem, 1.8vh, 1.35rem);
}

.theory-kicker-icon {
  width: clamp(2.4rem, 4vw, 2.75rem);
  height: clamp(2.4rem, 4vw, 2.75rem);
  border-radius: 0.75rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  flex-shrink: 0;
}

.theory-kicker-label {
  display: block;
  font-size: clamp(0.65rem, 1.1vw, 0.75rem);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #64748b;
}

.theory-kicker-sub {
  margin: 0.2rem 0 0;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  line-height: 1.4;
  color: #94a3b8;
}

.theory-title {
  font-size: clamp(1.65rem, 4.2vw, 3.35rem) !important;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin: 0 0 clamp(1rem, 2.2vh, 1.75rem);
}

.theory-body {
  font-size: clamp(0.95rem, 1.35vw, 1.125rem);
}

.theory-body .text-2xl {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem) !important;
}

.theory-body .text-base,
.theory-body .md\:text-lg {
  font-size: clamp(0.95rem, 1.35vw, 1.125rem) !important;
}

.theory-next-row {
  display: flex;
  justify-content: flex-end;
  margin-top: clamp(1.25rem, 3vh, 2.25rem);
}

.theory-next-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid #1e293b;
  font-size: clamp(0.8rem, 1.2vw, 0.9rem);
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.theory-next-btn:hover {
  background: #1e293b;
  border-color: #334155;
}

.theory-next-btn i {
  font-size: 0.65rem;
}

/* Syllabus / TOC panel — sit in the upper viewport, not true vertical center */
.toc-panel {
  padding-top: clamp(3.25rem, 7vh, 5.5rem);
  padding-bottom: 2rem;
}

/* Prefer padding-based optical lift (see height media queries) over transforms */
.content-lift {
  transform: none;
}

@media (max-width: 1280px) {
  .lecture-top-chrome {
    max-width: calc(100% - 5.5rem);
  }

  #active-module-badge .truncate,
  #active-module-badge span.text-slate-400 {
    max-width: 12rem;
  }
}

@media (max-width: 1024px) {
  .lecture-top-chrome {
    max-width: calc(100% - 5rem);
  }

  #active-module-badge .truncate,
  #active-module-badge span.text-slate-400 {
    max-width: 9rem;
  }

  /* Mid laptop widths: slightly tighter pane padding */
  .scenario-pane {
    padding-left: clamp(1rem, 2vw, 1.75rem) !important;
    padding-right: clamp(1rem, 2vw, 1.75rem) !important;
  }
}

@media (max-width: 767px) {
  .content-lift {
    transform: none;
  }

  .toc-panel {
    padding-top: 4rem;
  }

  .theory-slide-frame {
    padding-top: 4.5rem;
    padding-bottom: 7.5rem;
    justify-content: flex-start;
  }
}

@media (max-height: 899px) {
  .slide.justify-center {
    justify-content: safe center;
  }
}

.amt-mask,
.amt-value {
  transition: none !important;
}

/* Keyframe Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Water Valve & Bubbles */
@keyframes rotateValve {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fa-valve {
  animation: rotateValve var(--spin-duration, 5s) linear infinite;
  display: inline-block;
  transform-origin: center center;
}

/* Quick Navigation Menu Grid */
.menu-grid-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-grid-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -4px rgba(0, 0, 0, 0.5);
  border-color: rgba(59, 130, 246, 0.4);
}
