/* Bíblia Online Plugin - Estilos */

.bible-container {
    font-family: 'Georgia', serif;
    background: #fff9f2;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin: 20px 0;
    position: relative; /* para posicionar a logo */
}

.bible-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px; /* aproxima conteúdo seguinte (Reflexão do Dia) do título */
}

.bible-header h2 {
    color: #8b4513;
    margin: 10px 0 0 0;
    font-size: 30px;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Logo no topo esquerdo em container circular */
.logo-circle {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #e6d6bf;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-divider {
    width: 140px;
    height: 3px;
    background: #e67e22;
    border-radius: 3px;
}

.bible-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bible-controls select {
    padding: 8px 12px;
    border: 2px solid #d4c5a9;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #5d4037;
}

.control-label {
    align-self: center;
    color: #6d4c41;
    font-weight: 600;
}

/* Linha Livro + Capítulo + Buscar */
.bc-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
}
.control-group { display: flex; flex-direction: column; gap: 4px; }
.book-group select { min-width: 200px; }
.chapter-group select { min-width: 90px; }
.translation-group { display: flex; flex-direction: column; gap: 4px; }

.btn-primary {
    background: #e67e22;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s ease, transform 0.05s ease;
}
.btn-primary:hover { background: #d35400; }
.btn-primary:active { transform: translateY(1px); }

.bible-controls select:focus {
    outline: none;
    border-color: #8b4513;
    box-shadow: 0 0 5px rgba(139, 69, 19, 0.3);
}

.bible-content {
    min-height: 400px;
    line-height: 1.8;
    font-size: 16px;
    color: #2c1810;
}

/* Abas: Leitura / Estudo */
.tabs {
    display: flex;
    gap: 8px;
    margin: 8px 0 16px;
}
.tab-btn {
    background: #f4e7d6;
    color: #6d4c41;
    border: 1px solid #e6d6bf;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.tab-btn.active {
    background: #e67e22;
    color: #fff;
    border-color: #e67e22;
}
.tab-content { animation: fadeIn .25s ease; }

/* Estudo */
#tab-study {
    background: transparent; /* sem caixa */
    border: none;            /* sem borda para sensação de página fluida */
    padding: 0;
    position: relative;      /* contexto de empilhamento para botões */
    z-index: 1;
}
.study-section { margin-bottom: 20px; }
.study-section h3 {
    margin: 0 0 8px 0;
    color: #8b4513;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}
.study-section textarea {
    width: 100%;
    padding: 0;               /* aparência de texto corrido */
    border: none;             /* remove caixas */
    border-radius: 0;
    min-height: 64px;
    font-size: 15px;
    line-height: 1.8;
    background: transparent;
    overflow: hidden;         /* sem scrollbar interna */
    resize: none;             /* crescimento automático via JS */
    white-space: pre-wrap;    /* preserva quebras e bullets */
    box-sizing: border-box;   /* evita overflow horizontal */
    max-width: 100%;
    word-break: break-word;   /* quebra palavras longas */
    overflow-wrap: anywhere;  /* garante quebra em telas estreitas */
}
.study-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.study-hint {
    margin: 6px 0 8px;
    color: #666;
    font-size: 13px;
}
.study-status {
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Spinner para geração de estudo */
.study-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #e67e22;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.study-section textarea:focus {
    outline: none;            /* mantém visual limpo ao focar */
    box-shadow: none;
}
.study-actions { display: flex; justify-content: flex-end; position: relative; z-index: 2; }

/* Garantir que o botão esteja clicável acima de outras camadas */
#study-generate { position: relative; z-index: 3; }

/* Ocultar FABs na aba Estudo */
body.study-active .fab-wrap { display: none; }

/* Responsividade Mobile */
@media (max-width: 768px) {
    .bible-container {
        padding: 10px;
        margin: 0;
    }
    .logo-circle {
        top: 8px;
        left: 8px;
        width: 44px;
        height: 44px;
        border-width: 1px;
    }
    
    .bible-controls {
        flex-direction: column;
        gap: 8px;
    }
    /* Linha Livro + Capítulo no mobile: grid 3 colunas (Livro | Capítulo | Buscar) */
    .bc-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: end; }
    .translation-group select { width: 100%; }
    .book-group select { width: 100%; }
    /* Capítulo terá no máx. 3 dígitos */
    .chapter-group select { width: 88px; }
    .bc-row .btn-primary { width: auto; padding: 10px 14px; }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .study-section {
        margin-bottom: 16px;
    }
    
    .study-section h3 {
        font-size: 14px;
        padding-bottom: 4px;
    }
    
    .study-section textarea {
        font-size: 14px;
        line-height: 1.6;
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    
    .verse {
        padding: 8px;
        margin-bottom: 4px;
    }
    
    .verse-number {
        font-size: 12px;
        min-width: 20px;
    }
    
    .verse-text {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .fab-wrap {
        bottom: 20px;
        right: 15px;
    }
    
    .bible-fab {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #8b4513;
}

.welcome-message h3 {
    font-size: 28px;
    margin-bottom: 15px;
}

.verse {
    margin: 6px 0;
    padding: 6px 4px 10px 10px;
    background: transparent;
    border-radius: 0;
    border-left: 3px solid #e67e22;
    border-bottom: 1px solid #f0e0cf;
    position: relative;
}

.verse-number {
    font-weight: bold;
    color: #8b4513;
    margin-right: 8px;
    font-size: 14px;
    vertical-align: super;
}

.verse-text {
    display: inline;
    font-size: 16px;
    line-height: 1.7;
}

/* interação de seleção por linha */
.verse { cursor: pointer; }
.verse:hover { background: #fff7ef; }

/* Ações por versículo */
.verse-actions { margin-top: 6px; display: flex; gap: 8px; }
.va-btn {
    background: #f7ede2;
    color: #6d4c41;
    border: 1px solid #f0e0cf;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}
.va-btn:hover { background: #f3e2d1; }
.verse.marked { background: #fff4e6; border-left-color: #d35400; }

.ai-analysis-btn, .pdf-download-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.pdf-download-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: none; /* Oculto até análise ser gerada */
}

.ai-analysis-btn {
    float: right;
}

.ai-analysis-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ai-analysis {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 20px;
    margin: 15px 0;
    border-left: 5px solid #667eea;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    display: none;
}

.ai-analysis h4 {
    color: #667eea;
    margin: 0 0 15px 0;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.ai-analysis-content {
    line-height: 1.8;
    color: #2c3e50;
}

.daily-reflection {
    margin-top: 8px; /* aproximar do título */
}

.daily-reflection-header {
    text-align: center;
    color: #8b4513;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}

.daily-verse-card {
    background: #ffffff;
    border: 1px solid #f0e0cf;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.daily-reflection h3 {
    color: #2d3436;
    margin: 0 0 15px 0;
}

.daily-verse-widget {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 20px 0;
    text-align: center;
}

.daily-verse-text {
    font-style: italic;
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 10px;
    line-height: 1.6;
}

.daily-verse-reference {
    font-weight: bold;
    color: #8b4513;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #c62828;
    margin: 15px 0;
}

/* Toast simples */
.toast-msg {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 9999;
    font-size: 13px;
    pointer-events: none; /* não bloquear cliques no conteúdo abaixo */
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Botões flutuantes (FAB) */
.fab-wrap {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10000;
}
.bible-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #e67e22;
    color: #fff;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform .08s ease, background .2s ease;
}
.bible-fab:hover { background: #d35400; }
.bible-fab:active { transform: translateY(1px) scale(0.98); }

.success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2e7d32;
    margin: 15px 0;
}

/* Responsividade */
@media (max-width: 768px) {
    .bible-header { gap: 10px; }
    
    .bible-controls {
        justify-content: center;
    }
    
    .bible-controls select {
        min-width: 120px;
    }
    
    .verse {
        padding: 12px;
    }
    
    /* limpeza de estilos antigos removidos */
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.verse { animation: fadeIn 0.4s ease-out; }

/* estilos de IA removidos */

/* Book grid (opcional, futuro) */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin: 10px 0 20px; }
.book-grid .book-btn { padding: 8px 10px; border: 1px solid #f0e0cf; border-radius: 8px; background: #fff; color: #6d4c41; cursor: pointer; }
.book-grid .book-btn.active { background: #e67e22; color: #fff; border-color: #e67e22; }

/* Tema escuro (opcional) */
.bible-container.dark-theme {
    background: #2c3e50;
    color: #ecf0f1;
}

.bible-container.dark-theme .verse {
    background: rgba(52, 73, 94, 0.7);
    color: #ecf0f1;
}

.bible-container.dark-theme .bible-header h2 {
    color: #f39c12;
}

/* Desktop: compactar espaçamentos em telas largas */
@media (min-width: 992px) {
    .bible-container {
        padding: 20px;
        margin: 12px 0;
    }

    .tabs {
        margin: 6px 0 10px;
        gap: 6px;
    }

    .bible-content {
        line-height: 1.65; /* menos altura de linha no desktop */
    }

    .study-section {
        margin-bottom: 14px; /* reduzir espaço entre blocos de estudo */
    }
    .study-section h3 {
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    .study-section textarea {
        line-height: 1.65; /* texto mais compacto */
        min-height: 56px;
    }

    .verse {
        margin: 4px 0;                 /* reduzir espaçamento vertical */
        padding: 4px 4px 8px 10px;     /* pad menor mantendo barra lateral */
    }
    .verse-text {
        line-height: 1.6;
    }

    .daily-verse-widget {
        margin: 12px 0;
        padding: 16px;
    }

    .ai-analysis {
        margin: 12px 0;
        padding: 16px;
    }
}
