/* Animación de mecanografía para el párrafo del header */
.header-content p {
    color: #555;
    font-size: 1.15rem;
    font-style: italic;
    opacity: 0;
    transform: translateY(10px);

    /* FIX RESPONSIVE */
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;

    /* Animación segura */
    animation: slideInFade 0.8s ease-out forwards;
}


@keyframes slideInFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* En móviles, simplificamos para evitar problemas de ancho */
@media (max-width: 768px) {
    .header-content p {
        white-space: normal;
        width: auto;
        border-right: none;
        opacity: 0;
        animation: slideInFade 1s forwards 0.2s; /* Solo aparece suavemente */
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f8ff;
    color: #333;
    position: relative;
    padding-top: 0; /* Asegura que no haya padding extra arriba */
}

/* ======== MARCA DE AGUA ======== */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../imagenes/logofamilia.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 60%;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

/* Todo el contenido debe estar por encima de la marca de agua */
header,
section,
footer,
.whatsapp-float {
    position: relative;
    z-index: 1;
}

/* ======== HEADER ======== */
header {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 500;
}

.header-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo-aa-left {
    flex-shrink: 0;
}

.logo-aa-left img {
    width: 140px;
    height: auto;
    animation: floatLogo 6s ease-in-out infinite; /* Animación flotante */
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0px); filter: drop-shadow(0 5px 15px rgba(30,144,255,0.2)); }
    50% { transform: translateY(-10px); filter: drop-shadow(0 15px 25px rgba(30,144,255,0.4)); }
}

.header-content {
    flex: 1;
    text-align: center;
}

