/* ==========================================================================
   GLAM FLOW STUDIO — Parrilla semanal de horarios
   Tabla semántica con navegación por semana y scroll contenido en móvil.
   ========================================================================== */

.schedule {
  width: 100%;
  min-width: 0;
}

.schedule[aria-busy="true"] {
  opacity: 0.72;
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  text-align: center;
}

.schedule-period {
  display: grid;
  min-width: min(17rem, 58vw);
  gap: var(--space-1);
}

.schedule-period__label,
.schedule-table__day span,
.schedule-table__corner,
.schedule-table__time {
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.schedule-period__label {
  font-size: var(--text-xs);
}

.schedule-period strong {
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}

.schedule-nav,
.schedule-today,
.schedule-empty button {
  border: 1px solid var(--color-border-soft);
  color: var(--color-text);
  background: var(--color-surface);
  font-family: var(--font-ui);
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out-expo),
    box-shadow var(--dur-fast) var(--ease-out-expo);
}

.schedule-nav {
  display: grid;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-pill);
  place-items: center;
  font-size: var(--text-xl);
  line-height: 1;
}

.schedule-today,
.schedule-empty button {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
}

.schedule-nav:hover,
.schedule-today:hover,
.schedule-empty button:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-rosa);
}

.schedule-nav:focus-visible,
.schedule-today:focus-visible,
.schedule-empty button:focus-visible,
.schedule-scroll:focus-visible,
.schedule-entry:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 3px;
}

.schedule-table-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

/* La parrilla NO scrollea en horizontal en ningun ancho. Antes este contenedor
   era overflow-x:auto con una tabla de min-width fijo, y en anchos intermedios
   aparecia y desaparecia una barra de scroll fantasma (en macOS las barras son
   overlay: bastaba 1px de sobreancho por redondeo subpixel de los bordes de
   celda para que asomara al hacer scroll y se fuera sola). Ahora la tabla se
   reparte el ancho disponible y por debajo de 760px se apila por dia, asi que
   el calendario se ve siempre completo. No reintroducir min-width aqui. */
.schedule-scroll {
  max-width: 100%;
}

.schedule-table {
  width: 100%;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--color-text);
  background: var(--color-surface);
}

.schedule-table th,
.schedule-table td {
  border-right: 1px solid var(--color-border-soft);
  border-bottom: 1px solid var(--color-border-soft);
}

.schedule-table tr > :last-child {
  border-right: 0;
}

.schedule-table tbody tr:last-child > * {
  border-bottom: 0;
}

.schedule-table thead th {
  height: 4.5rem;
  padding: var(--space-2);
  background: var(--color-surface);
  text-align: center;
}

.schedule-table__corner,
.schedule-table__time {
  position: sticky;
  left: 0;
  z-index: var(--z-sticky);
  width: 5.25rem;
  min-width: 5.25rem;
  background: var(--color-surface);
  font-size: var(--text-xs);
  text-align: center;
}

.schedule-table__corner {
  z-index: calc(var(--z-sticky) + 1);
}

.schedule-table__day span,
.schedule-table__day strong {
  display: block;
}

.schedule-table__day span {
  font-size: var(--text-xs);
}

.schedule-table__day strong {
  margin-top: var(--space-1);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.schedule-table__day.is-today span,
.schedule-table__day.is-today strong {
  color: var(--brand-rosa);
}

.schedule-table td {
  height: 7.25rem;
  padding: var(--space-2);
  vertical-align: middle;
  background: var(--color-surface-2);
  text-align: center;
}

.schedule-entry {
  position: relative;
  display: flex;
  min-height: 5.75rem;
  padding: var(--space-3) var(--space-2);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-align: center;
  text-decoration: none;
}

.schedule-entry + .schedule-entry {
  margin-top: var(--space-2);
}

.schedule-entry--class {
  border-left: 3px solid var(--schedule-accent);
  background: var(--color-surface);
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out-expo),
    box-shadow var(--dur-fast) var(--ease-out-expo);
}

