/* ==========================================================================
   1. CONFIGURACIÓN GENERAL (BODY & RESET)
   ========================================================================== */
body {
    margin: 0; 
    padding: 0;
    padding-top: 60px; /* Espacio para el header fijo */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f0f0f0; /* Color de fondo suave por defecto */
}

/* ==========================================================================
   2. HEADER (Cabecera Fija)
   ========================================================================== */
.app-header {
    background-color: #2c455bdd;
    color: white;
    padding: 15px 20px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    
    /* Centrar contenido */
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-header h1 {
    margin: 0;
    padding: 0;
    border: none;
    
    /* Tipografía */
    font-family: 'Cinzel', serif; 
    font-size: 1.6rem; 
    letter-spacing: 1px;
    font-weight: 700;
}

/* Selector de Idioma */
#lang-selector {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 5px 8px;
    
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    transition: background 0.3s;
}

#lang-selector:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

#lang-selector option {
    color: #333; /* Color oscuro para las opciones desplegadas */
    background: white;
}

@media (max-width: 400px) {
    #lang-selector {
        right: 10px;
        padding: 4px 6px;
        font-size: 0.75rem;
    }
}

/* Estilo especial para la letra 'e' */
.brand-prefix {
    text-transform: lowercase;
    font-weight: 400;
    opacity: 0.8;
    font-family: sans-serif;
    font-style: italic;
    margin-right: 2px;
}

/* ==========================================================================
   3. CONTENEDOR PRINCIPAL (Hoja de Papel)
   ========================================================================== */
.paper-sheet {
    background-color: white;
    max-width: 21cm; /* Mantenemos tu ancho A4 */
    margin: 0 auto; 
    padding: 2.5cm;
    padding-top: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-height: 100vh;
}

/* Títulos dentro de la hoja */
h1#doc-title {
    text-align: center; 
    font-size: 26px; 
    text-transform: uppercase;
    border-bottom: 2px solid #4f4f4f; 
    padding-bottom: 15px; 
    margin-bottom: 40px;
    margin-top: 1.5cm; /* Espacio superior visual */
}

h3 {
    margin-top: 20px; 
    font-size: 19px; 
    color: #222;
    border-bottom: 1px solid #ddd; 
    margin-bottom: 20px; 
    padding-bottom: 5px;
}

/* ==========================================================================
   4. ESTILOS DE LITURGIA (Texto y Rezos)
   ========================================================================== */
/* Parte del Guía: NEGRITA */
.t-bold {
    font-weight: bold;
    color: #4f4f4f;
    display: block;
    margin-bottom: 5px;
}

/* Respuesta del Pueblo: NORMAL con sangría */
.t-normal {
    font-weight: normal;
    color: #4f4f4f;
    display: block;
    margin-bottom: 15px;
    margin-left: 20px; 
}

/* Rúbricas (Instrucciones en rojo/gris) */
.rubric {
    background-color: #f9f9f9; 
    padding: 8px 15px;
    border-left: 3px solid #666; 
    margin: 15px 0;
    font-family: sans-serif; 
    font-size: 0.85em;
    color: #444;
    font-weight: bold;
}

/* Letanías */
.litany-section {
    text-align: center;
    padding: 20px;
}

.lit-group { 
    margin-bottom: 25px; 
}

.lit-line { 
    display: block; 
    margin: 5px 0; 
    font-size: 1.05em; 
    color: #4f4f4f;
}

.resp-teal { 
    color: #00796b; 
    font-weight: bold; 
}

/* Oración Final */
.final-prayer-box {
    margin-top: 20px;
    text-align: center;
    border-top: 2px solid #eee;
}

/* ==========================================================================
   5. FOOTER
   ========================================================================== */
.app-footer {
    background-color: #333;
    color: #ccc;
    text-align: center;
    padding: 20px;
    margin-top: auto; 
    font-size: 0.9rem;
}

.footer-actions {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-footer {
    background: rgba(255,255,255,0.1);
    border: 1px solid #555;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.3s;
    cursor: pointer;
}

.btn-footer:hover { 
    background: rgba(255,255,255,0.2); 
}

/* ==========================================================================
   6. MODAL (Ventana Legal)
   ========================================================================== */
.modal-overlay {
    display: none; /* Se controla con JS */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    color: #333;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative; /* Para posicionar la X */
}

.modal-close {
    float: right;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.back-btn {
    display: inline-block; 
    margin-top: 15px; 
    text-decoration: none;
    color: #666; 
    font-family: sans-serif; font-size: 14px;
    border: 1px solid #ccc; padding: 6px 12px;
    border-radius: 4px; background: #fff;
    cursor: pointer;
}
.back-btn:hover { background: #eee; color: #000; }

/* ==========================================================================
   7. BOTÓN DE INSTALACIÓN (PWA)
   ========================================================================== */
#install-btn {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 999;
    
    display: flex;
    align-items: center;
    gap: 8px;
    
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    
    background: linear-gradient(135deg, #2c455b, #1f3344);
    color: #fff;
    
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    
    /* Animación de entrada */
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease, box-shadow 0.25s ease;
}

#install-btn.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#install-btn:hover {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

#install-btn:active {
    transform: scale(0.96);
}

#install-btn svg {
    width: 20px; height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ==========================================================================
   8. UTILIDADES Y CLASES AUXILIARES (Para reemplazar JS inline styles)
   ========================================================================== */
/* Estas clases permiten que el HTML optimizado use tus estilos originales */

.text-center { text-align: center; }
.text-bold { font-weight: bold; }
.text-uppercase { text-transform: uppercase; }
.italic { font-style: italic; }

/* Márgenes estándar que usabas en el JS */
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.mb-50 { margin-bottom: 50px; }

/* Bordes que usabas en el JS */
.border-top { 
    border-top: 1px solid #ccc; 
    padding-top: 20px; 
}
.border-dashed { 
    border-top: 1px dashed #ccc; 
    padding-top: 10px; 
    margin-top: 30px; 
}

/* Modal Headers */
.legal-header { 
    border-bottom: 2px solid #004e92; 
    padding-bottom: 10px; 
    margin-bottom: 15px; 
}
.legal-section-title { 
    margin-bottom: 5px; 
    color: #333; 
}
.legal-text { 
    font-size: 0.9em; 
    margin-bottom: 15px; 
}
.modal-footer { 
    text-align: center; 
    margin-top: 20px; 
    padding-top: 10px; 
    border-top: 1px solid #eee; 
}
.protection-prayer { 
    width: 75%; 
    margin: 20px auto; 
    font-weight: bold;
}

.prayer{
    display: block;
    font-style: italic;
    margin-bottom: 10px;
    color: #3f3f3f;
    text-align: center;
    font-size: 17px;
    font-weight: bold;
}

.versicle-group{
    display: flex;
    align-items: center;
    flex-flow: column;
    justify-content: center;
    margin-top: 1cm;
}

/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */
@media (max-width: 600px) {
    .paper-sheet { 
        padding: 0 50px; 
        width: auto; 
        max-width: 100%;
    }
    body { 
        background: white; 
    }
    .back-btn { 
        margin-top: 10px; 
    }
    .protection-prayer {
        width: 100%; /* Ajuste para que no quede muy apretado en móvil */
    }
}