/* ==============================
   Bible App Refatorado - CSS
   ============================== */

/* --------- Container Geral --------- */
.bible-app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --------- Header e Controles --------- */
.bible-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 8px 12px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
}

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

.bible-controls select {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.bible-controls select:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bible-search {
    display: flex;
    gap: 10px;
    align-items: center;
}

#bible-search-input {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    width: 250px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    transition: all 0.3s ease;
}

#bible-search-input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

#bible-search-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#bible-search-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

/* --------- Área de Conteúdo --------- */
.bible-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#bible-text-container {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    background: white;
    position: relative;
}

/* --------- Estados de Carregamento e Erros --------- */
.loading, .no-data, .no-verses, .error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #6c757d;
    font-size: 16px;
    text-align: center;
}

.loading:after {
    content: "";
    width: 20px;
    height: 20px;
    margin-top: 15px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.error {
    color: #dc3545;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --------- Versículos --------- */
.bible-chapter-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 15px;
}

.bible-verse {
    margin-bottom: 5px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.bible-verse:hover {
    background: #f8f9fa;
    transform: translateX(5px);
    box-shadow: -3px 0 0 #667eea;
}

.bible-verse-number {
    font-weight: 700;
    color: #667eea;
    margin-right: 8px;
    font-size: 14px;
    display: inline-block;
    min-width: 25px;
}

.bible-verse-text {
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
    display: inline;
}

/* --------- Destaque de busca --------- */
.bible-verse.search-highlight {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.2), rgba(102, 126, 234, 0.1));
    border: 2px solid #667eea;
    border-radius: 8px;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: pulseHighlight 2s ease-in-out;
}

@keyframes pulseHighlight {
    0% { background: rgba(102, 126, 234, 0.3); transform: scale(1.02); }
    50% { background: rgba(102, 126, 234, 0.15); transform: scale(1.01); }
    100% { background: rgba(102, 126, 234, 0.2); transform: scale(1.02); }
}

/* --------- Resultados de Busca --------- */
.search-results-header {
    padding: 20px 0;
    border-bottom: 2px solid #ecf0f1;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.search-results-header h3 {
    margin: 0;
    color: #2c3e50;
}

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-radius: 6px;
    margin-bottom: 10px;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-reference {
    font-weight: 600;
    color: #667eea;
    font-size: 13px;
    margin-bottom: 5px;
}

.search-result-text {
    font-size: 14px;
    line-height: 1.4;
    color: #495057;
}

.search-result-text mark {
    background: #ffeb3b;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* --------- Modal e Compartilhamento --------- */
.bible-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalSlideIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 15px;
    transition: color 0.3s ease;
}

.modal-close:hover { color: #000; }

#modal-verse-reference {
    color: #667eea;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

#modal-verse-text {
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* --------- Verse Card (Compartilhamento) --------- */
.verse-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 35px 25px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    min-height: 500px;
    max-height: 600px;
    text-align: center;
    position: relative;
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    aspect-ratio: 4/5;
}

.verse-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.2;
    border-radius: 18px;
}

.verse-card .verse-reference {
    font-size: clamp(18px, 5vw, 24px);
    font-weight: 800;
    margin-bottom: 20px;
    z-index: 1;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5),0 0 15px rgba(255,255,255,0.1);
    letter-spacing: 1px;
    opacity: 0.95;
}

.verse-card .verse-text {
    font-size: clamp(16px, 4vw, 28px);
    line-height: 1.35;
    font-style: italic;
    font-weight: 500;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.4),0 0 12px rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 15px 0;
    max-width: 100%;
    word-wrap: break-word;
    hyphens: auto;
    z-index: 1;
}

.verse-card .verse-footer {
    font-size: clamp(12px, 3vw, 16px);
    opacity: 0.9;
    border-top: 1px solid rgba(255,255,255,0.4);
    padding-top: 15px;
    margin-top: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
    z-index: 1;
}

/* --------- Botões de Compartilhamento --------- */
.share-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
}

.share-btn {
    padding: 14px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
}

.share-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.share-btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; font-weight: 700; font-size: 16px; grid-column: 1/-1; padding: 18px; box-shadow: 0 4px 15px rgba(102,126,234,0.4); }
.share-btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(102,126,234,0.6); }

.share-btn-secondary { background: #6c757d; color: white; }
.share-btn-secondary:hover:not(:disabled) { background: #5a6268; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,117,125,0.4); }

.share-btn-whatsapp { background: #25d366; color: white; }
.share-btn-whatsapp:hover:not(:disabled) { background: #1fa851; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,211,102,0.4); }

.share-btn-copy { background: #17a2b8; color: white; }
.share-btn-copy:hover:not(:disabled) { background: #138496; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(23,162,184,0.4); }

/* --------- Mensagens --------- */
.bible-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10001;
    animation: slideInRight 0.3s ease;
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.bible-message.message-success { background: #28a745; }
.bible-message.message-error { background: #dc3545; }
.bible-message.message-warning { background: #ffc107; color: #212529; }
.bible-message.message-info { background: #17a2b8; }

.message-close { cursor: pointer; font-size: 18px; font-weight: bold; opacity: 0.8; padding: 0 5px; }
.message-close:hover { opacity: 1; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --------- Responsividade --------- */
@media (max-width: 768px) {
    .bible-header { flex-direction: column; align-items: stretch; gap: 15px; }
    .bible-controls, .bible-search { justify-content: center; }
    #bible-search-input { width: 100%; max-width: 300px; }
    .bible-content { flex-direction: column; }
    .verse-card { max-width: 90%; width: auto; }
}

@media (max-width: 480px) {
    #bible-text-container { padding: 15px; }
    .bible-verse-text { font-size: 15px; }
    .bible-chapter-title { font-size: 20px; }
    .verse-card { padding: 30px 20px; min-height: 420px; }
    .verse-card .verse-reference { font-size: 16px; margin-bottom: 18px; }
    .verse-card .verse-text { font-size: 18px; line-height: 1.3; }
    .share-actions { grid-template-columns: 1fr; gap: 10px; }
    .share-btn { padding: 16px 18px; font-size: 15px; }
}

/* --------- Impressão --------- */
@media print {
    .bible-header, .modal-actions, .bible-message { display: none !important; }
    .bible-app-container { border: none; box-shadow: none; }
    #bible-text-container { padding: 0; }
    .bible-verse:hover { transform: none; box-shadow: none; }
}