/* =========================================================================
   Tango School — Guardia di contrasto sul tema (Enfold)
   Ogni elemento con sfondo rosso (--ts-red / --ts-red-deep / --ts-stats-red,
   contrasto col bianco >= 4.9:1) deve mostrare testo bianco in ogni stato.
   Enfold assegna colore a link, label e span con selettori più specifici
   (`#top a`, `.main_color span`, `.entry-content label`, ...): per batterli
   servono il prefisso body.ts-app-shell e !important. Il file non cambia
   sfondi né layout, solo il colore del testo.
   ========================================================================= */

/* ---------- 1. Controlli con sfondo rosso pieno ---------- */
body.ts-app-shell :is(
  .ts-btn-primary,
  .ts-btn-danger,
  .ts-profile-form button[type="submit"],
  .ts-subscription-primary,
  .ts-statistics-preset.is-active,
  .ts-shop-frequency-options input:checked + span,
  .ts-page-btn.active,
  .ts-week-nav-btn:not(:disabled),
  .ts-details-btn,
  .ts-student-course-indicator,
  .ts-calendar .ts-student-cell-content
),
body.ts-app-shell :is(
  .ts-btn-primary,
  .ts-btn-danger,
  .ts-profile-form button[type="submit"],
  .ts-subscription-primary,
  .ts-statistics-preset.is-active,
  .ts-shop-frequency-options input:checked + span,
  .ts-page-btn.active,
  .ts-week-nav-btn:not(:disabled),
  .ts-details-btn,
  .ts-student-course-indicator,
  .ts-calendar .ts-student-cell-content
):is(:link, :visited, :hover, :focus, :focus-visible, :active),
body.ts-app-shell .ts-btn-tiny:hover,
body.ts-app-shell .ts-btn-tiny:focus-visible {
  color: #fff !important;
}

/* Etichette e icone dentro i controlli rossi ereditano il bianco: il tema
   colora anche `span` / `i` / `strong` con regole proprie. */
body.ts-app-shell :is(
  .ts-btn-primary,
  .ts-btn-danger,
  .ts-profile-form button[type="submit"],
  .ts-subscription-primary,
  .ts-statistics-preset.is-active,
  .ts-page-btn.active,
  .ts-week-nav-btn:not(:disabled),
  .ts-details-btn,
  .ts-student-course-indicator
) :is(span, i, b, strong, em, small, svg, .ts-icon, .ts-btn-label):not(.ts-action-count) {
  color: inherit !important;
}

/* ---------- 2. Intestazione rossa del calendario (dashboard) ----------
   Testo diretto (titolo settimana, sottotitoli) bianco; i pulsanti
   freccia hanno sfondo chiaro e restano fuori. */
body.ts-app-shell .ts-calendar-header :is(h1, h2, h3, h4, h5, h6, p, div, span, strong, small, label):not(button *) {
  color: #fff !important;
}

/* ---------- 3. Testo rosso su fondo chiaro/pastello ----------
   Il rosso pieno su #fbeaec/#fff7f7 sta tra 4.2 e 4.7:1; il rosso profondo
   arriva a 5.7:1 e regge anche i colori del tema. */
body.ts-app-shell :is(
  .ts-subscription-filter.is-active,
  .ts-online-orders-period.is-active,
  .ts-more-button:hover,
  .ts-more-button:focus-visible,
  .ts-more-button[aria-expanded="true"]
) {
  color: var(--ts-red-deep) !important;
}

body.ts-app-shell :is(
  .ts-subscription-filter.is-active,
  .ts-online-orders-period.is-active,
  .ts-more-button:hover,
  .ts-more-button:focus-visible,
  .ts-more-button[aria-expanded="true"]
) :is(span, i, b, strong, svg, .ts-icon) {
  color: inherit !important;
}

/* ---------- 4. Celle studente del registro (dashboard) ----------
   Nome, stato e icone dentro la cella rossa restano bianchi: non si usa
   `inherit`, perché il tema colora il contenitore intermedio di scuro. */
body.ts-app-shell .ts-calendar .ts-student-cell-content :is(.ts-student-name, .ts-student-meta, .ts-student-meta-small, .ts-student-meta.inactive, .ts-student-meta-small.inactive) {
  color: #fff !important;
}

body.ts-app-shell .ts-calendar .ts-student-cell-content :is(.ts-student-meta.active, .ts-student-meta-small.active) {
  color: #eaffef !important;
}

/* ---------- 5. Pulsanti arancioni, scheda attiva, navigazione staff ---------- */
body.ts-app-shell .ts-btn-warning,
body.ts-app-shell .ts-btn-warning :is(span, i, svg, .ts-icon, .ts-btn-label):not(.ts-action-count) {
  color: #fff !important;
}

/* Il numerino su fondo bianco dentro i bottoni (es. «Pagamenti 1») resta scuro. */
body.ts-app-shell .ts-action-count {
  color: var(--ts-red-deep) !important;
}

body.ts-app-shell .ts-btn-warning .ts-action-count {
  color: #92400e !important;
}

body.ts-app-shell .ts-tab-btn.active {
  color: #005a87 !important;
}

body.ts-app-shell .ts-staff-nav__link.is-active {
  color: #ff6b73 !important;
}
