/* Componentes: los mismos que la app usa de shadcn/ui (botón, tarjeta, badge, alerta, tabla), con clases propias. */

/* ── Barra ─────────────────────────────────────────────────────────── */

.barra {
  background: var(--header);
  color: var(--header-foreground);
}

.barra__interior {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1.75rem;
  max-width: 72rem;
  min-height: 3.5rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.barra__marca {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  padding: 0.875rem 0;
}

.barra__titulo {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.barra__sigla,
.barra__rol {
  color: var(--header-muted);
  font-size: 0.75rem;
}

.barra__rol {
  font-size: inherit;
}

.barra__nav {
  display: flex;
  order: 3;
  gap: 1.5rem;
  align-self: stretch;
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid rgb(255 255 255 / 0.15);
}

.barra__link {
  display: flex;
  align-items: center;
  padding: 0.625rem 0;
  border-block: 2px solid transparent;
  color: var(--header-muted);
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
}

.barra__link:hover,
.barra__link[aria-current="page"] {
  color: var(--header-foreground);
}

.barra__link[aria-current="page"] {
  border-bottom-color: var(--header-accent);
}

.barra__usuario {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  padding: 0.625rem 0;
  font-size: 0.875rem;
}

.barra__nombre {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
}

.barra__salir {
  padding: 0;
  border: 0;
  background: none;
  color: var(--header-muted);
  cursor: pointer;
  text-underline-offset: 2px;
}

.barra__salir:hover {
  color: var(--header-foreground);
  text-decoration: underline;
}

@media (min-width: 768px) {
  .barra__interior {
    padding: 0 1.5rem;
  }

  .barra__nav {
    order: 0;
    width: auto;
    border-top: 0;
  }

  .barra__link {
    padding: 0;
  }
}

/* ── Íconos (trazos de lucide) ─────────────────────────────────────── */

.icono {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icono--chico {
  width: 0.75rem;
  height: 0.75rem;
}

.icono--tenue {
  color: var(--header-muted);
}

/* ── Página ────────────────────────────────────────────────────────── */

.contenido {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

@media (min-width: 640px) {
  .contenido {
    padding-inline: 1.5rem;
  }
}

.encabezado {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.encabezado__texto {
  min-width: 0;
}

.encabezado__acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.migas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.migas a {
  text-decoration: none;
}

.migas a:hover {
  color: var(--foreground);
  text-decoration: underline;
}

.titulo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
}

.descripcion {
  margin-top: 0.25rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* ── Botones ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn--outline {
  border-color: var(--input);
  background: var(--card);
  color: var(--foreground);
}

.btn--outline:hover {
  background: var(--muted);
}

.btn--bloque {
  width: 100%;
}

.btn--sm {
  height: 2rem;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
}

.btn--destructive {
  background: var(--destructive);
}

.btn--destructive:hover {
  background: var(--destructive-hover);
}

/* la etiqueta hace de botón del input de archivo, que queda oculto pero enfocable */
label.btn:focus-within {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.enlace {
  color: var(--primary);
  font-weight: 500;
  text-underline-offset: 2px;
}

.enlace:hover {
  text-decoration: underline;
}

.oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Tarjetas y listas ─────────────────────────────────────────────── */

.card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.card--vacia {
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  text-align: center;
}

.card--vacia .descripcion {
  margin-top: 0;
  font-size: 1rem;
}

.card--lista {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.card__destacado {
  font-weight: 500;
}

.lista__item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.lista__item + .lista__item {
  border-top: 1px solid var(--border);
}

.lista__texto {
  flex: 1;
  min-width: 0;
}

.lista__titulo {
  font-weight: 500;
}

.lista__motivo {
  margin-top: 0.25rem;
  color: var(--destructive);
  font-size: 0.875rem;
}

/* ── Badges ────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  height: 1.25rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge__punto {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: currentColor;
}

.badge--secondary {
  background: var(--secondary);
}

.badge--outline {
  border-color: var(--border);
  color: var(--muted-foreground);
}

.badge--info {
  background: var(--accent);
  color: var(--accent-foreground);
}

.badge--success {
  background: var(--success-soft);
  color: var(--success);
}

.badge--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge--destructive {
  background: var(--destructive-soft);
  color: var(--destructive);
}

/* ── Alertas ───────────────────────────────────────────────────────── */

.alert {
  display: grid;
  gap: 0.125rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  font-size: 0.875rem;
}

.alert:last-child {
  margin-bottom: 0;
}

.alert__titulo {
  font-weight: 500;
}

.alert--destructive {
  border-color: var(--destructive-soft);
  background: var(--destructive-soft);
  color: var(--destructive);
}

.alert--success {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.alert--warning {
  border-color: var(--warning-soft);
  background: var(--warning-soft);
  color: var(--warning);
}

.alert--info {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-foreground);
}

/* ── Formulario de solicitud ───────────────────────────────────────── */

.formulario {
  max-width: 42rem;
}

/* los pasos vacíos (todavía sin elegir) no dejan hueco */
.formulario__paso {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.formulario__paso:empty,
#mensaje:empty {
  display: none;
}

/* dentro del formulario el espacio lo da el gap */
.formulario .alert {
  margin-bottom: 0;
}

.formulario__acciones {
  display: flex;
  justify-content: flex-end;
}

.campo {
  display: grid;
  gap: 0.375rem;
}

.campo__etiqueta {
  font-size: 0.875rem;
  font-weight: 500;
}

.campo__valor {
  color: var(--muted-foreground);
}

.campo__ayuda {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.select {
  width: 100%;
  height: 2.25rem;
  padding: 0 0.625rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--card);
  font-size: 0.875rem;
}

.select:focus-visible {
  outline: 0;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgb(0 121 107 / 0.25);
}

.materias {
  display: grid;
  gap: 0.5rem;
}

.materias__lista {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.materias__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.materias__item + .materias__item {
  border-top: 1px solid var(--border);
}

/* ── Tabla ─────────────────────────────────────────────────────────── */

.tabla__contenedor {
  overflow-x: auto;
}

.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tabla th {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.tabla td {
  padding: 0.75rem 1rem;
  vertical-align: top;
}

.tabla tbody tr + tr td {
  border-top: 1px solid var(--border);
}

.tabla tbody tr:hover {
  background: var(--row-hover);
}

.tabla__mono {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.tabla__secundario {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.tabla__acciones {
  min-width: 13rem;
}

.tabla__error {
  margin-top: 0.375rem;
  color: var(--destructive);
  font-size: 0.75rem;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
}

/* panel de cancelar: se abre dentro de la celda (la tabla se desplaza y recortaría uno flotante) */
.desplegable summary {
  list-style: none;
}

.desplegable summary::-webkit-details-marker {
  display: none;
}

.desplegable[open] summary {
  background: var(--muted);
}

.desplegable__panel {
  display: grid;
  gap: 0.5rem;
  width: 16rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--card);
  font-size: 0.875rem;
  resize: vertical;
}

.textarea:focus-visible {
  outline: 0;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgb(0 121 107 / 0.25);
}

/* ── Subida en lote ────────────────────────────────────────────────── */

.lote {
  margin-bottom: 1.25rem;
}

.lote .alert + .alert {
  margin-top: 0.75rem;
}

.lote__lista {
  margin-top: 0.25rem;
  padding-left: 1.125rem;
  list-style: disc;
}

.lote__archivo {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  word-break: break-all;
}

.encabezado__acciones .htmx-indicator {
  margin-top: 0;
}

.tabla__pie {
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

/* ── Ingreso ───────────────────────────────────────────────────────── */

.ingreso {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - 3.5rem);
  padding: 2.5rem 1rem;
  background: linear-gradient(to right, #fafbfb, var(--background));
}

.ingreso__tarjeta {
  display: grid;
  gap: 1.25rem;
  width: 100%;
  max-width: 28rem;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* el logo ya dice «Microcredenciales» y la Facultad: es el título de la página */
.ingreso__marca {
  margin-bottom: 0.5rem;
}

.ingreso__logo {
  display: block;
  width: 100%;
  height: auto;
}

.ingreso__botones {
  display: grid;
  gap: 0.625rem;
}

.ingreso .alert {
  margin-bottom: 0;
}
