/* UKSE — Course detail "Price bands" unified layout
 * Handles BOTH canonical (ukse_render_price_bands_section) and partial (course-price-bands.php) markup.
 * Scoped to #ukse-pricebands to avoid conflicts.
 */

/* === Design tokens === */
:root {
  --ukse-pink: #E6007E;
  --ukse-blue: #000032;
  --ukse-ink: #0B0B29;
  --ukse-card: #FFFFFF;
  --ukse-tint: #F7F9FF;
  --ukse-border: rgba(0,0,50,.08);
  --ukse-shadow-a: 0 1px 3px rgba(0,0,50,.06);
  --ukse-shadow-b: 0 8px 24px rgba(0,0,50,.04);
}

/* === Container: centered, constrained width === */
#ukse-pricebands {
  width: 100%;
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  box-sizing: border-box;
}

/* === Section title (h2) === */
#ukse-pricebands .ukse-section-title,
#ukse-pricebands .course-section__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ukse-ink);
  margin: 0 0 0.5rem;
}

/* === Headline (price range summary) === */
#ukse-pricebands .ukse-price-summary,
#ukse-pricebands .ukse-pricebands__headline {
  color: var(--ukse-pink);
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  letter-spacing: 0.1px;
}

/* === Two-column panel layout (calc left, table right) === */
#ukse-pricebands .ukse-pricebands__panel {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  padding-bottom: 1.5rem;
}
#ukse-pricebands .ukse-pricebands__panel > .ukse-pricebands__calc {
  flex: 0 0 340px;
  min-width: 280px;
}
#ukse-pricebands .ukse-pricebands__panel > .ukse-pricebands__table,
#ukse-pricebands .ukse-pricebands__panel > .ukse-bands-wrapper,
#ukse-pricebands .ukse-pricebands__panel > table {
  flex: 1 1 400px;
  min-width: 320px;
  max-width: 100%;
}

/* For the partial-based layout: wrapper + table side-by-side */
#ukse-pricebands .ukse-course-calculator-wrapper {
  display: contents; /* Let children participate in parent flex */
}

/* Fallback flex container when panel class not present */
#ukse-pricebands:has(.ukse-course-calculator-wrapper) {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}
#ukse-pricebands > .ukse-section-title,
#ukse-pricebands > .course-section__title,
#ukse-pricebands > .ukse-price-summary,
#ukse-pricebands > .ukse-pricebands__headline,
#ukse-pricebands > script {
  flex: 0 0 100%;
}
#ukse-pricebands > .ukse-course-calculator-wrapper,
#ukse-pricebands > .course-calculator {
  flex: 0 0 340px;
  min-width: 280px;
}
#ukse-pricebands > .ukse-bands-wrapper {
  flex: 1 1 400px;
  min-width: 320px;
}

/* === Calculator card === */
#ukse-pricebands .course-calculator,
#ukse-pricebands .ukse-pricebands__calc {
  background: linear-gradient(180deg, var(--ukse-card) 0%, var(--ukse-tint) 100%);
  border: 1px solid var(--ukse-border);
  border-radius: 16px;
  box-shadow: var(--ukse-shadow-a), var(--ukse-shadow-b);
  padding: 1.25rem 1.5rem;
}

/* Headline inside calc panel (legacy data-price-slot) */
#ukse-pricebands [data-price-slot="headline"] {
  color: var(--ukse-pink);
  font-weight: 700;
  margin: 0.25rem 0 0.75rem;
  letter-spacing: 0.1px;
}

/* Calculator rows */
#ukse-pricebands .course-calculator__line,
#ukse-pricebands .ukse-pricebands__calc-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed rgba(0,0,0,.06);
}
#ukse-pricebands .course-calculator__line:last-child,
#ukse-pricebands .ukse-pricebands__calc-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

#ukse-pricebands .course-calculator__label,
#ukse-pricebands .ukse-pricebands__label {
  font-weight: 600;
  color: var(--ukse-ink);
  min-width: 9rem;
  letter-spacing: 0.1px;
}

#ukse-pricebands .course-calculator__total,
#ukse-pricebands .ukse-pricebands__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ukse-blue);
}

#ukse-pricebands [data-price-slot="price"],
#ukse-pricebands [data-price-slot="total"] {
  font-variant-numeric: tabular-nums;
}

/* Calculator form inputs */
#ukse-pricebands .course-calculator label,
#ukse-pricebands .ukse-pricebands__calc label,
#ukse-pricebands [data-price-group] label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ukse-ink);
  margin-bottom: 0.5rem;
}

#ukse-pricebands input[type="number"],
#ukse-pricebands select {
  width: 6rem;
  max-width: 120px;
  height: 2.25rem;
  padding: 0 0.5rem;
  margin-left: 0.75rem;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 0.5rem;
  box-sizing: border-box;
  background: #fff;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#ukse-pricebands input[type="number"]:focus,