.schedule-entry--class:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--shadow-soft),
    0 0 1.5rem color-mix(in srgb, var(--schedule-accent) 28%, transparent);
}

.schedule-entry--block {
  color: var(--color-text-faint);
  background: var(--color-surface);
  cursor: default;
}

.schedule-entry__name {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: var(--leading-snug);
}

.schedule-entry__level {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
}

.schedule-entry__teacher {
  margin-top: var(--space-1);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
}

.schedule-entry--block .schedule-entry__level,
.schedule-entry--block .schedule-entry__teacher {
  color: var(--color-text-faint);
}

.schedule-entry__last {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}

.schedule-entry__last > span[aria-hidden="true"] {
  display: block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--brand-dorado);
  box-shadow: 0 0 0.65rem var(--brand-dorado);
}

.schedule-table__dash {
  color: var(--color-text-faint);
}

.schedule-empty {
  padding: var(--space-8) var(--space-4);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-muted);
  text-align: center;
}

.schedule-empty p {
  margin: 0;
}

.schedule-empty button {
  margin-top: var(--space-4);
}

.schedule-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Tablet y portatil angosto: la parrilla se comprime (columna de horas mas
   estrecha, menos padding) en lugar de desbordarse. */
@media (max-width: 1024px) {
  .schedule-table__corner,
  .schedule-table__time {
    width: 4.25rem;
    min-width: 4.25rem;
  }

  .schedule-table thead th {
    height: 4rem;
    padding: var(--space-1);
  }

  .schedule-table td {
    height: 6.75rem;
    padding: var(--space-1);
  }

  .schedule-entry {
    min-height: 5.5rem;
    padding-inline: var(--space-1);
  }

  .schedule-entry__name {
    font-size: var(--text-xs);
  }
}

/* Movil: seis o siete columnas no caben legibles en 360px, y la salida ya no
   puede ser scroll horizontal. La tabla se desarma y se apila por hora; cada
   clase se rotula con su dia via data-dia (lo pone js/schedule.js) y las
   celdas sin clase se ocultan, asi que se lee la semana entera de un tiron. */
@media (max-width: 759px) {
  .schedule-toolbar {
    gap: var(--space-2);
  }

  .schedule-period {
    min-width: 0;
    flex: 1;
  }

  .schedule-period__label {
    letter-spacing: var(--tracking-wide);
  }

  .schedule-table-frame {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .schedule-table,
  .schedule-table tbody,
  .schedule-table tr,
  .schedule-table td,
  .schedule-table th {
    display: block;
    width: auto;
    border: 0;
  }

  .schedule-table thead {
    display: none;
  }

  .schedule-table tr {
    margin-bottom: var(--space-4);
  }

  .schedule-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .schedule-table__time {
    position: static;
    width: auto;
    min-width: 0;
    padding: 0 0 var(--space-2);
    color: var(--brand-rosa);
    font-size: var(--text-sm);
    font-weight: 700;
    text-align: left;
  }

  /* Nada que mostrar en esa franja para ese dia: fuera, no un guion. */
  .schedule-table td[data-vacia] {
    display: none;
  }

  .schedule-table td {
    height: auto;
    margin-bottom: var(--space-3);
    padding: 0;
    background: transparent;
    text-align: left;
  }

  .schedule-table tr > td:last-child {
    margin-bottom: 0;
  }

  .schedule-table td::before {
    display: block;
    margin-bottom: 6px;
    color: var(--color-text-muted);
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    content: attr(data-dia);
  }

  .schedule-entry {
    min-height: 0;
    padding: var(--space-3);
    align-items: flex-start;
    border-radius: var(--radius-md);
    text-align: left;
  }

  /* Una hora en la que ningun dia tiene clase no deja fila vacia. */
  .schedule-table tr:not(:has(td:not([data-vacia]))) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .schedule-nav,
  .schedule-today,
  .schedule-empty button,
  .schedule-entry--class {
    transition: none;
  }

  .schedule-nav:hover,
  .schedule-today:hover,
  .schedule-empty button:hover,
  .schedule-entry--class:hover {
    transform: none;
  }
}
