/*
 * cambio-grupo.css
 * Estilos de la página de horarios y cambios de grupo — CPM
 * Depende de admision.css y tokens globales de /style.css
 */

/* ── SECCIONES ─────────────────────────────────────────────── */

.card {
  margin-bottom: var(--space-lg, 1.5rem);
}

/* ── BÚSQUEDA ──────────────────────────────────────────────── */

.campo--inline {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.campo--inline input {
  flex: 1;
  padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
  font-size: var(--text-base, 1rem);
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  min-width: 0;
}

.campo--inline input:focus {
  outline: none;
  border-color: var(--color-acento, #c5a100);
  box-shadow: 0 0 0 3px rgba(197,161,0,.15);
}

.campo--inline button,
#btnSolicitarCambio,
#btnEnviar,
#btnNuevaBusqueda {
  padding: var(--space-sm, 0.5rem) var(--space-lg, 1.5rem);
  font-size: var(--text-base, 1rem);
  font-weight: 700;
  background-color: var(--color-acento, #c5a100);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

/* Evitar que Astra expanda el botón dentro del flex */
.campo--inline button {
  flex: 0 0 auto;
  width: auto !important;
}

.campo--inline button:hover:not(:disabled),
#btnSolicitarCambio:hover:not(:disabled),
#btnEnviar:hover:not(:disabled),
#btnNuevaBusqueda:hover:not(:disabled) {
  background-color: #a78b00;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── SPINNER ───────────────────────────────────────────────── */

.spinner-carga {
  display: inline-block;
  width: 48px;
  height: 48px;
  border: 5px solid #e5e7eb;
  border-top-color: var(--color-acento, #c5a100);
  border-radius: 50%;
  animation: girar 0.9s linear infinite;
  flex-shrink: 0;
}

.spinner-carga--sm {
  width: 20px;
  height: 20px;
  border-width: 3px;
}

@keyframes girar {
  to { transform: rotate(360deg); }
}

.spinner-linea {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted, #666);
}

/* ── TABLA DE HORARIOS ─────────────────────────────────────── */

#seccion-horarios h2 {
  margin-bottom: var(--space-md, 1rem);
}

.tabla-horarios {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.85rem, 2vw, 1rem);
}

.tabla-horarios tr:nth-child(even) {
  background-color: #fafafa;
}

.tabla-horarios tr:hover {
  background-color: #fffbea;
}

.th-horario {
  font-weight: 600;
  color: #444;
  padding: 6px 12px 6px 4px;
  vertical-align: top;
  white-space: nowrap;
  width: 40%;
}

.tabla-horarios td:last-child {
  padding: 6px 4px;
  color: var(--color-negro, #1a1a1a);
}

.texto-pendiente {
  color: #92400e;
}

.texto-sep {
  color: #1e40af;
}

/* ── NOTA CAMBIO ───────────────────────────────────────────── */

.nota-cambio {
  font-size: 0.9rem;
  color: var(--text-muted, #666);
  margin-bottom: var(--space-md, 1rem);
  line-height: 1.5;
}

#btnSolicitarCambio {
  width: 100%;
  padding: var(--space-md, 1rem);
}

/* ── FORMULARIO DE SOLICITUDES ─────────────────────────────── */

.campo {
  margin-bottom: var(--space-md, 1rem);
}

.campo label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.campo select,
.campo textarea {
  width: 100%;
  padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
  font-size: var(--text-base, 1rem);
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}

.campo select:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--color-acento, #c5a100);
  box-shadow: 0 0 0 3px rgba(197,161,0,.15);
}

.campo textarea {
  resize: vertical;
  min-height: 60px;
}

#btnAnadir {
  padding: var(--space-sm, 0.5rem) var(--space-lg, 1.5rem);
  font-size: var(--text-base, 1rem);
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

#btnAnadir:hover:not(:disabled) {
  background: #e5e7eb;
}

/* ── LISTA DE SOLICITUDES ACUMULADAS ───────────────────────── */

.titulo-lista {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
}

.solicitud-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.solicitud-item__texto {
  flex: 1;
}

.btn-eliminar {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.btn-eliminar:hover {
  color: #ef4444;
}

.texto-muted {
  color: var(--text-muted, #666);
  font-size: 0.875rem;
}

/* ── BOTONES ENVÍO ─────────────────────────────────────────── */

.botones-envio {
  margin-top: var(--space-md, 1rem);
}

.btn-primario {
  width: 100%;
  padding: var(--space-md, 1rem);
}

#btnNuevaBusqueda {
  width: 100%;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

#btnNuevaBusqueda:hover {
  background: #e5e7eb;
}

/* ── MENSAJES ──────────────────────────────────────────────── */

.cambio-mensaje {
  padding: var(--space-md, 1rem);
  border-radius: 6px;
  font-size: var(--text-base, 1rem);
  line-height: 1.5;
  margin-top: var(--space-md, 1rem);
}

.cambio-mensaje--error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.cambio-mensaje--ok {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}

/* ── RESULTADO FINAL ───────────────────────────────────────── */

.resultado-bloque {
  padding: var(--space-md, 1rem);
  border-radius: 6px;
  margin-bottom: var(--space-md, 1rem);
}

.resultado-bloque h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.resultado-item {
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.resultado-item:last-child {
  border-bottom: none;
}

.resultado--ok {
  background: #f0fdf4;
  border: 1px solid #86efac;
}

.resultado--ok h3 { color: #166534; }

.resultado--pendiente {
  background: #fffbeb;
  border: 1px solid #fcd34d;
}

.resultado--pendiente h3 { color: #92400e; }

.resultado--rechazado,
.resultado--error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
}

.resultado--rechazado h3,
.resultado--error h3 { color: #991b1b; }

.nota-resultado {
  font-size: 0.85rem;
  color: var(--text-muted, #666);
  font-style: italic;
  margin-top: 0.5rem;
}

/* ── RESPONSIVE ────────────────────────────────────────────── */

@media (max-width: 480px) {
  .campo--inline {
    flex-direction: column;
  }
  .th-horario {
    white-space: normal;
    width: 45%;
  }
}