/* audio_admin.css — Pantalla de administración de audios */

/* ─── DISTRIBUCIÓN: TRES COLUMNAS DE ALTURA COMPLETA (como el lector) ─────── */

#audio_admin_container {
  padding-top: 80px !important; /* Compensa la barra superior fija (#header_container) en escritorio */
  padding-bottom: 16px;
}

@media (max-width: 575.98px) {
  #audio_admin_container {
    padding-top: 16px !important;
    padding-bottom: 80px !important; /* Compensa la barra inferior fija (#bottom_container) en móviles */
  }
}

/* Escritorio: cada columna ocupa el alto disponible y hace scroll por su cuenta */
@media (min-width: 992px) {
  .au-col-card {
    height: calc(100dvh - 96px);
  }
  .au-aside {
    height: calc(100dvh - 96px);
    overflow-y: auto;
    padding-bottom: 2px;
  }
}

/* Móvil: el texto tiene alto propio para no alargar la página */
@media (max-width: 991.98px) {
  .au-verses {
    max-height: 60dvh;
  }
}

.au-aside > .card {
  margin-bottom: 1rem;
}

/* ─── LIBROS Y CAPÍTULOS ──────────────────────────────────────────────────── */

.au-nav {
  position: relative;
  overflow-y: auto;
  min-height: 0;
}
@media (max-width: 991.98px) {
  .au-nav {
    max-height: 50dvh;
  }
}

.au-book {
  margin-bottom: 0.9rem;
}
.au-book-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.au-book-name {
  font-size: 0.95rem;
  color: var(--bs-body-color);
}
.au-book-count {
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  font-variant-numeric: tabular-nums;
}
.au-book.is-current .au-book-name {
  font-weight: 700;
  color: var(--primary);
}
.au-book.is-complete .au-book-count {
  color: var(--bs-success);
  font-weight: 600;
}

.au-ch-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.25rem;
  padding-right: 0.15rem;
}

/* Cada cuadrito es un capítulo: borde = sin audio, relleno verde = con audio, punto = actual */
.au-ch {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 1.4rem;
  justify-self: center;
  padding: 0;
  border: 1.5px solid var(--primary);
  border-radius: 0.3rem;
  background: transparent;
  cursor: pointer;
  transition:
    background-color 0.12s,
    transform 0.12s;
}
.au-ch:hover {
  background: rgba(var(--bs-primary-rgb), 0.15);
  transform: scale(1.12);
}
.au-ch.has-audio {
  background: var(--bs-success);
  border-color: var(--bs-success);
}
.au-ch.has-audio:hover {
  background: var(--bs-success);
  filter: brightness(1.1);
}
.au-ch.is-current {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow:
    0 0 0 2px var(--bs-body-bg),
    0 0 0 3.5px var(--primary);
}
.au-ch.is-current.has-audio {
  background: var(--bs-success);
  border-color: var(--bs-success);
  box-shadow:
    0 0 0 2px var(--bs-body-bg),
    0 0 0 3.5px var(--bs-success);
}
.au-ch.is-current::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: #fff;
}
.au-ch:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

[data-bs-theme="dark"] .au-ch {
  border-color: var(--primary-dark);
}
[data-bs-theme="dark"] .au-ch.is-current {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow:
    0 0 0 2px var(--bs-body-bg),
    0 0 0 3.5px var(--primary-dark);
}
[data-bs-theme="dark"] .au-ch.has-audio {
  border-color: var(--bs-success);
}
[data-bs-theme="dark"] .au-ch.is-current.has-audio {
  background: var(--bs-success);
  border-color: var(--bs-success);
  box-shadow:
    0 0 0 2px var(--bs-body-bg),
    0 0 0 3.5px var(--bs-success);
}
[data-bs-theme="dark"] .au-book.is-current .au-book-name {
  color: var(--primary-dark-active);
}

.au-ch-legend {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border: 1.5px solid var(--primary);
  border-radius: 0.25rem;
  vertical-align: -0.1rem;
}
.au-ch-legend.has-audio {
  background: var(--bs-success);
  border-color: var(--bs-success);
}

/* ─── VERSÍCULOS ──────────────────────────────────────────────────────────── */

.au-verses {
  min-height: 240px;
  overflow-y: auto;
  position: relative;
}