#ukse-pricebands select:focus {
  outline: none;
  border-color: var(--ukse-pink);
  box-shadow: 0 0 0 3px rgba(230,0,126,.15);
}

/* === Bands table wrapper === */
#ukse-pricebands .ukse-bands-wrapper {
  overflow-x: auto;
}

/* === Bands table === */
#ukse-pricebands table,
#ukse-pricebands .ukse-bands,
#ukse-pricebands .ukse-pricebands__table,
#ukse-pricebands .price-bands__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--ukse-card);
  border: 1px solid var(--ukse-border);
  border-radius: 16px;
  box-shadow: var(--ukse-shadow-a), var(--ukse-shadow-b);
  overflow: hidden;
  margin-bottom: 2rem;
}

#ukse-pricebands table thead th,
#ukse-pricebands .ukse-bands thead th {
  text-align: left;
  font-weight: 700;
  color: var(--ukse-ink);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ukse-border);
  background: transparent;
  text-transform: none;
  letter-spacing: 0.1px;
}

#ukse-pricebands table tbody td,
#ukse-pricebands .ukse-bands tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px dashed rgba(0,0,0,.06);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#ukse-pricebands table tbody tr:last-child td,
#ukse-pricebands .ukse-bands tbody tr:last-child td {
  border-bottom: 0;
}

#ukse-pricebands table tbody tr:nth-child(2n),
#ukse-pricebands .ukse-bands tbody tr:nth-child(2n) {
  background: #FCFDFF;
}

/* Canonical table (ukse_render_bands_table): 3 columns (From/To/Rate or Weekly) */
#ukse-pricebands .ukse-pricebands__table th:nth-child(1),
#ukse-pricebands .ukse-pricebands__table td:nth-child(1) { width: 33%; text-align: center; }
#ukse-pricebands .ukse-pricebands__table th:nth-child(2),
#ukse-pricebands .ukse-pricebands__table td:nth-child(2) { width: 34%; text-align: center; }
#ukse-pricebands .ukse-pricebands__table th:nth-child(3),
#ukse-pricebands .ukse-pricebands__table td:nth-child(3) { width: 33%; text-align: center; }

/* Hourly table (partial): 5 columns - centered */
#ukse-pricebands .ukse-bands--hourly th:nth-child(1),
#ukse-pricebands .ukse-bands--hourly td:nth-child(1) { width: 15%; text-align: center; }
#ukse-pricebands .ukse-bands--hourly th:nth-child(2),
#ukse-pricebands .ukse-bands--hourly td:nth-child(2) { width: 15%; text-align: center; }
#ukse-pricebands .ukse-bands--hourly th:nth-child(3),
#ukse-pricebands .ukse-bands--hourly td:nth-child(3) { width: 20%; text-align: center; }
#ukse-pricebands .ukse-bands--hourly th:nth-child(4),
#ukse-pricebands .ukse-bands--hourly td:nth-child(4) { width: 25%; text-align: center; }
#ukse-pricebands .ukse-bands--hourly th:nth-child(5),
#ukse-pricebands .ukse-bands--hourly td:nth-child(5) { width: 25%; text-align: center; }

/* Weekly table (partial): 3 columns - centered */
#ukse-pricebands .ukse-bands:not(.ukse-bands--hourly) th:nth-child(1),
#ukse-pricebands .ukse-bands:not(.ukse-bands--hourly) td:nth-child(1) { width: 33%; text-align: center; }
#ukse-pricebands .ukse-bands:not(.ukse-bands--hourly) th:nth-child(2),
#ukse-pricebands .ukse-bands:not(.ukse-bands--hourly) td:nth-child(2) { width: 34%; text-align: center; }
#ukse-pricebands .ukse-bands:not(.ukse-bands--hourly) th:nth-child(3),
#ukse-pricebands .ukse-bands:not(.ukse-bands--hourly) td:nth-child(3) { width: 33%; text-align: center; }

/* === Responsive: stack on narrow viewports === */
@media (max-width: 900px) {
  #ukse-pricebands {
    display: block;
  }

  #ukse-pricebands .ukse-pricebands__panel {
    flex-direction: column;
  }

  #ukse-pricebands .ukse-pricebands__panel > .ukse-pricebands__calc,
  #ukse-pricebands .ukse-pricebands__panel > .ukse-pricebands__table,
  #ukse-pricebands .ukse-pricebands__panel > .ukse-bands-wrapper,
  #ukse-pricebands > .ukse-course-calculator-wrapper,
  #ukse-pricebands > .course-calculator,
  #ukse-pricebands > .ukse-bands-wrapper {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  #ukse-pricebands .ukse-course-calculator-wrapper {
    display: block;
    margin-bottom: 1.5rem;
  }

  #ukse-pricebands .course-calculator,
  #ukse-pricebands .ukse-pricebands__calc {
    margin-bottom: 1.5rem;
  }

  #ukse-pricebands .ukse-bands-wrapper {
    margin-top: 0;
  }

  /* Ensure table scrolls if needed */
  #ukse-pricebands table,
  #ukse-pricebands .ukse-bands {
    min-width: 400px;
  }
}