.header-content h1 {
    color: #1e90ff;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

/* Botones genéricos Login - CONTRASTE MEJORADO */
.btn-login {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
    display: inline-block;
    font-size: 0.95rem;
    text-align: center;
    background-size: 200% auto;
    /* A11Y Touch Target */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-login:focus-visible {
    outline: 3px solid #0056b3;
    outline-offset: 2px;
}

.btn-login:hover {
    background-position: right center;
    transform: translateY(-2px);
}

.btn-admin {
    background-image: linear-gradient(to right, #556cd6 0%, #6d4298 51%, #556cd6 100%); /* Oscurecido para contraste */
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-admin:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-libros {
    background-image: linear-gradient(to right, #d978e5 0%, #e04158 51%, #d978e5 100%); /* Oscurecido para contraste */
    color: white;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.btn-libros:hover {
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

.btn-panel {
    background-image: linear-gradient(to right, #0e867d 0%, #2ec467 51%, #0e867d 100%); /* Oscurecido para contraste */
    color: white;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.btn-panel:hover {
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.5);
}

/* ======== NAVEGACIÓN PEGAGOSA (NAV) ======== */
nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 2000; /* Alto para estar sobre el contenido */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center; /* Centrado en desktop */
    align-items: center;
    padding: 15px 20px;
    position: relative;
    /* Importante para el menú móvil */
    min-height: 70px; 
}

/* Lista de enlaces dentro del Nav */
.nav-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Estilos botones navegación - CONTRASTE Y A11Y */
nav button, .dropbtn {
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 25px;
    /* Gradiente azul más oscuro para contraste con texto blanco */
    background-image: linear-gradient(to right, #0072d6 0%, #0056b3 51%, #004494 100%);
    background-size: 200% auto;
    color: white;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 3px 10px rgba(30, 144, 255, 0.3);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: inline-flex; /* Flex para alineación */
    align-items: center;
    justify-content: center;
    min-height: 44px; /* A11Y Touch Target */
    gap: 8px; /* Espacio consistente icono-texto */
}

/* Foco visible */
nav button:focus-visible, .dropbtn:focus-visible {
    outline: 3px solid #000;
    outline-offset: 2px;
}

/* Efecto Shine en Hover */
nav button::after, .dropbtn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 120%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255,255,255,0.4),
        transparent
    );
    transform: skewX(-20deg);
    transition: 0.5s;
}

nav button:hover::after, .dropbtn:hover::after {
    left: 120%;
}

nav button:hover, .dropbtn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(30, 144, 255, 0.5);
    background-position: right center;
}

nav button.active, .dropdown.active .dropbtn {
    background-image: linear-gradient(to right, #004494 0%, #003366 51%, #004494 100%);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
    animation: buttonPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes buttonPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Content - Glassmorphism */
.dropdown-content {
    display: none;
    position: absolute;
    
    /* GLASS EFFECT (Cristal) */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15); /* Sombra suave para glass */
    border-radius: 15px;
    z-index: 2001; 
    top: 110%; 
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
    padding: 10px 0;
    animation: fadeInDropdown 0.3s ease;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.dropdown:hover .dropdown-content, 
.dropdown.active .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: #333;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    text-align: center;
    transition: background 0.2s;
    min-height: 44px; /* A11Y Touch Target */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.dropdown-content a:focus-visible {
    background-color: rgba(240, 248, 255, 0.6);
    outline: 2px solid #0056b3;
    outline-offset: -2px;
}

.dropdown-content a:hover {
    background-color: rgba(240, 248, 255, 0.8);
    color: #1e90ff;
}

/* === BOTÓN HAMBURGUESA (MÓVIL) === */
.menu-btn {
    width: 44px; /* A11Y touch target */
    height: 44px;
    display: none; /* Por defecto oculto en desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    z-index: 10005; /* Más alto que el overlay */
    
    /* Reset estilos */
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    background-image: none;
}

.menu-btn:focus-visible {
    outline: 2px solid #0056b3;
    border-radius: 4px;
}

.menu-btn:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

.menu-btn span {
    height: 3px;
    width: 30px;
    background: #1e90ff;
    border-radius: 4px;
    transition: 0.3s ease-in-out;
    transform-origin: center;
}

.menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); background: white; width: 30px; }
.menu-btn.active span:nth-child(2) { opacity: 0; width: 0; }
.menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); background: white; width: 30px; }

/* Acciones móviles (login) ocultas por defecto */
.mobile-actions {
    display: none;
}

/* OVERLAY MÓVIL (Fondo Oscuro) */
.menu-overlay {
    display: none; /* Oculto en escritorio */
}


/* ======== BOTÓN TEMA FLOTANTE ======== */
/* Se ajusta para que no moleste en el layout */
.theme-btn {
    font-size: 1.5rem;
    background: rgba(0,0,0,0.1);
    color: #333;
    border: none;
    padding: 0;
    width: 44px; /* A11Y touch */
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.theme-btn:focus-visible {
    outline: 3px solid #0056b3;
}
.theme-btn:hover { 
    background: rgba(0,0,0,0.2); 
    transform: scale(1.1);
}

/* ======== ESTILO ENUNCIADO (PREAMBLE CARD) ======== */
.preamble-card {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(30, 144, 255, 0.1);
    border-left: 6px solid #1e90ff; /* Acento lateral elegante */
    padding: 50px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.preamble-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(30, 144, 255, 0.15);
}

/* Comilla decorativa gigante de fondo */
.quote-decoration {
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 10rem;
    font-family: 'Georgia', serif; /* Fuente serif para la comilla */
    color: rgba(30, 144, 255, 0.08); /* Muy sutil */
    line-height: 1;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.preamble-text {
    position: relative;
    z-index: 1;
    font-size: 1.25rem; /* Letra más grande */
    line-height: 1.9;   /* Mejor interlineado */
    color: #444;
    text-align: center;
    font-weight: 500;
}

/* Highlight sutil para palabras clave si se desea */
.preamble-text strong {
    color: #1e90ff;
    font-weight: 700;
}

/* Ajustes Responsive para la carta */
@media (max-width: 768px) {
    .preamble-card {
        padding: 30px 20px;
    }
    .quote-decoration {
        font-size: 6rem;
        top: -10px;
        left: 10px;
    }
    .preamble-text {
        font-size: 1.1rem;
        text-align: left; /* En móvil se lee mejor alineado a la izquierda */
    }
}

/* Dark Mode para Preamble Card */
body.dark .preamble-card {
    background: linear-gradient(135deg, #161b22 0%, #0d1117 100%) !important;
    border-color: rgba(255,255,255,0.1);
    border-left-color: #1e90ff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

body.dark .quote-decoration {
    color: rgba(255, 255, 255, 0.05);
}

body.dark .preamble-text {
    color: #c9d1d9;
}
/* ======== SECCIONES ======== */
section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 20px;
    min-height: auto;
    position: relative;
    z-index: 1; 
}

section h2 {
    color: #1e90ff;
    font-size: 2.2rem;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    padding-bottom: 15px;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #00bfff, #1e90ff);
    border-radius: 2px;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
}

/* ======== PRINCIPIOS (Dinamismo y Movimiento) - GLASSMORPHISM ======== */
.principios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 50px;
    perspective: 1000px;
}

/* TARJETAS GLASS (Cristal) */
.principio-card {
    /* Fondo Glass (Semi-transparente) */
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    
    padding: 40px 30px;
    border-radius: 20px;
    /* Sombra más suave y colorida para glass */
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Color de borde inferior */
    border-bottom: 5px solid transparent;
    position: relative;
    overflow: hidden;
    z-index: 1;
    animation: slideUpFade 1s cubic-bezier(0.25, 0.8, 0.25, 1) backwards;
    /* Interactividad teclado */
    cursor: pointer;
}

.principio-card:focus-visible {
    outline: 4px solid #0056b3;
    transform: translateY(-5px);
}

/* Colores de borde */
.principio-card:nth-child(1) { border-bottom-color: #1e90ff; animation-delay: 0.2s; }
.principio-card:nth-child(2) { border-bottom-color: #ff5e57; animation-delay: 0.4s; }
.principio-card:nth-child(3) { border-bottom-color: #ffdd59; animation-delay: 0.6s; }

/* Brillo en hover */
.principio-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-25deg);
    transition: 0.5s;
    pointer-events: none;
}

.principio-card:hover {
    transform: translateY(-15px) scale(1.03);
    /* Sombra más intensa al flotar */
    box-shadow: 0 15px 40px 0 rgba(31, 38, 135, 0.2);
    background: rgba(255, 255, 255, 0.8);
}

.principio-card:hover::before {
    left: 150%;
}

/* --- ICONOGRAFÍA UNIFICADA (NUEVO) --- */
.icon-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    /* Fondo sutil tipo cristal */
    background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(240,248,255,0.6));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    font-size: 3rem; /* Tamaño estandarizado */
    border: 1px solid rgba(255,255,255,0.8);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

/* Efectos Hover heredados en el icono */
.principio-card:hover .icon-circle,
.contacto-item:hover .icon-circle {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px rgba(30,144,255,0.2);
    background: white;
    animation: floatingIcon 3s ease-in-out infinite; /* Reincorporamos la animación flotante */
}

/* Eliminamos las clases antiguas para usar la unificada */
.principio-icon, .contacto-icon {
    /* Mantenemos por si acaso, pero ya no se usan en HTML */
    display: inline-block;
}


.principio-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #333;
    transition: color 0.3s;
    text-shadow: 0 1px 1px rgba(255,255,255,0.5);
}

.principio-card:hover h3 {
    color: #1e90ff;
}

@keyframes slideUpFade {
    from { 
        opacity: 0; 
        transform: translateY(100px) scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes floatingIcon {
    0% { transform: scale(1.1) translateY(0); }
    50% { transform: scale(1.1) translateY(-5px); }
    100% { transform: scale(1.1) translateY(0); }
}

/* ===========================
   MODALES (Glassmorphism Splendid)
   =========================== */
.principio-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;

    /* CENTRADO REAL */
    display: none;
    justify-content: center;
    align-items: center;
}

/* Contenedor del Modal Glass */
.principio-modal-content {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;

    box-shadow: 0 20px 40px rgba(0,0,0,0.35);
    color: #fff;

    animation: modalFadeIn 0.3s ease-out;
}


@keyframes popUp {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Headers de Modales Semi-Transparentes */
.modal-header {
    padding: 25px;
    color: white;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.6rem;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.modal-body {
    padding: 30px;
    color: #333;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Estilo para la caja de cita en el modal Esperanza para que sea glass también */
.modal-body div[style*="background: #f9f9f9"] {
    background: rgba(255, 255, 255, 0.5) !important;
    border-left-color: rgba(210, 153, 34, 0.8) !important;
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.btn-cerrar-principio {
    display: block;
    width: 100%;
    padding: 15px;
    background: rgba(255,255,255,0.5); /* Semi-transparente */
    border: none;
    border-top: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    font-weight: bold;
    color: #555;
    font-size: 1rem;
    transition: all 0.2s;
    min-height: 48px; /* A11Y */
}

.btn-cerrar-principio:focus-visible {
    outline: 2px solid #333;
    outline-offset: -2px;
}

.btn-cerrar-principio:hover {
    background: rgba(255,255,255,0.9);
    color: #000;
}

/* Gradientes con transparencia para Glass */
.bg-blue { background: linear-gradient(135deg, rgba(0, 114, 214, 0.85), rgba(0, 86, 179, 0.9)); }
.bg-red { background: linear-gradient(135deg, rgba(255, 118, 117, 0.85), rgba(255, 94, 87, 0.9)); }
.bg-yellow { background: linear-gradient(135deg, rgba(230, 198, 94, 0.85), rgba(212, 160, 23, 0.9)); }
.bg-yellow h3 { text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* Eliminamos el borde superior sólido para que el gradiente domine */
.border-blue { border-top: none; } 
.border-red { border-top: none; }
.border-yellow { border-top: none; }

/* ======== AUTODIAGNÓSTICO ======== */
#form-evaluacion {
    max-width: 800px;
    margin: 0 auto;
}

#form-evaluacion ol {
    padding-left: 0;
    list-style: none;
    counter-reset: item;
}

#form-evaluacion li {
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    counter-increment: item;
    position: relative;
    padding-left: 60px;
    transition: background 0.3s, color 0.3s; 
}

#form-evaluacion li::before {
    content: counter(item);
    position: absolute;
    left: 20px;
    top: 20px;
    background: linear-gradient(135deg, #0072d6, #0056b3);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.respuestas {
    margin-top: 12px;
    display: flex;
    gap: 25px;
}

.respuestas label {
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 44px; /* A11Y */
}

#btn-evaluar {
    background: linear-gradient(135deg, #0072d6, #0056b3);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 30px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 5px 15px rgba(30, 144, 255, 0.4);
    transition: all 0.3s ease;
    min-height: 48px;
}

#btn-evaluar:focus-visible {
    outline: 3px solid #000;
    outline-offset: 2px;
}

#btn-evaluar:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(30, 144, 255, 0.6);
}

#resultado-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.resultado-titulo {
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.resultado-detalle {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 25px;
    color: #555;
}

.recursos-box {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    text-align: left;
}

.recursos-box h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.btn-modal-action {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    background: #e9ecef;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 44px;
}

.btn-modal-action:hover {
    background: #dee2e6;
    transform: translateX(5px);
}

.btn-whatsapp-modal {
    background: #25d366;
    color: white;
}

.btn-whatsapp-modal:hover {
    background: #1ebc57;
}

.text-danger { color: #dc3545 !important; }
.text-warning { color: #d39e00 !important; }
.text-success { color: #28a745 !important; }

#cerrar-modal {
    margin-top: 20px;
    background: transparent;
    color: #666;
    border: 1px solid #ccc;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    min-height: 44px;
}
#cerrar-modal:hover {
    background: #f0f0f0;
    color: #333;
}

/* ======== CONTACTO FORMULARIO ======== */
.contact-form-card {
    max-width: 600px;
    margin: 40px auto;
}

.contact-form-group {
    margin-bottom: 20px;
}

.contact-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.contact-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.contact-input:focus {
    outline: none;
    border-color: #1e90ff;
    box-shadow: 0 0 0 3px rgba(30,144,255,0.1);
}

.error-msg {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
    min-height: 1.2em; 
}

.btn-enviar-contacto {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #0072d6, #0056b3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    min-height: 48px;
}

.btn-enviar-contacto:focus-visible {
    outline: 3px solid #000;
    outline-offset: 2px;
}

.btn-enviar-contacto:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(30,144,255,0.3);
}

.contacto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* TARJETAS CONTACTO GLASS (Cristal) */
.contacto-item {
    /* Fondo Glass (Semi-transparente) */
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    
    padding: 30px 25px;
    border-radius: 20px; /* Bordes redondeados más suaves */
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    border-bottom: 5px solid #1e90ff;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 1;
    /* Animación de entrada igual a Principios */
    animation: slideUpFade 1s cubic-bezier(0.25, 0.8, 0.25, 1) backwards;
}

.contacto-item:nth-child(1) { animation-delay: 0.1s; }
.contacto-item:nth-child(2) { animation-delay: 0.2s; }
.contacto-item:nth-child(3) { animation-delay: 0.3s; }

.contacto-item h3 {
    color: #1e90ff;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.contacto-item a {
    color: #0077cc;
    text-decoration: none;
    font-weight: 500;
    min-height: 44px;
    display: inline-block;
}

.contacto-item a:hover {
    color: #005999;
    text-decoration: underline;
}

/* Brillo en hover (Igual que Principios) */
.contacto-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-25deg);
    transition: 0.5s;
    pointer-events: none;
}

.contacto-item:hover {
    transform: translateY(-10px) scale(1.03);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 40px 0 rgba(31, 38, 135, 0.2);
}

.contacto-item:hover::before {
    left: 150%;
}

.mapa-container {
    margin-top: 40px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.mapa-container iframe {
    width: 100%;
    height: 400px;
    border: none;
}

/* ======== VIDEOS & NOTICIAS ======== */
.videos-grid, .noticias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.video-card, .noticia-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.video-card iframe {
    width: 100%;
    height: 220px;
    border: none;
}

.video-info, .noticia-content {
    padding: 15px;
}

.video-info h3, .noticia-content h3 {
    color: #1e90ff;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.noticia-fecha {
    color: #1e90ff;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.noticia-content p {
    color: #666;
    line-height: 1.6;
}

.noticia-imagen {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Botón Favorito */
.btn-favorito {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.8);
    border: none;
    border-radius: 50%;
    width: 44px; /* A11Y */
    height: 44px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn-favorito:focus-visible {
    outline: 2px solid #0056b3;
}

.btn-favorito:hover {
    transform: scale(1.1);
    background: white;
}

.btn-favorito.fav-active {
    background: #ffecec;
}

.btn-filter-fav {
    padding: 8px 20px;
    border: 2px solid #1e90ff;
    background: transparent;
    color: #1e90ff;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    min-height: 44px;
}

.btn-filter-fav:hover {
    background: #e6f3ff;
}

.btn-filter-fav.active {
    background: #1e90ff;
    color: white;
}

/* ======== FOOTER ======== */
footer {
    position: relative;
    background: linear-gradient(135deg, #001a33 0%, #000d1a 100%);
    color: #cce6ff;
    padding: 60px 20px 20px;
    margin-top: 60px;
    border-top: 4px solid #1e90ff;
    overflow: hidden;
}

footer::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../imagenes/logofamilia.png") center/contain no-repeat;
    opacity: 0.30;
    pointer-events: none;
    z-index: 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.footer-top {
    display: flex;
    flex-direction: row;
    align-items: center;    
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-top > div:first-child {
    flex-shrink: 0;
}

.footer-logo-energom {
    height: 50px;
    width: auto;
    opacity: 0.8;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.2));
}

.footer-logo-energom:hover {
    opacity: 1;
    transform: scale(1.05) rotate(2deg);
}

.footer-info {
    text-align: center; 
    flex-grow: 1;
}

.footer-info h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: #1e90ff;
    text-underline-offset: 8px;
}

.footer-info p {
    margin: 8px 0;
    font-size: 1rem;
    color: #b3d9ff;
}

.footer-info a {
    color: #4db8ff;
    text-decoration: none;
    transition: color 0.3s, text-shadow 0.3s;
    position: relative;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.footer-info a:focus-visible {
    outline: 2px solid white;
    border-radius: 4px;
}

.footer-info a:hover {
    color: #80d4ff;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
}

.footer-copy {
    font-size: 0.9rem;
    opacity: 0.6;
}

/* ======== WHATSAPP FLOTANTE ======== */
.whatsapp-float {
    position: fixed;
    bottom: 10px;
    right: 20px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.whatsapp-float:focus-visible {
    outline: 3px solid #0056b3;
    outline-offset: 4px;
}

.whatsapp-float:hover {
    transform: translateY(-5px) scale(1.1);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(37, 211, 102, 0.5); }
    50% { box-shadow: 0 4px 25px rgba(37, 211, 102, 0.8); }
}

.whatsapp-float svg {
    width: 35px;
    height: 35px;
}

/* Scroll To Top */
#scrollToTopBtn {
    position: fixed;
    bottom: 90px;
    right: 25px;
    z-index: 990;
    width: 50px; /* A11Y + */
    height: 50px;
    background: linear-gradient(135deg, #0072d6, #0056b3);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

#scrollToTopBtn:focus-visible {
    outline: 3px solid #000;
    outline-offset: 4px;
}

#scrollToTopBtn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#scrollToTopBtn:hover {
    background: linear-gradient(135deg, #1e90ff, #0077cc);
    transform: translateY(-3px);
}

#scrollToTopBtn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Popup Aviso */
/* Popup Aviso - CENTRADO MOBILE FIX */
.popup-avisos {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.75);
    display: none !important;
    z-index: 10000 !important;
    animation: fadeIn 0.3s ease;
    padding: 20px !important;
    overflow: auto !important;
}

/* Cuando está visible, usar flexbox */
.popup-avisos[style*="display: flex"] {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.popup-contenido {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s ease;
    position: relative;
    max-height: 90vh !important;
    overflow-y: auto !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-contenido {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s ease;
    position: relative;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.popup-contenido h3 {
    color: #1e90ff !important;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.popup-contenido p {
    color: #555 !important;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

.popup-nota-secundaria {
    font-size: 0.95rem !important; 
    color: #888 !important; 
    margin-top: -15px !important; 
    margin-bottom: 30px !important;
}

.popup-contenido button {
    padding: 15px 40px;
    border: none;
    background: linear-gradient(135deg, #0072d6, #0056b3);
    color: white;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(30, 144, 255, 0.4);
    transition: all 0.3s ease;
    min-height: 48px;
}

.popup-contenido button:focus-visible {
    outline: 3px solid #000;
    outline-offset: 2px;
}

/* ===========================
   RESPONSIVE DESIGN (FIXED)
   =========================== */

/* Tablet y menores: Ajustes generales */
@media (max-width: 968px) {
    .header-main {
        flex-direction: row; /* Cambiar a fila para ahorrar espacio vertical */
        flex-wrap: nowrap; /* No envolver si es posible */
        align-items: center;
        text-align: left;
        padding: 10px 15px; /* Reducir padding drásticamente */
        gap: 15px;
    }

    .logo-aa-left {
        flex-shrink: 0;
    }

    .logo-aa-left img {
        width: 50px; /* Logo más pequeño en móvil */
        animation: none; /* Quitar animación para evitar distracciones */
    }

    .header-content {
        flex: 1; /* Ocupar espacio restante */
        margin-left: 5px;
    }

    .header-content h1 {
        font-size: 1.1rem; /* Título compacto */
        margin-bottom: 2px;
        line-height: 1.2;
    }

    .header-content p {
        /* Simplificar descripción en móvil */
        font-size: 0.75rem;
        line-height: 1.1;
        white-space: normal;
        width: auto;
        opacity: 1;
        border-right: none;
        animation: none; /* Sin efecto mecanografía */
        display: block;
        color: #666;
    }

 
    /* Ocultar acciones de escritorio (botones login grandes) */
    .desktop-actions {
        display: none;
    }
    
    /* Botón tema compacto y alineado */
    .top-controls {
        position: static;
        margin-left: auto;
        margin-right: 5px;
    }

    .theme-btn {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    /* MOSTRAR EL BOTÓN HAMBURGUESA */
    .menu-btn {
        display: flex;
    }

    
    /* === MENÚ LATERAL MÓVIL (DRAWER) === */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%; /* Oculto fuera de pantalla */
        width: 280px;
        height: 100vh;
        /* Efecto Glassmorphism Móvil */
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        flex-direction: column;
        justify-content: flex-start; /* Alinear items arriba */
        align-items: stretch; /* Estirar items */
        padding: 80px 20px 30px; /* Padding superior para no tapar con botón cerrar */
        box-shadow: -5px 0 30px rgba(0,0,0,0.15);
        transition: right 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
        z-index: 10000; /* Debajo del botón hamburguesa */
        overflow-y: auto; /* Scroll si es muy alto */
        transform: translateX(100%); 
        visibility: hidden; 
    }

    /* Estado Abierto */
    .nav-links.open {
        right: 0;
        transform: translateX(0);
        visibility: visible; 
    }

    /* Estilo de enlaces dentro del menú móvil */
    .nav-links button, .nav-links a {
        width: 100%;
        justify-content: flex-start; /* Texto a la izquierda */
        padding: 15px;
        margin-bottom: 10px;
        border-radius: 12px;
        font-size: 1.1rem;
        background: transparent;
        background-image: none;
        color: #333;
        box-shadow: none;
    }

    .nav-links button:hover, .nav-links a:hover {
        background: rgba(30, 144, 255, 0.1);
        transform: translateX(5px);
        box-shadow: none;
    }

    .nav-links button.active {
        background: #e6f3ff;
        color: #1e90ff;
        border-left: 4px solid #1e90ff;
    }

    /* Dropdown en móvil (expandible) */
    .nav-links .dropdown {
        display: block;
        width: 100%;
    }
    .nav-links .dropbtn {
        width: 100%;
    }
    .nav-links .dropdown-content {
        position: static;
        transform: none;
        box-shadow: none;
        background: rgba(0,0,0,0.03);
        border: none;
        padding-left: 15px;
        margin-bottom: 10px;
        border-radius: 10px;
    }
    .nav-links .dropdown-content a {
        padding: 12px;
        font-size: 1rem;
    }

    /* Mostrar acciones móviles (Login) dentro del menú */
    .mobile-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    .mobile-actions .btn-login {
        width: 100%;
        justify-content: center;
        box-shadow: none;
    }

    /* Overlay Oscuro */
    .menu-overlay {
        display: block; /* Estructuralmente presente */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.6);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(3px);
    }

    .menu-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .footer-top {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    /* Resetear posición del logo en móvil para que se apile verticalmente */
    .footer-top > div:first-child {
        position: static;
        transform: none;
    }

    /* Ajustes Dark Mode Móvil */
    body.dark .nav-links {
        background: rgba(22, 27, 34, 0.98);
        border-left: 1px solid rgba(255,255,255,0.1);
        transform: translateX(100%); 
        visibility: hidden; 
    }
    body.dark .nav-links.open {
    transform: translateX(0); 
    visibility: visible;
}

    body.dark .nav-links button, body.dark .nav-links a {
        color: #e6edf3;
    }
    body.dark .nav-links button:hover {
        background: rgba(255,255,255,0.05);
    }
    body.dark .nav-links button.active {
        background: rgba(30, 144, 255, 0.2);
        color: #58a6ff;
    }
    body.dark .mobile-actions {
        border-top-color: rgba(255,255,255,0.15);
    }
    body.dark .nav-links .dropdown-content {
        background: rgba(255,255,255,0.03);
    }
}

/* ======== MOBILE OVERLAY STYLES ======== */

/* ======== LOADER & NEWS ANIMATIONS ======== */
.loader-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
    width: 100%;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3; /* Light grey */
    border-top: 5px solid #1e90ff; /* Blue */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* News Card Hover Effect */
.noticia-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.noticia-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* Dark mode adjustments for news hover */
body.dark .noticia-card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    background: rgba(33, 38, 45, 1) !important; /* Slightly lighter than base dark bg */
}

/* ======== DISEÑO 12 PASOS (TIMELINE MODERNO) ======== */
.steps-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

.steps-list {
    list-style: none;
    padding: 0;
    position: relative;
    counter-reset: step-counter;
}

/* Línea vertical conectora */
.steps-list::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 24px; /* Centrado con el círculo del número */
    width: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    z-index: 0;
}

.step-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 70px; /* Espacio para el número */
    counter-increment: step-counter;
}

/* El número circulado */
.step-item::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;
    background-color: #fff;
    border: 3px solid #1e90ff;
    border-radius: 50%;
    text-align: center;
    line-height: 44px; /* Centrado vertical del texto */
    font-weight: 800;
    color: #1e90ff;
    font-size: 1.2rem;
    z-index: 1;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Contenido del texto del paso */
.step-content {
    background: #ffffff;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    font-size: 1.1rem;
    line-height: 1.6;
    color: #444;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

/* Efectos Hover */
.step-item:hover::before {
    background-color: #1e90ff;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(30, 144, 255, 0.4);
}

.step-item:hover .step-content {
    transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-left-color: #1e90ff;
}

/* Ajustes Dark Mode para los pasos */
body.dark .steps-list::before {
    background: #333;
}

body.dark .step-item::before {
    background-color: #161b22;
    border-color: #1e90ff;
    color: #1e90ff;
}

body.dark .step-item:hover::before {
    background-color: #1e90ff;
    color: #fff;
}

body.dark .step-content {
    background: #161b22;
    color: #c9d1d9;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

body.dark .step-item:hover .step-content {
    background: #21262d;
}

/* ======== GLASSMORPHISM MODALS (PRINCIPIOS) ======== */

/* Fondo del modal más oscuro y desenfocado */
.principio-modal {
    background-color: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Tarjeta de Vidrio */
.principio-modal-content {
    background: rgba(255, 255, 255, 0.9) !important; /* Blanco translúcido */
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2) !important;
    padding: 0 !important; /* Reset padding para controlar cabecera */
    overflow: hidden; /* Para que el radio del borde contenga la cabecera */
    max-width: 500px;
}

/* Redefinir bordes de colores como acentos superiores (Top Accent) */
.principio-modal-content.border-blue { 
    border-top: 8px solid #1e90ff !important; 
    border-bottom: none !important; border-left: none !important; border-right: none !important;
}
.principio-modal-content.border-red { 
    border-top: 8px solid #ff5e57 !important; 
    border-bottom: none !important; border-left: none !important; border-right: none !important;
}
.principio-modal-content.border-yellow { 
    border-top: 8px solid #d29922 !important; 
    border-bottom: none !important; border-left: none !important; border-right: none !important;
}

/* Cabecera integrada y transparente */
.modal-header {
    background: transparent !important; /* Quitar fondo sólido antiguo */
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding: 25px 25px 15px 25px;
    margin-bottom: 0;
}

/* Color del texto del título basado en el acento */
.principio-modal-content.border-blue .modal-header h3 { color: #1e90ff !important; font-size: 1.6rem; }
.principio-modal-content.border-red .modal-header h3 { color: #ff5e57 !important; font-size: 1.6rem; }
.principio-modal-content.border-yellow .modal-header h3 { color: #d29922 !important; font-size: 1.6rem; }

/* Cuerpo del modal */
.modal-body {
    padding: 20px 25px 30px;
    font-size: 1.05rem;
    color: #444;
    line-height: 1.6;
}

/* Botón cerrar estilo moderno */
.btn-cerrar-principio {
    margin: 0 25px 25px;
    width: calc(100% - 50px);
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f2f5 0%, #e1e4e8 100%);
    color: #333;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-cerrar-principio:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background: #fff;
}

/* Dark Mode Glass */
body.dark .principio-modal-content {
    background: rgba(30, 35, 45, 0.85) !important; /* Vidrio oscuro */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5) !important;
}

body.dark .modal-header { 
    border-bottom-color: rgba(255,255,255,0.1); 
}

body.dark .modal-body { 
    color: #e0e0e0; 
}

body.dark .btn-cerrar-principio {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.1);
}

body.dark .btn-cerrar-principio:hover {
    background: rgba(255,255,255,0.2);
}


/* ===========================
   MODO OSCURO
   =========================== */
body.dark {
    background: #0d1117 !important;
    color: #e6edf3 !important;
}

body.dark header {
    background: #161b22 !important;
}

body.dark nav {
    background: rgba(22, 27, 34, 0.95) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

body.dark .nav-links {
    /* Fondo del menú móvil en dark mode */
    background: rgba(22, 27, 34, 0.98); 
}

body.dark .header-content p {
    color: #9aa6b2 !important;
}

/* Cards y contenedores Dark */
body.dark .card,
body.dark .video-card,
body.dark .noticia-card {
    background: #161b22 !important;
    color: #e6edf3 !important;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.05) !important;
}

/* PRINCIPIOS DARK MODE (GLASS) */
body.dark .principio-card {
    background: rgba(22, 27, 34, 0.7) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
}
body.dark .principio-card:hover {
    background: rgba(22, 27, 34, 0.9) !important;
}
body.dark .principio-card:focus-visible {
    outline: 4px solid #58a6ff;
}
body.dark .principio-card h3 {
    color: #e6edf3 !important;
}
/* Actualización icono dark mode */
body.dark .icon-circle {
    background: linear-gradient(135deg, #161b22, #0d1117) !important;
    border-color: #30363d !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5) !important;
    color: #e6edf3 !important;
}
body.dark .principio-card:hover .icon-circle,
body.dark .contacto-item:hover .icon-circle {
    background: #21262d !important;
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.3) !important;
}

/* CONTACTO DARK MODE (GLASS) */
body.dark .contacto-item {
    background: rgba(22, 27, 34, 0.7) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-bottom: 5px solid #1e90ff !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
    color: #e6edf3 !important;
}
body.dark .contacto-item:hover {
    background: rgba(22, 27, 34, 0.9) !important;
}

body.dark h2,
body.dark h3,
body.dark p {
    color: #e6edf3 !important;
}

/* Formulario Dark */
body.dark .contact-input {
    background: #0d1117 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}

body.dark .contact-input:focus {
    border-color: #58a6ff !important;
}

body.dark label {
    color: #e6edf3 !important;
}

/* Lista del AUTODIAGNÓSTICO Dark */
body.dark #form-evaluacion li {
    background: #161b22 !important;
    color: #e6edf3 !important;
    border: 1px solid #30363d !important;
}

body.dark #form-evaluacion li::before {
    background: #1f6feb !important;
    color: white !important;
}

body.dark #form-evaluacion .respuestas label {
    color: #e6edf3 !important;
}

/* Modales Dark (Glass) */
body.dark .principio-modal-content {
    background: rgba(22, 27, 34, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
body.dark .modal-content, 
body.dark .popup-contenido {
    background: #161b22 !important;
    color: #e6edf3 !important;
}
body.dark .modal-body, 
body.dark .resultado-detalle {
    color: #ccc !important;
}
body.dark .btn-cerrar-principio {
    background: rgba(255,255,255,0.05) !important;
    color: #e6edf3 !important;
}
body.dark .btn-cerrar-principio:hover {
    background: rgba(255,255,255,0.1) !important;
}

/* Dropdown Dark Mode */
body.dark .dropdown-content {
    background: rgba(22, 27, 34, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
body.dark .dropdown-content a {
    color: #e6edf3 !important;
}
body.dark .dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark footer {
    background: linear-gradient(135deg, #0a0f16, #05070c) !important;
    border-top-color: #1f6feb !important;
}

body.dark .btn-login {
    color: white !important;
}

/* ===========================
   ANIMACIONES
   =========================== */

/* Entrada suave del menú overlay */
@keyframes menuOverlayEnter {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Animación slide-down genérica (dropdowns) */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   ESTILOS ESPECIALES VILLARRICA (Elegancia & Realce)
   =========================== */
.card-highlight-villarrica {
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(240,248,255,0.9));
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 15px 40px rgba(0, 114, 214, 0.1); 
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    padding: 50px 30px; /* Más espacio interno para elegancia */
    border-radius: 20px;
}

/* Barra decorativa superior con gradiente Azul-Verde (Naturaleza/Sur) */
.card-highlight-villarrica::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #1e90ff, #2ec467); 
}

/* Icono de fondo decorativo (Marca de agua sutil) */
.card-highlight-villarrica::after {
    content: '🏔️';
    position: absolute;
    right: -20px;
    bottom: -30px;
    font-size: 12rem;
    opacity: 0.07;
    transform: rotate(-15deg);
    pointer-events: none;
    z-index: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.card-highlight-villarrica:hover::after {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.12;
}

.card-highlight-villarrica h3 {
    font-size: 2rem !important; /* Título más grande e imponente */
    margin-bottom: 25px !important;
    /* Texto con gradiente */
    background: linear-gradient(90deg, #1e90ff, #0056b3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    position: relative;
    z-index: 1;
}

.card-highlight-villarrica p {
    font-size: 1.25rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    line-height: 1.8;
}

/* Efecto Hover en la tarjeta */
.card-highlight-villarrica:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0, 114, 214, 0.2);
}

/* Adaptación Dark Mode para la tarjeta Villarrica */
body.dark .card-highlight-villarrica {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9)) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4) !important;
}

body.dark .card-highlight-villarrica h3 {
    background: linear-gradient(90deg, #58a6ff, #2ec467);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark .card-highlight-villarrica p {
    color: #e6edf3;
}
.footer-seo {
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #ccc; /* ajusta según tu footer */
}

/* MEDIA QUERIES ESPECÍFICAS PARA MÓVIL */
@media (max-width: 768px) {
    /* Asegurar centrado vertical y horizontal */
    .principio-modal,
    #resultado-modal,
    #modal-contacto-exito,
    #anonimo-popup,
    .popup-avisos {
        padding: 20px !important;
    }
    
    .principio-modal-content,
    #resultado-modal .modal-content,
    .popup-contenido {
        width: 95% !important;
        max-width: 100% !important;
        max-height: 85vh !important;
        margin: 0 !important;
    }
    
    /* Ajustar padding interno para móvil */
    .modal-body {
        padding: 20px 15px !important;
        font-size: 0.95rem !important;
    }
    
    .modal-header h3 {
        font-size: 1.3rem !important;
    }
    
    .btn-cerrar-principio,
    #cerrar-modal,
    .popup-contenido button {
        font-size: 0.95rem !important;
        padding: 12px 20px !important;
    }
}

@media (max-width: 480px) {
    .principio-modal,
    #resultado-modal,
    #modal-contacto-exito,
    #anonimo-popup {
        padding: 10px !important;
    }
    
    .principio-modal-content,
    #resultado-modal .modal-content,
    .popup-contenido {
        width: 98% !important;
        max-height: 90vh !important;
        border-radius: 12px !important;
    }
    
    .modal-body {
        padding: 15px 12px !important;
        font-size: 0.9rem !important;
    }
    
    .modal-header {
        padding: 20px 15px 15px !important;
    }
    
    .modal-header h3 {
        font-size: 1.2rem !important;
    }
}

/* Fix específico para el popup de anonimato */
.popup-avisos[style*="display: flex"] {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* Asegurar que en dark mode también funcione */
body.dark .principio-modal-content,
body.dark #resultado-modal .modal-content,
body.dark .popup-contenido {
    max-height: 90vh !important;
    overflow-y: auto !important;
}

/* Prevenir scroll del body cuando modal está abierto */
body.modal-open {
    overflow: hidden !important;
    height: 100vh !important;
}

/* Smooth scroll para el contenido del modal */
.principio-modal-content,
#resultado-modal .modal-content,
.popup-contenido {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Mejorar el scrollbar en móvil */
.principio-modal-content::-webkit-scrollbar,
#resultado-modal .modal-content::-webkit-scrollbar,
.popup-contenido::-webkit-scrollbar {
    width: 6px;
}

.principio-modal-content::-webkit-scrollbar-thumb,
#resultado-modal .modal-content::-webkit-scrollbar-thumb,
.popup-contenido::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

body.dark .principio-modal-content::-webkit-scrollbar-thumb,
body.dark #resultado-modal .modal-content::-webkit-scrollbar-thumb,
body.dark .popup-contenido::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

/* ==============================================
   FIX DEFINITIVO PARA MODALES EN MÓVIL
   Agregar al FINAL de styles-index.css
   ============================================== */

/* 1. RESET COMPLETO DE MODALES - Base común para todos */
.principio-modal,
#resultado-modal,
#modal-contacto-exito,
#anonimo-popup {
    /* Posicionamiento fijo en toda la pantalla */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    
    /* Fondo oscuro con blur */
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    
    /* Centrado perfecto */
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* Z-index alto */
    z-index: 10000 !important;
    
    /* Padding para respiración en bordes */
    padding: 20px !important;
    
    /* Scroll vertical si es necesario */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Cuando están visibles, usar flex */
.principio-modal[style*="display: flex"],
#resultado-modal[style*="display: flex"],
#modal-contacto-exito[style*="display: flex"],
#anonimo-popup[style*="display: flex"] {
    display: flex !important;
}

/* 2. CONTENEDORES DE MODALES - Tamaño y scroll interno */
.principio-modal-content,
#resultado-modal .modal-content,
#modal-contacto-exito .principio-modal-content,
.popup-contenido {
    /* Tamaño base */
    width: 90% !important;
    max-width: 500px !important;
    max-height: 85vh !important;
    
    /* Margen automático para centrado adicional */
    margin: auto !important;
    
    /* Scroll interno si el contenido es muy largo */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    
    /* Posicionamiento relativo para z-index interno */
    position: relative !important;
    
    /* Bordes y sombras */
    border-radius: 20px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
}

/* 3. AJUSTES ESPECÍFICOS PARA MÓVIL */
@media (max-width: 768px) {
    /* Reducir padding del contenedor principal */
    .principio-modal,
    #resultado-modal,
    #modal-contacto-exito,
    #anonimo-popup {
        padding: 15px !important;
    }
    
    /* Contenido modal más ancho en móvil */
    .principio-modal-content,
    #resultado-modal .modal-content,
    .popup-contenido {
        width: 95% !important;
        max-height: 90vh !important;
        border-radius: 15px !important;
    }
    
    /* Headers más compactos */
    .modal-header {
        padding: 20px 20px 15px 20px !important;
    }
    
    .modal-header h3 {
        font-size: 1.4rem !important;
        line-height: 1.3 !important;
    }
    
    /* Body del modal */
    .modal-body {
        padding: 20px !important;
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }
    
    /* Listas dentro del modal */
    .modal-body ul {
        padding-left: 20px !important;
        margin: 15px 0 !important;
    }
    
    .modal-body li {
        margin-bottom: 10px !important;
    }
    
    /* Botones de cierre */
    .btn-cerrar-principio,
    #cerrar-modal,
    .popup-contenido button,
    #btn-cerrar-contacto-exito {
        padding: 14px 20px !important;
        font-size: 1rem !important;
        margin: 20px !important;
        width: calc(100% - 40px) !important;
    }
}

/* 4. PANTALLAS MUY PEQUEÑAS (< 480px) */
@media (max-width: 480px) {
    .principio-modal,
    #resultado-modal,
    #modal-contacto-exito,
    #anonimo-popup {
        padding: 10px !important;
    }
    
    .principio-modal-content,
    #resultado-modal .modal-content,
    .popup-contenido {
        width: 98% !important;
        max-height: 92vh !important;
        border-radius: 12px !important;
    }
    
    .modal-header {
        padding: 18px 15px 12px 15px !important;
    }
    
    .modal-header h3 {
        font-size: 1.2rem !important;
    }
    
    .modal-body {
        padding: 15px !important;
        font-size: 0.9rem !important;
    }
    
    /* Iconos del header más pequeños */
    .modal-header h3::before {
        font-size: 1.3rem !important;
    }
}

/* 5. SCROLLBAR PERSONALIZADO PARA MODALES */
.principio-modal-content::-webkit-scrollbar,
#resultado-modal .modal-content::-webkit-scrollbar,
.popup-contenido::-webkit-scrollbar {
    width: 8px !important;
}

.principio-modal-content::-webkit-scrollbar-track,
#resultado-modal .modal-content::-webkit-scrollbar-track,
.popup-contenido::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05) !important;
    border-radius: 10px !important;
}

.principio-modal-content::-webkit-scrollbar-thumb,
#resultado-modal .modal-content::-webkit-scrollbar-thumb,
.popup-contenido::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2) !important;
    border-radius: 10px !important;
}

.principio-modal-content::-webkit-scrollbar-thumb:hover,
#resultado-modal .modal-content::-webkit-scrollbar-thumb:hover,
.popup-contenido::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3) !important;
}

