/**
 * components.css — Componentes de UI: alertas, toasts, botones, loader y modal Acerca de
 * Biblia Conexiones PWA
 *
 * Incluye alertas flotantes responsivas, animación de conexiones, loader CSS,
 * botones primarios/secundarios/flotantes y la cabecera modal 'Acerca de'.
 */

/* ─── ALERTAS FLOTANTES ─────────────────────────────────────────────────────── */

.alert {
    position: fixed;
    top: 90px;
    right: 0px;
    z-index: 5000;
}

@media (min-width: 576px) {
    .alert {
        right: calc(50vw - 285px);
        width: 70%;
    }
}

@media (min-width: 768px) {
    .alert {
        right: calc(50vw - 375px);
        width: 60%;
    }
}

@media (min-width: 992px) {
    .alert {
        right: calc(50vw - 495px);
        width: 50%;
    }
}

@media (min-width: 1200px) {
    .alert {
        right: calc(50vw - 585px);
        width: 40%;
    }
}

@media (min-width: 1400px) {
    .alert {
        right: calc((50vw - 660px) + 30px);
        width: 30%;
    }
}

/* ─── BOTÓN DE CIERRE DE TARJETAS FLOTANTES ─────────────────────────────────── */

.btn-close-card {
    cursor: pointer;
    font-size: 1.3rem;
    margin-bottom: 3px;
    /* color: var(--primary); */
    transition: var(--transition);
}

.btn-close-card:hover {
    /* color: var(--primary-hover); */
    transform: scale(1.1);
}

/* ─── LOADER ANIMADO CSS ────────────────────────────────────────────────────── */

.loader {
    height: 9px;
    width: 60px;
    --c: no-repeat linear-gradient(#6c747e 0 0);
    background: var(--c), var(--c), var(--c), var(--c);
    background-size: 26% 3px;
    animation: l2 1s infinite;
}

@keyframes l2 {
    0%, 70%, 100% {
        background-position: calc(0*100%/3) 100%, calc(1*100%/3) 100%, calc(2*100%/3) 100%, calc(3*100%/3) 100%
    }
    14% {
        background-position: calc(0*100%/3) 0, calc(1*100%/3) 100%, calc(2*100%/3) 100%, calc(3*100%/3) 100%
    }
    28% {
        background-position: calc(0*100%/3) 100%, calc(1*100%/3) 0, calc(2*100%/3) 100%, calc(3*100%/3) 100%
    }
    42% {
        background-position: calc(0*100%/3) 100%, calc(1*100%/3) 100%, calc(2*100%/3) 0, calc(3*100%/3) 100%
    }
    56% {
        background-position: calc(0*100%/3) 100%, calc(1*100%/3) 100%, calc(2*100%/3) 100%, calc(3*100%/3) 0
    }
}

/* ─── BOTONES Y VARIANTES DE UI ─────────────────────────────────────────────── */

.btn-nav {
    width: 40px;
    height: 40px;
    text-align: center;
    padding: 0;
    font-size: 20px;
    line-height: 0.95;
    border-radius: 20px;
    z-index: 200;
}

.btn-historial {
  max-width: 200px;
  width: auto;
  height: 40px;
  text-align: center;
  border-radius: 20px;
  padding: 0 12px;
  background-color: var(--bs-body-bg) !important;
  color: var(--bs-text-color) !important;
  white-space: nowrap;
}

.btn-historial.dropdown-toggle::after {
  display: none !important;
}

#historialDropdown {
  max-height: 280px;
  overflow-y: auto;
  min-width: 180px;
  font-size: 0.9rem;
  border-radius: 12px;
  margin-bottom: 8px !important;
  z-index: 250;
}

#historialDropdown .dropdown-item {
  cursor: pointer;
  padding: 6px 14px;
}

#historialDropdown .dropdown-item:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
}

.btn-grey {
    color: var(--grey-60);
    background-color: var(--bs-body-bg);
    border: 0;
}

.btn-grey:hover,
.btn-grey:focus {
    color: var(--grey-80);
    background-color: var(--bs-body-bg);
}

[data-bs-theme="dark"] .btn-grey:hover,
[data-bs-theme="dark"] .btn-grey:focus {
    color: var(--grey-20);
    background-color: var(--bs-body-bg);
}

.btn-verse {
    text-align: left;
    line-height: 1.5rem;
    width: 100%;
    background-color: var(--bs-body-bg);
    padding: 10px;
    border: 0;
}

.btn-verse:hover,
.btn-verse:focus {
    background-color: var(--bs-body-bg);
    border: 0;
}

.btn-verse.active {
    background-color: var(--grey-30);
    border: 1px;
}

[data-bs-theme="dark"] .btn-verse.active {
    background-color: var(--grey-70);
    border: 1px;
}

.btn-verse.active .standard {
    color: var(--text-color);
    border: 0;
}

