/* BAI Integrations — extends the existing Bíblia Alpha theme */

/* Translation selector in toolbar */
.bai-translation-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface, #1a1a2e);
    color: var(--text, #e0e0e0);
    border: 1px solid var(--border, #2a2a4a);
    border-radius: 6px;
    padding: 4px 28px 4px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color .15s;
}
.bai-translation-select:hover,
.bai-translation-select:focus {
    border-color: var(--accent, #7c5cfc);
}

/* Commentary button in toolbar */
.bai-commentary-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid var(--border, #2a2a4a);
    color: var(--text-secondary, #8888aa);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}
.bai-commentary-btn:hover {
    border-color: var(--accent, #7c5cfc);
    color: var(--accent, #7c5cfc);
}
.bai-commentary-btn.active {
    background: var(--accent, #7c5cfc);
    color: #fff;
    border-color: var(--accent, #7c5cfc);
}
.bai-commentary-btn svg { flex-shrink: 0; }

/* Commentary panel — slides from bottom of reader */
.bai-commentary-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    background: var(--bg, #0f0f1a);
    border-top: 1px solid var(--border, #2a2a4a);
    z-index: 100;
    overflow-y: auto;
    transition: transform .3s ease;
    padding: 0;
}
.bai-commentary-panel.visible { display: block !important; }

.bai-commentary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border, #2a2a4a);
    position: sticky;
    top: 0;
    background: var(--bg, #0f0f1a);
    z-index: 1;
}
.bai-commentary-header h3 {
    margin: 0;
    font-size: 14px;
    color: var(--text, #e0e0e0);
    font-weight: 600;
}
.bai-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #8888aa);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}
.bai-close-btn:hover { color: var(--text, #e0e0e0); }

.bai-commentary-content {
    padding: 16px 20px 24px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary, #b0b0cc);
}
.bai-commentary-content p { margin: 0 0 12px; }
.bai-commentary-content h4 {
    color: var(--text, #e0e0e0);
    font-size: 14px;
    margin: 16px 0 8px;
    font-weight: 600;
}
.bai-placeholder {
    color: var(--text-secondary, #666);
    font-style: italic;
}

/* Commentary select in header */
.bai-commentary-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface, #1a1a2e);
    color: var(--text, #e0e0e0);
    border: 1px solid var(--border, #2a2a4a);
    border-radius: 4px;
    padding: 2px 24px 2px 8px;
    font-size: 12px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

/* Translation badge on reader title */
.bai-trans-badge {
    display: inline-block;
    background: var(--accent, #7c5cfc);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

/* Loading spinner */
.bai-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary, #666);
}
.bai-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border, #333);
    border-top-color: var(--accent, #7c5cfc);
    border-radius: 50%;
    animation: bai-spin .6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes bai-spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (min-width: 900px) {
    .bai-commentary-panel {
        left: auto;
        right: 0;
        top: 48px;
        bottom: 0;
        width: 380px;
        max-height: none;
        border-top: none;
        border-left: 1px solid var(--border, #2a2a4a);
    }
}


/* Commentary source selector */
.bai-commentary-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bai-comm-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--surface, #1a1a2e);
    color: var(--text, #e0e0e0);
    border: 1px solid var(--border, #2a2a4a);
    border-radius: 4px;
    padding: 3px 26px 3px 8px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: border-color .15s;
    max-width: 180px;
}
.bai-comm-select:hover,
.bai-comm-select:focus {
    border-color: var(--accent, #7c5cfc);
}

/* Author attribution card */
.bai-commentary-author {
    padding: 0 20px;
}
.bai-author-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    margin: 12px 0 4px;
    background: var(--surface, #1a1a2e);
    border: 1px solid var(--border, #2a2a4a);
    border-radius: 8px;
    border-left: 3px solid var(--accent, #7c5cfc);
}
.bai-author-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--accent, #7c5cfc);
}
.bai-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bai-author-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #e0e0e0);
}
.bai-author-desc {
    font-size: 11px;
    color: var(--text-secondary, #8888aa);
    line-height: 1.4;
}
.bai-author-loading {
    font-size: 12px;
    color: var(--text-secondary, #666);
    font-style: italic;
    padding: 8px 0;
    display: block;
}