@media (max-width: 600px) {
  #ukse-pricebands {
    padding: 0 1rem;
    margin: 1.5rem auto;
  }

  #ukse-pricebands .course-calculator,
  #ukse-pricebands .ukse-pricebands__calc {
    padding: 1rem;
  }

  #ukse-pricebands table thead th,
  #ukse-pricebands .ukse-bands thead th {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

  #ukse-pricebands table tbody td,
  #ukse-pricebands .ukse-bands tbody td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* === Legacy data-price-panel support (from card rendering) === */
#ukse-pricebands [data-price-panel] {
  background: linear-gradient(180deg, var(--ukse-card) 0%, var(--ukse-tint) 100%);
  border: 1px solid var(--ukse-border);
  border-radius: 16px;
  box-shadow: var(--ukse-shadow-a), var(--ukse-shadow-b);
  padding: 1.25rem 1.5rem;
}

/* === Related course cards styling (course detail page) === */
.course-card .course-calculator .course-calculator__line,
.course-card [data-price-panel] .course-calculator__line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0;
}

.course-card .course-calculator .course-calculator__label,
.course-card [data-price-panel] .course-calculator__label {
  font-weight: 700;
  color: var(--ukse-ink, #223);
  min-width: 7.5rem;
  line-height: 1.2;
}

.course-card .course-calculator .course-calculator__value,
.course-card [data-price-panel] .course-calculator__value {
  font-weight: 700;
  color: #0a0a0a;
}

.course-card .course-calculator [data-price-slot="headline"],
.course-card [data-price-panel] [data-price-slot="headline"] {
  font-weight: 700;
  color: var(--ukse-pink, #E6007E);
  margin: 0.25rem 0 0.35rem;
}

.course-card .course-calculator [data-price-slot="total"],
.course-card [data-price-panel] [data-price-slot="total"] {
  font-weight: 700;
  color: var(--ukse-blue, #000032);
  font-size: calc(1rem + 1px);
}

.course-card .course-calculator [data-price-group],
.course-card [data-price-panel] [data-price-group] {
  margin: 0.35rem 0;
}

/* Pricing mode visibility guards */
.course-card[data-pricing-mode="hourly"] [data-price-group="hours"] { display: block !important; }
.course-card[data-pricing-mode="hourly"] [data-price-group="weeks"] { display: none !important; }
.course-card[data-pricing-mode="weekly"] [data-price-group="weeks"] { display: block !important; }
.course-card[data-pricing-mode="weekly"] [data-price-group="hours"] { display: none !important; }

/* Control input styling */
.course-card [data-price-group="weeks"] input[type="number"],
.course-card [data-price-group="hours"] input[type="number"] {
  width: 5.75rem;
  max-width: 5.75rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  margin-left: 0.75rem;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 0.5rem;
  box-sizing: border-box;
  background: #fff;
  font-size: 1rem;
}

/* === Related section CTA styling === */
.ukse-related-cta {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

/* === Archived course banner === */
.ukse-course-archived-banner {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 4px;
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.ukse-course-archived-banner > strong {
  font-weight: 600;
}

.ukse-course-archived-banner > span {
  flex: 1 1 auto;
}

/* Phase XVIII-E: Fixed/min-weeks hint styling */
.ukse-pricebands__hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

.course-calculator__weeks--fixed {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

/* Fixed-duration badge for course cards - inline with headline */
.course-calculator__fixed-badge {
  display: inline-block;
  background: #e8f4e8;
  color: #2d6a2d;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Inline min-weeks hint next to weeks input */
.course-calculator__min-hint,
.ukse-pricebands__min-hint {
  display: inline-block;
  margin-left: 1rem;
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
  font-style: italic;
  vertical-align: middle;
}

.ukse-pricebands__input--fixed {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

/* Phase XVIII-E: School logo bar below hero */
.course-school-bar {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  padding: 0.75rem 0;
}

.course-school-bar__inner {
  display: flex;
  align-items: center;
}

.course-school-bar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.course-school-bar__link:hover {
  opacity: 0.85;
}

.course-school-bar__logo {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

.course-school-bar__name {
  font-family: proxima-nova, "Proxima Nova", "ProximaNova", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ukse-ink, #0B0B29);
  letter-spacing: 0.02em;
}