/* 6. DARK MODE - Scrollbar */
body.dark .principio-modal-content::-webkit-scrollbar-thumb,
body.dark #resultado-modal .modal-content::-webkit-scrollbar-thumb,
body.dark .popup-contenido::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
}

body.dark .principio-modal-content::-webkit-scrollbar-thumb:hover,
body.dark #resultado-modal .modal-content::-webkit-scrollbar-thumb:hover,
body.dark .popup-contenido::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* 7. PREVENIR SCROLL DEL BODY CUANDO MODAL ESTÁ ABIERTO */
body.modal-open {
    overflow: hidden !important;
    height: 100vh !important;
    position: fixed !important;
    width: 100% !important;
}

/* 8. ANIMACIONES SUAVES */
.principio-modal[style*="display: flex"] .principio-modal-content,
#resultado-modal[style*="display: flex"] .modal-content,
#modal-contacto-exito[style*="display: flex"] .principio-modal-content,
#anonimo-popup[style*="display: flex"] .popup-contenido {
    animation: modalSlideUp 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* IMPORTANTE: Prevenir que nav-links se muestre en desktop */
@media (min-width: 969px) {
    .nav-links {
        position: static !important;
        right: auto !important;
        transform: none !important;
        visibility: visible !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        backdrop-filter: none !important;
        flex-direction: row !important;
        padding: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
    }
    
    body.dark .nav-links {
        background: transparent !important;
        border: none !important;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 9. FIX PARA CAJAS DE CITAS DENTRO DE MODALES */
.modal-body div[style*="background"],
.modal-body blockquote {
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
}

/* 10. ASEGURAR QUE LOS RECURSOS-BOX NO SE DESBORDEN */
.recursos-box {
    max-width: 100% !important;
    overflow: hidden !important;
}

.recursos-box h4 {
    font-size: 1rem !important;
    margin-bottom: 10px !important;
}

/* 11. FIX ESPECÍFICO PARA MODAL DE ANONIMATO */
#modal-anonimato .modal-body,
#modal-comunidad .modal-body,
#modal-esperanza .modal-body {
    max-height: none !important;
}

/* 12. FIX PARA POPUP DE AVISO DE ANONIMATO */
.popup-avisos {
    padding: 20px !important;
}

.popup-avisos .popup-contenido {
    padding: 30px 25px !important;
}

.popup-avisos .popup-contenido h3 {
    margin-bottom: 15px !important;
}

.popup-avisos .popup-contenido p {
    margin-bottom: 15px !important;
}

/* 13. MEJORAS PARA ACCESIBILIDAD EN MÓVIL */
.btn-cerrar-principio:focus-visible,
#cerrar-modal:focus-visible,
.popup-contenido button:focus-visible {
    outline: 3px solid #1e90ff !important;
    outline-offset: 2px !important;
}

/* 14. FIX PARA MODAL DE RESULTADO DE EVALUACIÓN */
#resultado-modal .modal-content {
    padding: 30px 25px !important;
}

