/* ============================================================
   IAM Biblia — estilos
   ============================================================ */

:root {
    --color-bg: #0a1929;
    --color-surface: #122237;
    --color-surface-2: #1a2e47;
    --color-primary: #3b82f6;
    --color-primary-hover: #8b5cf6;
    --color-accent: #f59e0b;
    --color-text: #f1f5f9;
    --color-text-dim: #94a3b8;
    --color-border: #2c3e50;
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-primary-hot: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* ====================== Header ====================== */

.bib-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 10;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.bib-back {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.5rem 0.95rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bib-back:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.bib-logo {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: contain;
}

.bib-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-right: auto;
}

.bib-version {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-dim);
    font-size: 0.95rem;
}

.bib-version select,
.bib-pickers select {
    background: var(--color-surface-2);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.bib-version select:focus,
.bib-pickers select:focus,
#bib-query:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* ====================== Main / Search ====================== */

.bib-main {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.bib-search {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    flex-shrink: 0;
}

.bib-search-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.7rem;
    flex-wrap: wrap;
}

.bib-search-row:last-child { margin-bottom: 0; }

#bib-query {
    flex: 1 1 280px;
    background: var(--color-surface-2);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
}

#bib-query::placeholder { color: var(--color-text-dim); }

.bib-btn-primary,
.bib-btn-secondary {
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.4rem;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.bib-btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.40);
}

.bib-btn-primary:hover {
    background: var(--gradient-primary-hot);
    transform: translateY(-2px);
}

.bib-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.bib-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
}

/* Botón de micrófono */
.bib-btn-mic {
    border: none;
    border-radius: 999px;
    width: 48px;
    height: 48px;
    padding: 0;
    cursor: pointer;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: white;
    font-size: 1.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.40);
    transition: all 0.2s;
    flex-shrink: 0;
}

.bib-btn-mic:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 22px rgba(16, 185, 129, 0.55);
}

.bib-btn-mic:disabled {
    background: rgba(255, 255, 255, 0.10);
    color: var(--color-text-dim);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.bib-btn-mic.bib-listening {
    background: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65);
    animation: bib-pulse 1.2s ease-out infinite;
}

@keyframes bib-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
    70%  { box-shadow: 0 0 0 18px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.bib-pickers select { flex: 1 1 140px; }

.bib-status {
    margin-top: 0.6rem;
    color: var(--color-text-dim);
    font-size: 0.9rem;
    min-height: 1.2rem;
}

.bib-status.bib-error { color: #f87171; }

/* ====================== Results ====================== */

.bib-results {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #8b5cf6 rgba(255, 255, 255, 0.05);
}

/* Barra de scroll visible (WebKit: Chrome, Edge, Safari, Brave) */
.bib-results::-webkit-scrollbar {
    width: 14px;
}

.bib-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    margin: 4px 0;
}

.bib-results::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 10px;
    border: 3px solid var(--color-bg);
    min-height: 40px;
}

.bib-results::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #f59e0b 0%, #ec4899 100%);
}

.bib-result-group {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.2rem;
}

.bib-result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.bib-result-title .bib-copy-all {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--color-text);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}

.bib-result-title .bib-copy-all:hover {
    background: rgba(255, 255, 255, 0.16);
}

.bib-verse {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0;
    line-height: 1.55;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.bib-verse:last-child { border-bottom: none; }

.bib-verse-num {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 1.8rem;
    text-align: right;
    padding-top: 0.15rem;
}

.bib-verse-text {
    flex: 1;
    color: var(--color-text);
}

.bib-verse-match { background: rgba(245, 158, 11, 0.22); padding: 0 2px; border-radius: 3px; }

.bib-verse-copy {
    background: transparent;
    border: none;
    color: var(--color-text-dim);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    font-size: 0.95rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.bib-verse:hover .bib-verse-copy { opacity: 1; }
.bib-verse-copy:hover { color: var(--color-accent); }

.bib-empty {
    text-align: center;
    color: var(--color-text-dim);
    padding: 2rem;
    font-style: italic;
}

/* ====================== Toast ====================== */

.bib-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--color-primary);
    color: var(--color-text);
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    box-shadow: var(--shadow-float);
    z-index: 100;
    animation: bib-toast-in 0.2s ease-out;
}

@keyframes bib-toast-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ====================== Móvil ====================== */

@media (max-width: 600px) {
    .bib-header { padding: 0.7rem 0.9rem; gap: 0.6rem; }
    .bib-header h1 { font-size: 1.15rem; }
    .bib-version label { display: none; }
    .bib-main { padding: 0.9rem; }
    .bib-search { padding: 0.9rem; border-radius: 12px; }
    .bib-verse-copy { opacity: 1; }
    .bib-btn-primary, .bib-btn-secondary { padding: 0.65rem 1rem; }
}
