/* ── Horarios – Workspace Theme Integration (Dark & Light Mode Compliant) ── */
[data-save-state] { font-size: .8rem; color: var(--text-muted); align-self: center; }
[data-save-state].is-save-error { color: var(--danger, #dc2626); font-weight: 600; }

.hor-reciclaje-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; padding: .75rem 1.5rem; background: var(--info-soft, #e0f2fe);
  border-bottom: 1px solid var(--border); font-size: .85rem; color: var(--text-main);
}
.hor-reciclaje-actions { display: flex; gap: .5rem; flex-shrink: 0; }

.hor-checks-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .35rem .75rem; margin-top: .35rem;
}
.hor-check-inline {
  display: flex; align-items: center; gap: .4rem; font-size: .82rem;
  color: var(--text-main); font-weight: 400; cursor: pointer;
}
.hor-check-inline input { margin: 0; }

.horarios-workspace {
  overflow: hidden;
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
}

.horarios-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.horarios-header > div:first-child {
  flex: 1 1 260px;
  min-width: 0;
}

.horarios-header h2 {
  margin: 0.2rem 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
}

.horarios-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.horarios-file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.6rem;
  flex: 1 1 auto;
}

.horarios-file-actions .btn {
  white-space: nowrap;
}

.horarios-file-actions > span {
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Antes los 7 botones (Excel + Deshacer/Rehacer/Guardar/Cargar/Copiar) iban
   sueltos en una sola fila, cada uno con su propio estilo (dos con `style=`
   en línea), sin agrupar. Se veían desalineados y como un desorden. Ahora se
   agrupan en tarjetas ("chips") con su propio fondo/borde, para que cada
   conjunto se lea como una unidad y todos los botones compartan la misma
   altura/alineación en vez de flotar sueltos. */
.horarios-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
}

.horarios-toolbar-group .btn {
  margin: 0;
}

/* Antes "Plantilla Excel" y "Subir Excel" llevaban `style="background:var(--success);color:#fff;border:none"`
   repetido en línea en cada botón. Una clase real evita que ambos se
   desincronicen si algo cambia el color de éxito del tema. */
.btn-excel {
  background: var(--success);
  color: #fff;
  border: 1px solid var(--success);
}
.btn-excel:hover {
  filter: brightness(1.06);
}

/* ── Steps nav ─────────────────────────────────────────────────────────── */
.horarios-steps {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.horarios-steps button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1rem 0.5rem;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.horarios-steps button:last-child {
  border-right: none;
}

/* Number circle */
.horarios-steps button > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 2px;
}

/* Step Label */
.horarios-steps button {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Step Sublabel */
.horarios-steps button > small {
  color: var(--text-faint, var(--text-muted));
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.8;
}

/* Hover state */
.horarios-steps button:hover:not(.is-active) {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Ready (Completed) State */
.horarios-steps button.is-ready {
  color: var(--text-main);
}
.horarios-steps button.is-ready > span {
  background: var(--success);
  border: 1px solid var(--success);
  color: transparent;
  position: relative;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 15%, transparent);
}
.horarios-steps button.is-ready > span::after {
  content: '✓';
  position: absolute;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}

/* Active State */
.horarios-steps button.is-active {
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--primary) 5%, transparent));
  border-bottom-color: var(--primary);
  color: var(--text-main);
}

.horarios-steps button.is-active > span {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
}

.horarios-steps button.is-ready.is-active > span {
  background: var(--success);
  color: transparent;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 20%, transparent);
}

.horarios-steps button.is-active > small {
  color: var(--primary);
  opacity: 1;
}

/* ── Content area ──────────────────────────────────────────────────────── */
#horarios-content {
  padding: 1.5rem;
  color: var(--text-main);
}

.hor-step-intro {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border);
}

.hor-step-intro p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ── Rediseño de Tarjetas de Jornada ───────────────────────────────────── */
.hor-jornadas-grid {
  display: grid;
  gap: 1.5rem;
}

.hor-jornada-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--input-bg);
  padding: 1.35rem;
  display: grid;
  gap: 1.2rem;
  transition: var(--transition, all 0.2s ease);
}

.hor-jornada-card:hover {
  border-color: var(--primary);
}

.hor-jornada-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
}

.hor-jornada-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.hor-badge-count {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── Chips / Pills Interactivos de Días ───────────────────────────────── */
.hor-days-chips-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.hor-days-chips-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.hor-days-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hor-day-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border);
  background: var(--surface-glass);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: var(--transition, all 0.15s ease);
}

.hor-day-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.hor-day-chip input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.hor-day-chip.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

/* ── Grilla Visual de Periodos ────────────────────────────────────────────── */
.hor-preview-wrap {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  padding: 1rem;
}

.hor-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.hor-prev-col {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  padding: 0.5rem;
}

.hor-prev-day {
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  color: var(--text-main);
  text-transform: uppercase;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
  letter-spacing: 0.04em;
}

.hor-prev-cell {
  font-size: 0.72rem;
  padding: 0.35rem 0.25rem;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  line-height: 1.2;
}

/* "Clase" es el caso normal/mayoritario de la grilla — antes llevaba el
   mismo azul que "seleccionado" en los chips de arriba (pared azul sin
   jerarquía). Se quitó el color de marca a propósito (no es un estado
   especial), pero --input-bg es casi idéntico a --bg-card (el fondo de la
   columna que la contiene) en el tema Horizonte oscuro — quedaba sin ningún
   contraste, como si le faltara estilo. Con un gris neutro (sin tono de
   marca) la celda vuelve a leerse como una pastilla independiente. */
.hor-prev-clase {
  background: color-mix(in srgb, var(--text-muted) 12%, var(--bg-card));
  color: var(--text-main);
  border: 1px solid var(--border-glass-active, var(--border));
}

.hor-prev-recreo {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--border);
}

.hor-prev-almuerzo {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--border);
}

/* Periodos que no son clase/recreo/almuerzo (p.ej. bloques especiales) no
   tenían ninguna regla — se veían como una celda plana sin color, como si
   faltara un estilo. */
.hor-prev-especial {
  background: color-mix(in srgb, var(--text-muted) 20%, var(--bg-card));
  color: var(--text-main);
  border: 1px solid var(--border);
}

/* ── Acciones por Día ─────────────────────────────────────────────────── */
.hor-jornada-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* ── Rediseño de Reglas ─────────────────────────────────────────────────── */
.hor-reglas-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.hor-rule-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--input-bg);
  cursor: pointer;
  transition: var(--transition, all 0.15s ease);
}

.hor-rule-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.hor-rule-card input[type="checkbox"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  margin-top: 0.15rem;
  cursor: pointer;
}

.hor-rule-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hor-rule-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.hor-rule-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ── Modales ──────────────────────────────────────────────────────────── */
.hor-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  z-index: 9000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.hor-modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  border-radius: var(--radius-lg, 16px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: grid;
  gap: 1.1rem;
  box-shadow: var(--shadow-xl);
}

.hor-modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.hor-modal-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.hor-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .horarios-steps { grid-template-columns: repeat(4, 1fr); }
  .hor-reglas-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .horarios-steps { grid-template-columns: repeat(2, 1fr); }
  .horarios-header { flex-direction: column; }
}