.au-verse {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.5rem;
  border-left: 3px solid transparent;
  line-height: 1.55;
}
.au-verse .au-vnum {
  flex: 0 0 2rem;
  text-align: right;
  font-weight: 700;
  color: var(--bs-primary);
  font-size: 0.8rem;
  padding-top: 0.15rem;
}
.au-verse .au-vtext {
  flex: 1;
}
.au-verse .au-vtime {
  flex: 0 0 auto;
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  padding-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.au-verse.has-audio {
  cursor: pointer;
}
.au-verse.has-audio:hover {
  background: var(--bs-tertiary-bg);
}
.au-verses.is-fixing .au-verse.has-audio {
  cursor: cell;
}
.au-verse.is-selected {
  background: var(--bs-warning-bg-subtle);
  border-left-color: var(--bs-warning);
}
.au-verse.is-playing {
  background: var(--bs-primary-bg-subtle);
  border-left-color: var(--bs-primary);
}
.au-verse .au-skipped {
  color: var(--bs-secondary-color);
  font-style: italic;
}

/* Reproductor */
.au-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  position: relative;
  border-radius: 50%;
}
.au-btn-main {
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1.6rem;
}
.au-btn .au-sec {
  position: absolute;
  font-size: 0.55rem;
  font-weight: 700;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%);
  pointer-events: none;
}
.au-btn[disabled] {
  opacity: 0.45;
}

.au-seek {
  position: relative;
  height: 1.4rem;
}
.au-seek-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0.45rem;
  transform: translateY(-50%);
  background: var(--bs-secondary-bg);
  border-radius: 1rem;
  overflow: hidden;
}
.au-seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--bs-primary);
}
.au-seek-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--bs-body-bg);
  opacity: 0.8;
}
.au-seek-input {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.au-seek-input:disabled {
  cursor: default;
}

/* Spinner del botón mientras se genera el audio */
.ph-circle-notch {
  display: inline-block;
  animation: au-spin 0.9s linear infinite;
}
@keyframes au-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .ph-circle-notch { animation-duration: 2.5s; }
}

/* ─── REVISIÓN DE AUDIOS: capítulos y versículos marcados ──────────────────── */

/* Gravedad: 1 leve (amarillo), 2 medio (naranja), 3 grave (rojo); sustituye al verde "con audio" */
.au-ch.has-audio.flag-1, .au-ch-legend.flag-1, .au-vflag.flag-1 { --au-flag: #f4c20d; }
.au-ch.has-audio.flag-2, .au-ch-legend.flag-2, .au-vflag.flag-2 { --au-flag: #fd7e14; }
.au-ch.has-audio.flag-3, .au-ch-legend.flag-3, .au-vflag.flag-3 { --au-flag: #dc3545; }

.au-ch.has-audio.flag-1, .au-ch.has-audio.flag-2, .au-ch.has-audio.flag-3,
.au-ch.is-current.has-audio.flag-1, .au-ch.is-current.has-audio.flag-2, .au-ch.is-current.has-audio.flag-3,
[data-bs-theme="dark"] .au-ch.has-audio.flag-1, [data-bs-theme="dark"] .au-ch.has-audio.flag-2, [data-bs-theme="dark"] .au-ch.has-audio.flag-3,
[data-bs-theme="dark"] .au-ch.is-current.has-audio.flag-1, [data-bs-theme="dark"] .au-ch.is-current.has-audio.flag-2, [data-bs-theme="dark"] .au-ch.is-current.has-audio.flag-3 {
  background: var(--au-flag);
  border-color: var(--au-flag);
}
.au-ch.is-current.has-audio.flag-1, .au-ch.is-current.has-audio.flag-2, .au-ch.is-current.has-audio.flag-3 {
  box-shadow: 0 0 0 2px var(--bs-body-bg), 0 0 0 3.5px var(--au-flag);
}
.au-ch-legend.flag-1, .au-ch-legend.flag-2, .au-ch-legend.flag-3 {
  background: var(--au-flag);
  border-color: var(--au-flag);
}

/* Bandera del color de la marca en el versículo (la mayor gravedad entre los revisores) */
.au-vflag {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 0 0.1rem;
  color: var(--au-flag);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.au-vflag:hover { filter: brightness(0.85); }
.au-verse.is-flagged { border-left-color: var(--au-flag); }
.au-verse.is-flagged.flag-1 { --au-flag: #f4c20d; }
.au-verse.is-flagged.flag-2 { --au-flag: #fd7e14; }
.au-verse.is-flagged.flag-3 { --au-flag: #dc3545; }
.au-verse.is-flagged.is-selected { border-left-color: var(--bs-warning); }
.au-verse.is-flagged.is-playing { border-left-color: var(--bs-primary); }
