/* assets/style.css — Biblia en Audio
   Paleta tomada del widget DanDigital.Pro:
   Azul (#1e40af→#3b82f6) primario · Ámbar (#fbbf24→#f59e0b) CTA · Verde/Rojo de apoyo
   Superficies blancas, esquinas redondeadas, sombras suaves. Fuente UI: Inter.
   El texto bíblico usa Lora (serif) para lectura editorial. Mobile-first.
*/

/* ============================================================
   VARIABLES
   ============================================================ */
:root {
    /* Marca */
    --primary:        #2563eb;
    --primary-dark:   #1e40af;
    --primary-light:  #3b82f6;
    --grad-primary:   linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);

    /* CTA ámbar/dorado */
    --accent:         #f59e0b;
    --accent-light:   #fbbf24;
    --accent-text:    #78350f;
    --grad-accent:    linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --gold:           #f59e0b; /* alias usado por SVGs inline */

    /* Apoyo */
    --green:          #22c55e;
    --grad-green:     linear-gradient(135deg, #10b981 0%, #059669 100%);
    --error:          #ef4444;
    --error-dark:     #991b1b;

    /* Superficies y texto */
    --bg:             #f4f6fb;
    --surface:        #ffffff;
    --surface-2:      #f8f9fa;
    --border:         #e5e7eb;
    --text:           #1f2937;
    --text-strong:    #111827;
    --text-muted:     #6b7280;
    --text-dim:       #9ca3af;

    /* Versículo activo (resaltado cálido para "spotlight") */
    --highlight:        rgba(245, 158, 11, 0.12);
    --highlight-border: #f59e0b;

    /* Forma */
    --radius:     16px;
    --radius-sm:  12px;
    --radius-lg:  24px;
    --shadow:     0 20px 60px rgba(0,0,0,0.08);
    --shadow-sm:  0 4px 12px rgba(0,0,0,0.06);
    --shadow-accent: 0 8px 24px rgba(251,191,36,0.30);
    --transition: 200ms ease;

    --font-ui:   'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-text: 'Lora', Georgia, serif;
}

/* ============================================================
   RESET + BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

button { cursor: pointer; border: none; background: none; font-family: inherit; }

img { max-width: 100%; height: auto; }

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-strong);
    text-decoration: none;
}
.logo:hover { color: var(--primary); }

.logo-icon {
    width: 30px;
    height: 30px;
    color: var(--primary);
    flex-shrink: 0;
}

.logo-text {
    font-family: var(--font-text);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.logo-sub {
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    margin-left: auto;
}

/* Header del player (tiene nav) */
.header-inner {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chapter-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.chapter-title {
    font-family: var(--font-text);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    padding: 0 0.25rem;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.nav-btn:hover { background: #eff6ff; color: var(--primary); }
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn--disabled { opacity: 0.35; pointer-events: none; }

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
    margin-top: auto;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-dim);
}

.footer-link { color: var(--primary); font-weight: 500; }
.footer-link:hover { color: var(--primary-dark); }

/* ============================================================
   INDEX PAGE — HERO (estilo banner azul del widget)
   ============================================================ */
.main-index { flex: 1; padding: 2rem 0 3rem; }

.hero {
    position: relative;
    overflow: hidden;
    text-align: center;
    border-radius: var(--radius-lg);
    padding: 3.25rem 2rem;
    margin-bottom: 2.5rem;
    background-image: url('https://images.pexels.com/photos/1112048/pexels-photo-1112048.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2');
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow);
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30,64,175,0.88) 0%, rgba(59,130,246,0.78) 100%);
    z-index: 0;
}

.hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 1;
}

.hero-title {
    position: relative;
    z-index: 2;
    font-family: var(--font-text);
    font-size: clamp(1.9rem, 5vw, 3rem);
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -0.5px;
    margin-bottom: 0.85rem;
}

.hero-title::after {
    content: '';
    display: block;
    width: 64px;
    height: 3px;
    background: var(--accent-light);
    border-radius: 3px;
    margin: 0.9rem auto 0;
}

.hero-sub {
    position: relative;
    z-index: 2;
    color: rgba(255,255,255,0.95);
    font-size: 1.05rem;
    max-width: 540px;
    margin: 0 auto;
}

/* ============================================================
   SELECTOR CARD
   ============================================================ */
.selector-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 640px;
    margin: 0 auto 2.5rem;
    box-shadow: var(--shadow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 500px) {
    .form-row { grid-template-columns: 1fr; }
}

.form-group { display: flex; flex-direction: column; gap: 0.45rem; }

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-select {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    font-family: var(--font-ui);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 20px;
    padding-right: 2.4rem;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-select optgroup {
    color: var(--text-muted);
    font-style: normal;
    font-weight: 700;
}

.form-select option { color: var(--text); background: var(--surface); }

.btn-listen {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--grad-accent);
    color: var(--accent-text);
    font-weight: 700;
    font-size: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-accent);
    transition: transform var(--transition), box-shadow var(--transition);
}
.btn-listen:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(251,191,36,0.42); }
.btn-listen:active { transform: translateY(0); }
.btn-icon { width: 22px; height: 22px; }

/* ============================================================
   QUICK LINKS
   ============================================================ */
.section-title {
    font-family: var(--font-text);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.1rem;
    color: var(--text-strong);
    text-align: center;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.quick-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--primary-light);
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.quick-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(30,64,175,0.12);
    background: #eff6ff;
}