[data-bs-theme="dark"] .btn-verse.active .standard {
    color: var(--grey-10);
    border: 0;
}

.btn-verse.active .resalted {
    color: var(--grey-90);
    border: 0;
}

[data-bs-theme="dark"] .btn-verse.active .resalted {
    color: var(--grey-10);
    border: 0;
}

/* Botones de planes de lectura */
.btn-verse-badge {
    text-align: center;
    padding: 0.375rem 0.75rem;
    color: var(--primary);
    transition: var(--transition);
}

.btn-verse-badge:hover {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

[data-bs-theme="dark"] .btn-verse-badge {
    color: var(--primary-dark);
}

[data-bs-theme="dark"] .btn-verse-badge:hover {
    background-color: var(--primary-dark);
    color: #ffffff;
    border-color: var(--primary-dark);
}

/* Íconos de navegación inferior en móviles */
.nav-bottom-item {
  background: transparent;
  border: none;
  color: #ffffff;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  gap: 2px;
  width: 100%;
  height: 100%;
  cursor: pointer;
  transition: color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.nav-bottom-item:hover,
.nav-bottom-item:focus {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.nav-bottom-item.disabled,
.nav-bottom-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-bottom-item i {
  font-size: 1.4rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.nav-bottom-item span {
  display: block;
  white-space: nowrap;
}

/* Dropdowns para la barra de navegación inferior en móviles */
.dropdown-menu-icon,
.dropdown-menu-bottom-nav {
    min-width: 68px;
    padding: 8px 5px;
    background-color: var(--bs-body-bg);
    border-radius: 18px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--grey-40);
}

/* Dentro de .navbar Bootstrap desactiva Popper y ancla el menú al borde izquierdo
   (left: 0); se centra respecto al ícono para que no se salga de la pantalla. */
.dropup-center > .dropdown-menu-icon[data-bs-popper],
.dropup-center > .dropdown-menu-bottom-nav[data-bs-popper] {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

[data-bs-theme="dark"] .dropdown-menu-icon,
[data-bs-theme="dark"] .dropdown-menu-bottom-nav {
    border-color: var(--grey-70);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.dropdown-menu-icon .btn-link {
    padding-left: 0;
    padding-right: 0;
    width: 100%;
    text-decoration: none !important;
}

.dropdown-bottom-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--grey-70);
    transition: all 0.2s ease;
    user-select: none;
    text-align: center;
    width: 100%;
    padding: 6px 4px;
    border-radius: 12px;
    text-decoration: none !important;
    gap: 2px;
}

.dropdown-bottom-item i {
    font-size: 1.35rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dropdown-bottom-item span {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.15;
    white-space: nowrap;
}

.dropdown-bottom-item:hover,
.dropdown-bottom-item:focus {
    color: var(--primary);
    background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.08);
    transform: scale(1.04);
}

[data-bs-theme="dark"] .dropdown-bottom-item {
    color: var(--grey-40);
}

[data-bs-theme="dark"] .dropdown-bottom-item:hover,
[data-bs-theme="dark"] .dropdown-bottom-item:focus {
    color: var(--grey-10);
    background-color: rgba(255, 255, 255, 0.08);
}

.bg-panels {
    background-color: var(--bs-body-bg);
}

/* ─── MODALES ─────────────────────────────────────────────────────────────── */

.floating-header {
  height: 36px !important;
  background-color: var(--bs-secondary-bg) !important;
  color: var(--text-color) !important;
}

[data-bs-theme="dark"] .floating-header {
  color: var(--grey-20) !important;
}

.floating-header .btn-close {
  color: var(--text-color) !important;
}

#edlp_logo {
  filter: none;
}

[data-bs-theme="dark"] #edlp_logo {
  filter: invert(1);
}

/* ─── PHOSPHOR ICONS Y ENVOLTORIOS ────────────────────────────────────────── */

.ph,
.ph-bold,
.ph-fill,
.ph-light,
.ph-thin,
.ph-duotone,
[class^="ph-"],
[class*=" ph-"] {
  display: inline-block;
  text-decoration: none !important;
  vertical-align: text-bottom !important;
}

/* Evitar subrayado en enlaces, botones o contenedores que envuelven iconos Phosphor */
a:has([class*="ph"]),
a:has([class^="ph"]),
button:has([class*="ph"]),
button:has([class^="ph"]),
label:has([class*="ph"]),
label:has([class^="ph"]),
.btn-link:has([class*="ph"]),
.btn-link:has([class^="ph"]),
.menu-lat-link {
  text-decoration: none !important;
}

a:has([class*="ph"]):hover,
a:has([class*="ph"]):focus,
button:has([class*="ph"]):hover,
button:has([class*="ph"]):focus,
label:has([class*="ph"]):hover,
label:has([class*="ph"]):focus,
.btn-link:has([class*="ph"]):hover,
.btn-link:has([class*="ph"]):focus,
.menu-lat-link:hover,
.menu-lat-link:focus {
  text-decoration: none !important;
}

tiny,
.tiny {
  font-size: 0.7em;
}

/* ─── REPRODUCTOR DE AUDIO DEL LECTOR ───────────────────────────────────────── */

#show_menulat { position: relative; }

.btn-audio-toggle {
    position: absolute;
    top: -2px;
    right: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 8px;
    font-size: 24px;
    line-height: 1;
    color: #fff;
    background-color: #f58220;
    border: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-audio-toggle:hover,
.btn-audio-toggle:focus-visible,
.btn-audio-toggle.active { color: #fff; background-color: #d96d12; }

/* Ecualizador animado mientras se reproduce */
.audio-eq { display: none; height: 22px; align-items: flex-end; gap: 4px; }
.audio-eq i { width: 3px; height: 100%; background: #fff; border-radius: 2px; transform-origin: bottom; animation: audio-eq 0.9s ease-in-out infinite; }
.audio-eq i:nth-child(2) { animation-delay: -0.6s; }
.audio-eq i:nth-child(3) { animation-delay: -0.3s; }
.audio-eq i:nth-child(4) { animation-delay: -0.75s; }
.btn-audio-toggle.playing #audio_toggle_idle { display: none; }
.btn-audio-toggle.playing .audio-eq { display: flex; }
@keyframes audio-eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .audio-eq i { animation: none; transform: scaleY(.6); } }

#audio_player {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 50px;
    width: min(460px, calc(100% - 16px));
    padding: 8px 14px 6px;
    border-radius: 14px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    z-index: 110;
}
.audio-controls { display: flex; justify-content: center; align-items: center; gap: 8px; }
.audio-btn {
    width: 32px; height: 32px; padding: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: var(--bs-body-color); border: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg);
}
.audio-btn:hover, .audio-btn:focus-visible { border: 2px solid var(--bs-border-color); color: var(--bs-body-color); background: var(--bs-tertiary-bg); opacity: .9; }
.audio-btn-main { width: 42px; height: 42px; font-size: 24px; color: #fff; background: var(--bs-primary); border-color: var(--bs-primary); }
.audio-btn-main:hover, .audio-btn-main:focus-visible { color: #fff; border: 2px solid var(--bs-primary); background: var(--bs-primary); opacity: .9; }
.audio-progress { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: var(--bs-secondary-color); margin-top: 4px; }
.audio-seek { position: relative; flex: 1; min-width: 0; height: 1.4rem; }
.audio-seek-track { position: absolute; left: 0; right: 0; top: 50%; height: .45rem; transform: translateY(-50%); background: var(--bs-secondary-bg); border-radius: 1rem; overflow: hidden; }
.audio-seek-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--bs-primary); }
.audio-seek-input { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }

/* Selector de velocidad: botón con la velocidad actual + panel con range de 5 pasos */
.audio-btn-speed { font-size: .72rem; font-weight: 700; letter-spacing: -.02em; }
.audio-btn-speed.active { color: var(--bs-primary); border-color: var(--bs-primary); }
.audio-speed-panel { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--bs-border-color); }
.audio-speed-range { --pos: 25%; position: relative; height: 1.4rem; margin: 0 10px; }
.audio-speed-range::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: .45rem; transform: translateY(-50%); border-radius: 1rem; background: var(--bs-secondary-bg); }
.audio-speed-range::after { content: ''; position: absolute; left: 0; top: 50%; height: .45rem; width: var(--pos); transform: translateY(-50%); border-radius: 1rem; background: var(--bs-primary); }
.audio-speed-input { position: relative; z-index: 1; width: 100%; height: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.audio-speed-input::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.audio-speed-input::-moz-range-track { height: 100%; background: transparent; }
.audio-speed-input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: calc(.7rem - 9px); border-radius: 50%; background: #fff; border: 3px solid var(--bs-primary); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.audio-speed-input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--bs-primary); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.audio-speed-ticks { display: flex; justify-content: space-between; margin: 0 -4px; font-size: .7rem; color: var(--bs-secondary-color); }
.audio-speed-ticks span { width: 2.6rem; text-align: center; cursor: pointer; }
.audio-speed-ticks span.active { color: var(--bs-primary); font-weight: 700; }

/* El texto baja cuando los controles están visibles */
#reading-area { transition: padding-top .2s ease; }
#reading_container.audio-open #reading-area { padding-top: 104px !important; }
#reading_container.audio-open.audio-speed-open #reading-area { padding-top: 160px !important; }

/* Versículo que se está leyendo en voz alta: solo barra derecha y número, para no pisar
   el resaltado de color (fondo + borde izquierdo) ni el versículo seleccionado (fondo) */
#reading-area p.verse-reading {
    box-shadow: inset -5px 0 0 #f58220;
    /* border-radius: 0 4px 4px 0; */
}
#reading-area p.verse-reading .verse-num {
    color: #f58220;
    opacity: 1;
}