.resultado-titulo {
    margin-bottom: 15px !important;
    font-size: 1.4rem !important;
}

.resultado-detalle {
    margin-bottom: 20px !important;
    line-height: 1.7 !important;
}

/* 15. AJUSTE PARA ICONOS GRANDES EN MODALES */
#resultado-modal [aria-hidden="true"],
.modal-body [aria-hidden="true"] {
    display: block !important;
    margin: 15px auto !important;
}

/* 16. LANDSCAPE MODE (Horizontal) */
@media (max-height: 600px) and (orientation: landscape) {
    .principio-modal-content,
    #resultado-modal .modal-content,
    .popup-contenido {
        max-height: 95vh !important;
        margin: 10px auto !important;
    }
    
    .modal-header {
        padding: 15px !important;
    }
    
    .modal-body {
        padding: 15px !important;
        font-size: 0.9rem !important;
    }
    
    .btn-cerrar-principio,
    #cerrar-modal,
    .popup-contenido button {
        padding: 10px !important;
        margin: 15px !important;
    }
}

/* 17. FIX PARA CUANDO EL MENÚ MÓVIL ESTÁ ABIERTO */
.nav-links.open ~ .principio-modal,
.nav-links.open ~ #resultado-modal,
.nav-links.open ~ #modal-contacto-exito,
.nav-links.open ~ #anonimo-popup {
    z-index: 10001 !important; /* Por encima del menú */
}
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
body.modal-open {
    overflow: hidden;
}