/*
 * NutriLift — Training Module
 * Entry point: importa i moduli separati.
 */

@import "training-scheda.css";
@import "training-aderenza.css";
@import "training-esercizi.css";
@import "training-progressi.css";
@import "training-sessions-weekly.css";
@import "training-gestione.css";

/* Program Builder: impostazioni calendario e sequenza flessibile. */
.pb-shell .pb-schedule-settings {
  display: grid;
  padding: 16px 20px;
  border-block: 1px solid var(--border-light);
  background: color-mix(in srgb, var(--bg-surface-raised) 58%, transparent);
}

.pb-shell .pb-schedule-settings__intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  gap: 3px;
  padding-bottom: 14px;
}

.pb-shell .pb-schedule-settings__intro-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.pb-shell .pb-schedule-settings.is-collapsed .pb-schedule-settings__intro {
  padding-bottom: 0;
}

.pb-shell .pb-schedule-settings__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.pb-shell .pb-schedule-settings__toggle:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border-light));
  color: var(--text-heading);
}

.pb-shell .pb-schedule-settings__toggle:focus-visible {
  outline: 2px solid var(--gradient-app-start);
  outline-offset: 2px;
}

.pb-shell .pb-schedule-settings__toggle-chevron {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform .15s ease;
}

.pb-shell .pb-schedule-settings.is-collapsed .pb-schedule-settings__toggle-chevron {
  transform: none;
}

.pb-shell .pb-schedule-settings__body {
  display: grid;
}

.pb-shell .pb-schedule-settings__body[hidden] {
  display: none;
}

.pb-shell .pb-schedule-settings__eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pb-shell .pb-schedule-settings__intro p,
.pb-shell .pb-schedule-settings__group-hint,
.pb-shell .pb-schedule-choice__description,
.pb-shell .pb-session-structure__names,
.pb-shell .pb-frequency-mode__hint,
.pb-shell .pb-frequency-empty,
.pb-shell .pb-sequence-preview__row {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.42;
}

.pb-shell .pb-schedule-settings__intro p,
.pb-shell .pb-schedule-settings__group-hint,
.pb-shell .pb-schedule-choice__description,
.pb-shell .pb-session-structure__names,
.pb-shell .pb-frequency-mode__hint,
.pb-shell .pb-frequency-empty,
.pb-shell .pb-sequence-preview__row {
  font-size: 12px;
}

.pb-shell .pb-schedule-settings__group {
  display: grid;
  grid-template-columns: minmax(190px, .72fr) minmax(360px, 1.8fr);
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border-light);
}

.pb-shell .pb-schedule-settings__group-copy {
  display: grid;
  align-content: start;
  gap: 4px;
}

.pb-shell .pb-schedule-settings__group-title {
  margin: 0;
  color: var(--text-heading);
  font-size: 13px;
  line-height: 1.35;
}

.pb-shell .pb-schedule-settings__group-control {
  min-width: 0;
}

.pb-shell .pb-schedule-settings__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pb-shell .pb-schedule-settings__group--mode .pb-schedule-settings__choices,
.pb-shell .pb-schedule-settings__group--rotation .pb-schedule-settings__choices,
.pb-shell .pb-schedule-settings__group--missed .pb-schedule-settings__choices {
  padding: 4px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: var(--bg-surface-raised);
}

.pb-shell .pb-schedule-settings__option {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
}

.pb-shell .pb-schedule-choice {
  display: grid;
  align-content: center;
  min-height: 68px;
  padding: 11px 12px;
  text-align: left;
}

.pb-shell .pb-schedule-choice__title {
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.pb-shell .pb-schedule-choice.is-active {
  border-color: var(--brand-border);
  background: color-mix(in srgb, var(--brand) 8%, var(--bg-surface));
  box-shadow: 0 1px 4px color-mix(in srgb, var(--brand-shadow) 45%, transparent);
}

.pb-shell .pb-schedule-choice:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border-light));
}

.pb-shell .pb-schedule-choice:focus-visible {
  outline: 2px solid var(--gradient-app-start);
  outline-offset: 2px;
}

.pb-shell .pb-day-order-actions button:focus-visible,
.pb-shell .pb-day-wrap--flexible > .t-drag-handle:focus-visible {
  outline: 2px solid var(--gradient-app-start);
  outline-offset: 2px;
}

/* Struttura della scheda: chi sta nella rotazione. Surface piena e sempre
   visibile, perché resta leggibile anche con la programmazione collassata. */
.pb-shell .pb-session-structure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
}

.pb-shell .pb-session-structure__copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.pb-shell .pb-session-structure__eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pb-shell .pb-session-structure__title {
  margin: 0;
  color: var(--text-heading);
  font-size: 15px;
  line-height: 1.3;
}

.pb-shell .pb-session-structure__names {
  overflow-wrap: anywhere;
}

/* Divario fra il conteggio e la rotazione servita: è un'informazione, non un
   errore, quindi resta nel tono della banda e non urla. Nessun colore nuovo. */
