/* ============================================================
   Secret hours-view mode (URL: ?hours=1)
   -----------------------------------------------------------
   Overlay styles for SyllabusView + ModuleView. Adds a right-
   aligned hours/sessions column per subject, chapter + module
   subtotal rows, and a top banner showing the grand total.
   No markup outside .hours-banner / *-total-row / .subject-
   hours-cell / .chapter-hours-pill is affected when the URL
   param is absent.
   ============================================================ */

/* ── Top banner (course-level on SyllabusView, module-level on ModuleView) ── */

.hours-banner {
  max-width: 720px;
  margin: 0 auto var(--space-2xl);
  padding: var(--space-xl) var(--space-2xl);
  background:
    radial-gradient(120% 140% at 15% 0%, rgba(8, 148, 255, 0.08) 0%, transparent 55%),
    radial-gradient(120% 140% at 95% 100%, rgba(189, 50, 214, 0.07) 0%, transparent 55%),
    #fff;
  border: 1px solid rgba(0, 60, 130, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hours-banner::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, #0894FF 0%, #BD32D6 50%, #FFA304 100%);
  opacity: 0.9;
}

.hours-banner-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: center;
  margin-bottom: var(--space-lg);
}

.hours-banner-grid {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.hours-banner-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  min-width: 140px;
}

.hours-banner-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(90deg, #0894FF 0%, #BD32D6 60%, #FFA304 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hours-banner-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.35;
}

.hours-banner-divider {
  width: 1px;
  align-self: stretch;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 60, 130, 0.15) 50%, transparent 100%);
}

/* ── Per-subject hours cell (shared between SyllabusView + ModuleView) ── */

/* Default subject rows in SyllabusView/ModuleView are single-column.
   Hours mode adds a second column anchored to the inline-end (RTL: left). */
.module-body.hours-mode .subject-item,
.module-chapters.hours-mode .module-subject {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.module-body.hours-mode .subject-main,
.module-chapters.hours-mode .module-subject-main {
  flex: 1;
  min-width: 0;
}

.subject-hours-cell {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 88px;
  padding: 0.25rem 0.65rem 0.25rem 0.5rem;
  border-inline-start: 2px solid rgba(8, 148, 255, 0.18);
  margin-block-start: 2px;
}

.subject-hours-value {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0;
  direction: ltr;
}

.subject-hours-num {
  font-size: 1.05rem;
  line-height: 1;
}

.subject-hours-unit {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.subject-hours-sessions {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  direction: ltr;
}

/* ── Chapter-header hours pill (shown next to chapter title) ── */

.chapter-hours-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 3px 9px;
  background: rgba(8, 148, 255, 0.09);
  color: var(--primary-color);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  direction: ltr;
  flex-shrink: 0;
  margin-inline-start: auto;
}

.chapter-hours-pill .chapter-hours-unit {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.75;
}

/* In ModuleView the chapter header already uses a flex layout.
   Keep the pill anchored to the end and leave title space. */
.module-chapter-header .chapter-hours-pill {
  margin-inline-start: auto;
  align-self: center;
}

/* In SyllabusView the chapter-count pill follows the hours pill -
   push both to the inline-end without reflowing the title. */
.chapter-header .chapter-hours-pill {
  margin-inline-start: auto;
  margin-inline-end: 0;
}
.chapter-header .chapter-hours-pill + .chapter-count {
  margin-inline-start: 0.55rem;
}

/* ── Chapter subtotal row (bottom of expanded subjects-list) ── */

.chapter-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  margin-block-start: 0.35rem;
  background: rgba(8, 148, 255, 0.04);
  border-top: 1px dashed rgba(0, 60, 130, 0.12);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.chapter-total-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.chapter-total-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-mono);
  direction: ltr;
}

.chapter-total-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
}

.chapter-total-unit {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.chapter-total-sep {
  color: var(--text-tertiary);
  margin-inline: 0.25rem;
  opacity: 0.6;
}

.chapter-total-row--module-view {
  margin-top: var(--space-md);
  border-radius: var(--radius-sm);
  border-top: 1px dashed rgba(0, 60, 130, 0.12);
  background: rgba(8, 148, 255, 0.04);
}

/* ── Module subtotal row ── */

.module-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-xl);
  margin-block-start: var(--space-lg);
  background:
    linear-gradient(90deg, rgba(8, 148, 255, 0.06) 0%, rgba(189, 50, 214, 0.05) 60%, rgba(255, 163, 4, 0.05) 100%);
  border: 1px solid rgba(0, 60, 130, 0.1);
  border-radius: var(--radius-md);
  position: relative;
}

.module-total-row::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: linear-gradient(90deg, #0894FF 0%, #BD32D6 50%, #FFA304 100%);
  opacity: 0.75;
}

.module-total-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

.module-total-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  direction: ltr;
}

.module-total-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
}

.module-total-unit {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.module-total-sep {
  color: var(--text-tertiary);
  margin-inline: 0.4rem;
  opacity: 0.55;
}

.module-total-row--module-view {
  margin-top: var(--space-xl);
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .hours-banner {
    padding: var(--space-lg);
  }
  .hours-banner-num {
    font-size: 2.4rem;
  }
  .hours-banner-grid {
    gap: var(--space-md);
  }
}

@media (max-width: 768px) {
  .hours-banner-grid {
    flex-direction: column;
    gap: var(--space-md);
    align-items: stretch;
  }
  .hours-banner-cell {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    min-width: 0;
    padding: 0.4rem 0;
  }
  .hours-banner-num {
    font-size: 2.1rem;
  }
  .hours-banner-label {
    text-align: end;
  }
  .hours-banner-divider {
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 60, 130, 0.12) 50%, transparent 100%);
  }

  .subject-hours-cell {
    min-width: 72px;
    padding-inline: 0.4rem;
  }
  .subject-hours-num {
    font-size: 0.95rem;
  }

  .module-total-row,
  .chapter-total-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }
  .module-total-cell,
  .chapter-total-cell {
    align-self: stretch;
    justify-content: flex-end;
  }
}