.quick-label {
    font-family: var(--font-text);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.quick-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ============================================================
   PLAYER PAGE LAYOUT
   ============================================================ */
.player-layout { flex: 1; padding: 1.5rem 0 2.5rem; }

.player-layout .container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .player-layout .container {
        grid-template-columns: 1fr 340px;
        align-items: start;
    }
}

@media (min-width: 1000px) {
    .player-layout .container {
        grid-template-columns: 1fr 380px;
    }
}

/* ============================================================
   PLAYER PANEL
   ============================================================ */
.player-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow);
}

.player-book-info { margin-bottom: 1.75rem; text-align: center; }

.player-book-name {
    font-family: var(--font-text);
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
}

.player-chapter-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- Generating state --- */
.generating-state {
    text-align: center;
    padding: 2.5rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.25rem;
}

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

.generating-text {
    font-family: var(--font-text);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 0.4rem;
}

.generating-sub { font-size: 0.88rem; color: var(--text-muted); }

/* --- Generate error --- */
.generate-error {
    text-align: center;
    padding: 1.75rem;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid var(--error);
    border-radius: var(--radius);
    color: var(--error-dark);
}

.btn-retry {
    margin-top: 0.85rem;
    background: var(--grad-accent);
    color: var(--accent-text);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 700;
    font-family: var(--font-ui);
    box-shadow: var(--shadow-accent);
    transition: transform var(--transition);
}
.btn-retry:hover { transform: translateY(-2px); }

/* --- Player controls --- */
.player-controls { margin-top: 1rem; }

.progress-container {
    margin-bottom: 1.5rem;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    padding: 0.5rem 0;
}

.progress-bar {
    position: relative;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: visible;
}

.progress-fill {
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    background: var(--grad-primary);
    border-radius: 4px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.1s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: var(--surface);
    border: 3px solid var(--primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(37,99,235,0.4);
}

.progress-container:hover .progress-thumb {
    width: 20px;
    height: 20px;
}

.progress-times {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    position: relative;
}

.btn-play {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--grad-accent);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-accent);
    flex-shrink: 0;
}
.btn-play:hover { transform: scale(1.06); box-shadow: 0 12px 32px rgba(251,191,36,0.45); }
.btn-play:active { transform: scale(0.97); }
.btn-play svg { width: 30px; height: 30px; }

.btn-speed {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    min-width: 48px;
    text-align: center;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-speed:hover { background: #eff6ff; color: var(--primary); border-color: var(--primary-light); }

.btn-next-ch {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-next-ch svg { width: 22px; height: 22px; }
.btn-next-ch:hover { background: #eff6ff; color: var(--primary); border-color: var(--primary-light); }

/* Speed panel */
.speed-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    z-index: 10;
    box-shadow: var(--shadow);
    min-width: 84px;
}

.speed-option {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    text-align: center;
    transition: background var(--transition), color var(--transition);
}
.speed-option:hover { background: #eff6ff; color: var(--primary); }
.speed-option--active { color: #fff; background: var(--grad-primary); }

/* Next chapter CTA */
.next-chapter-cta {
    margin-top: 2rem;
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(59,130,246,0.10) 0%, rgba(30,64,175,0.05) 100%);
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: var(--radius);
    animation: fadein 0.4s ease;
}

@keyframes fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cta-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.7rem;
}

.btn-continue {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--grad-accent);
    color: var(--accent-text);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-accent);
    transition: transform var(--transition);
}
.btn-continue:hover { transform: translateY(-2px); color: var(--accent-text); }
.btn-continue svg { width: 18px; height: 18px; }

/* ============================================================
   VERSES PANEL
   ============================================================ */
.verses-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

@media (min-width: 768px) {
    .verses-panel {
        position: sticky;
        top: calc(64px + 1rem);
        max-height: calc(100vh - 120px);
    }
}

.verses-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.95rem 1.2rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.verses-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    scroll-behavior: smooth;
    padding: 0.4rem 0;
}

/* Scrollbar del panel de versículos */
.verses-list::-webkit-scrollbar { width: 6px; }
.verses-list::-webkit-scrollbar-track { background: transparent; }
.verses-list::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.25); border-radius: 3px; }
.verses-list::-webkit-scrollbar-thumb:hover { background: rgba(59,130,246,0.5); }

.verse-item {
    display: flex;
    gap: 0.7rem;
    padding: 0.7rem 1.2rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    border-left: 4px solid transparent;
    align-items: flex-start;
}

.verse-item:hover {
    background: var(--surface-2);
}

.verse-item.active {
    background: var(--highlight);
    border-left-color: var(--highlight-border);
}

.verse-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 22px;
    padding-top: 0.25rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.verse-item.active .verse-num { color: var(--accent); }

.verse-text {
    font-family: var(--font-text);
    font-size: 1.0625rem;     /* 17px — más cuerpo para lectura cómoda */
    line-height: 1.7;
    font-weight: 500;          /* medium: legible sin verse en negrita */
    color: var(--text-strong);
    letter-spacing: 0.003em;
}

.verse-item.active .verse-text { color: var(--text-strong); font-weight: 600; }
.verse-item--empty { color: var(--text-dim); font-style: italic; font-size: 0.9rem; }

/* ============================================================
   ERROR BANNER
   ============================================================ */
.error-banner {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid var(--error);
    border-radius: var(--radius);
    padding: 0.95rem 1.2rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--error-dark);
    grid-column: 1 / -1;
}
.error-link {
    color: var(--primary-dark);
    margin-left: 0.75rem;
    font-weight: 700;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .progress-fill, .progress-thumb { transition: none; }
}