.pb-shell .pb-session-structure__gap {
  margin: 2px 0 0;
  color: var(--warning);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Frequenza: due modalità e, solo se serve, i valori. Nessuna card annidata
   per ogni numero: i valori sono bottoni piccoli in riga. */
.pb-shell .pb-frequency-control {
  display: grid;
  gap: 10px;
}

.pb-shell .pb-frequency-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pb-shell .pb-frequency-mode {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 10px 12px;
  text-align: left;
}

.pb-shell .pb-frequency-mode__title {
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.pb-shell .pb-frequency-mode.is-active {
  border-color: var(--brand-border);
  background: color-mix(in srgb, var(--brand) 8%, var(--bg-surface));
  box-shadow: 0 1px 4px color-mix(in srgb, var(--brand-shadow) 45%, transparent);
}

.pb-shell .pb-frequency-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pb-shell .pb-frequency-value {
  min-width: 34px;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.pb-shell .pb-frequency-value.is-active {
  border-color: var(--brand-border);
  background: color-mix(in srgb, var(--brand) 14%, var(--bg-surface));
  color: var(--text-heading);
}

.pb-shell .pb-frequency-mode:hover:not(:disabled),
.pb-shell .pb-frequency-value:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border-light));
}

.pb-shell .pb-frequency-mode:focus-visible,
.pb-shell .pb-frequency-value:focus-visible {
  outline: 2px solid var(--gradient-app-start);
  outline-offset: 2px;
}

.pb-shell .pb-schedule-choice:disabled,
.pb-shell .pb-frequency-mode:disabled,
.pb-shell .pb-frequency-value:disabled {
  cursor: not-allowed;
  opacity: .55;
}

/* Rapporto e traccia nominale: una sola linea di separazione, niente card. */
.pb-shell .pb-sequence-preview {
  position: relative;
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.pb-shell .pb-sequence-preview__ratio {
  margin: 0;
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.pb-shell .pb-sequence-preview__eyebrow {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pb-shell .pb-sequence-preview__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pb-shell .pb-sequence-preview__label {
  font-weight: 600;
}

.pb-shell .pb-sequence-preview__track {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--text-secondary);
}

.pb-shell .pb-sequence-preview__node {
  padding: 1px 8px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.pb-shell .pb-sequence-preview__note {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* La sequenza flessibile è un'unica card per seduta: maniglia, contenuto e
   frecce sono regioni della stessa forma, non tre riquadri incollati. */
.pb-shell .pb-day-wrap--flexible {
  align-items: stretch;
  border: 1.5px solid var(--border-light);
  border-radius: 13px;
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.pb-shell .pb-day-wrap--flexible:has(.pb-day.is-active) {
  border-color: var(--gradient-app-start);
  background: color-mix(in srgb, var(--gradient-app-start) 7%, var(--bg-surface));
  box-shadow: 0 2px 10px color-mix(in srgb, var(--gradient-app-start) 20%, transparent);
}

.pb-shell .pb-day-wrap--flexible > .t-drag-handle,
.pb-shell .pb-day-wrap--flexible > .pb-day,
.pb-shell .pb-day-wrap--flexible > .pb-day-order-actions {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pb-shell .pb-day-wrap--flexible > .t-drag-handle {
  display: grid;
  place-items: center;
  width: 24px;
  padding: 0;
  border-right: 1px solid var(--border-light);
  color: var(--text-muted);
  cursor: grab;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  opacity: .55;
  transition: opacity .15s ease, background .15s ease;
}

.pb-shell .pb-day-wrap--flexible > .t-drag-handle:hover,
.pb-shell .pb-day-wrap--flexible > .t-drag-handle:focus-visible {
  opacity: 1;
  background: var(--bg-surface-raised);
}

.pb-shell .pb-day-wrap--flexible > .pb-day {
  flex: 1;
  min-width: 0;
}

.pb-shell .pb-day-wrap--flexible .pb-day-badge {
  border-radius: 50%;
}

.pb-shell .pb-day-order-actions {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0 5px;
  border-left: 1px solid var(--border-light);
  background: var(--brand-bg-light);
}

.pb-shell .pb-day-order-actions button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  opacity: .95;
  transition: opacity .15s ease, background .15s ease;
}

.pb-shell .pb-day-order-actions button:hover:not(:disabled),
.pb-shell .pb-day-order-actions button:focus-visible {
  opacity: 1;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
}

.pb-shell .pb-day-order-actions button:disabled { cursor: default; opacity: .2; }

@media (max-width: 760px) {
  .pb-shell .pb-schedule-settings {
    padding-inline: 14px;
  }

  .pb-shell .pb-session-structure {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding-inline: 14px;
  }

  .pb-shell .pb-schedule-settings__group {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .pb-shell .pb-schedule-settings__choices {
    grid-template-columns: minmax(0, 1fr);
  }

  .pb-shell .pb-frequency-modes {
    grid-template-columns: minmax(0, 1fr);
  }

  .pb-shell .pb-frequency-values {
    flex-wrap: wrap;
  }

  .pb-shell .pb-day-wrap--flexible {
    flex: 1 1 100%;
  }
}
