/* ======================================================
   TERREMOTO AYUDA - ESTILOS GLOBALES
   ====================================================== */

/* ======================================================
   1. RESET Y VARIABLES
   ====================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

/* ======================================================
   2. CONTENEDOR
   ====================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
}

/* ======================================================
   3. HEADER Y NAVEGACIÓN
   ====================================================== */
.main-header {
    background: var(--primary);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    align-items: center;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.3s;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.1);
}

.main-nav .btn-urgente {
    background: var(--accent) !important;
    font-weight: bold;
}

.main-nav .btn-urgente:hover {
    background: #c0392b !important;
}

/* ======================================================
   MENÚ HAMBURGUESA - ESTILOS
   ====================================================== */

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1000;
    position: relative;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.main-nav {
    display: flex;
}

.main-nav ul {
    display: flex;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 992px) {
    .menu-toggle {
        display: flex !important;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #2c3e50;
        padding: 80px 25px 30px;
        transition: right 0.3s ease;
        z-index: 999;
        overflow-y: auto;
        box-shadow: -5px 0 30px rgba(0,0,0,0.3);
        display: block !important;
    }
    
    .main-nav.open {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
    }
    
    .main-nav a {
        padding: 12px 18px;
        border-radius: 8px;
        font-size: 1rem;
        width: 100%;
        display: flex !important;
        color: white !important;
        text-decoration: none !important;
    }
}

@media (max-width: 480px) {
    .main-nav {
        width: 100%;
        right: -100%;
    }
}

/* ======================================================
   5. FOOTER
   ====================================================== */
.main-footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 20px 0;
}

/* ======================================================
   6. BOTONES Y FORMULARIOS
   ====================================================== */
.btn {
    display: inline-block;
    padding: 10px 25px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary { background: var(--secondary); }
.btn-danger { background: var(--accent); }
.btn-success { background: var(--success); }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 12px 35px; font-size: 1.1rem; }

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ======================================================
   7. TARJETAS Y ALERTAS
   ====================================================== */
.card-login {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    max-width: 60%;
    margin: 0 auto 20px auto; /* Centra horizontalmente y mantiene el margen inferior */
}

.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-title {
    margin-bottom: 15px;
    font-size: 1.25rem;
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* ======================================================
   8. HERO Y STATS (PÁGINA DE INICIO)
   ====================================================== */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 80px 0;
    border-radius: 15px;
    margin-bottom: 40px;
    text-align: center;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.hero-content .highlight { color: #ffd700; }
.hero-content p { font-size: 1.2rem; opacity: 0.9; margin-bottom: 30px; }

.hero-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.stats-section {
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.stat-card:hover { transform: translateY(-5px); }
.stat-card i { font-size: 2.5rem; color: var(--secondary); margin-bottom: 10px; }
.stat-card h3 { font-size: 2rem; margin: 10px 0; }
.stat-card p { color: #666; margin: 0; }

/* ======================================================
   9. RECURSOS
   ====================================================== */
.recursos-section {
    margin-bottom: 40px;
}

.recursos-section h2 {
    text-align: center;
    margin-bottom: 30px;
}

.recurso-card {
    text-align: center;
    padding: 30px 20px;
    height: 100%;
}

.recurso-icon {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 15px;
}

.recurso-card h3 { font-size: 1.1rem; margin-bottom: 10px; }

.recursos-section .text-center {
    text-align: center;
    margin-top: 2rem;
}

/* ======================================================
   10. CTA SECTION
   ====================================================== */
.cta-section {
    background: var(--primary);
    color: white;
    padding: 60px 0;
    border-radius: 15px;
    text-align: center;
}

.cta-section h2 { font-size: 2rem; margin-bottom: 15px; }
.cta-section p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 25px; }

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ======================================================
   11. ANIMACIONES
   ====================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-on-scroll {
    opacity: 0;
}

.animate-on-scroll.visible {
    animation: fadeInUp 0.6s ease forwards;
}

/* ======================================================
   12. UTILIDADES
   ====================================================== */
.text-center { text-align: center; }
.text-muted { color: #6c757d; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }
.mb-20 { margin-bottom: 20px; }

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.justify-content-center { justify-content: center; }

.col-md-3 { grid-column: span 1; }
.col-md-4 { grid-column: span 1; }
.col-md-6 { grid-column: span 2; }
.col-md-8 { grid-column: span 3; }

@media (min-width: 768px) {
    .col-md-3 { grid-column: span 1; }
    .col-md-4 { grid-column: span 1; }
    .col-md-6 { grid-column: span 2; }
    .col-md-8 { grid-column: span 3; }
}

/* ======================================================
   13. RESPONSIVE - AJUSTES GENERALES
   ====================================================== */
@media (max-width: 768px) {
    .hero-content h1 { font-size: 1.8rem; }
    .section-title { font-size: 1.6rem; }
    .faq-item .faq-question { font-size: 0.9rem; padding: 14px 18px; }
    .row { grid-template-columns: 1fr; }
}


/* ======================================================
   6. CTA SECTION (HOME)
   ====================================================== */

.cta-section-home {
    padding: 60px 0;
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    border-radius: 16px;
    margin-top: 20px;
}

.cta-content-home {
    text-align: center;
    color: white;
    padding: 20px;
}

.cta-content-home h2 {
    font-size: 2.2rem;
    margin-bottom: 12px;
    font-weight: 700;
}

.cta-content-home h2 .highlight-light {
    color: #f39c12;
}

.cta-content-home p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 25px;
}

.cta-content-home .btn-cta-home {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 25px rgba(231, 76, 60, 0.4);
}

.cta-content-home .btn-cta-home:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 35px rgba(231, 76, 60, 0.5);
}

.cta-content-home .btn-cta-home i {
    transition: transform 0.3s;
}

.cta-content-home .btn-cta-home:hover i:last-child {
    transform: translateX(5px);
}

.cta-content-home .pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 4px 25px rgba(231, 76, 60, 0.4); }
    50% { transform: scale(1.03); box-shadow: 0 8px 40px rgba(231, 76, 60, 0.6); }
    100% { transform: scale(1); box-shadow: 0 4px 25px rgba(231, 76, 60, 0.4); }
}

@media (max-width: 768px) {
    .cta-content-home h2 {
        font-size: 1.6rem;
    }
    
    .cta-content-home .btn-cta-home {
        padding: 14px 25px;
        font-size: 0.95rem;
        width: 100%;
        justify-content: center;
    }
}



/* ======================================================
   SUBMENÚS - ESTILOS CORREGIDOS
   ====================================================== */

/* Items con submenú */
.menu-item-has-children {
    position: relative;
}

.menu-item-has-children > a {
    cursor: pointer;
}

.menu-item-has-children > a i.fa-chevron-down {
    font-size: 0.7rem;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.menu-item-has-children:hover > a i.fa-chevron-down,
.menu-item-has-children.active > a i.fa-chevron-down {
    transform: rotate(180deg);
}

/* Submenú - Desktop */
.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #2c3e50;
    border-radius: 8px;
    padding: 8px 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    z-index: 1000;
    list-style: none;
    margin: 4px 0 0;
}

.sub-menu li {
    display: block;
    margin: 0;
}

.sub-menu a {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 18px !important;
    font-size: 0.9rem !important;
    color: white !important;
    text-decoration: none !important;
    transition: background 0.3s ease;
    border-radius: 0 !important;
    width: 100% !important;
}

.sub-menu a:hover {
    background: rgba(255,255,255,0.12);
}

.sub-menu .btn-urgente-submenu {
    background: #e74c3c !important;
    border-radius: 6px !important;
    margin: 3px!important;
    text-align: center;
    justify-content: center;
    font-weight: 700;
}

.sub-menu .btn-urgente-submenu:hover {
    background: #c0392b !important;
}

/* Mostrar submenú en desktop - SOLO HOVER */
@media (min-width: 993px) {
    .menu-item-has-children:hover .sub-menu {
        display: block;
        animation: fadeInSubMenu 0.25s ease;
    }
    
    @keyframes fadeInSubMenu {
        from {
            opacity: 0;
            transform: translateY(-5px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ======================================================
   SUBMENÚ EN MÓVIL (Hamburguesa) - CORREGIDO
   ====================================================== */
@media (max-width: 992px) {
    .sub-menu {
        position: static;
        display: none !important;  /* 🔥 OCULTO POR DEFECTO */
        background: rgba(255,255,255,0.06);
        border-radius: 8px;
        padding: 5px 0 5px 15px;
        margin: 2px 0 5px;
        box-shadow: none;
        width: 100%;
        animation: none;
    }
    
    /* 🔥 SOLO SE MUESTRA CUANDO TIENE LA CLASE 'open' */
    .sub-menu.open {
        display: block !important;
    }
    
    .sub-menu a {
        font-size: 0.9rem !important;
        padding: 10px 16px !important;
    }
    
    .sub-menu .btn-urgente-submenu {
        margin: 4px 10px !important;
    }
    
    .menu-item-has-children > a i.fa-chevron-down {
        margin-left: auto;
    }
    
    /* 🔥 RESET: Cerrar submenús al cargar */
    .sub-menu {
        display: none !important;
    }
}



/* ======================================================
   CSS DE EMERGENCIA - FORZAR CIERRE DE SUBMENÚS
   ====================================================== */

/* Forzar que los submenús estén ocultos por defecto */
.sub-menu {
    display: none !important;
}

/* Solo mostrar cuando tienen la clase open */
.sub-menu.open {
    display: block !important;
}

/* En desktop, mostrar con hover */
@media (min-width: 993px) {
    .menu-item-has-children:hover .sub-menu {
        display: block !important;
    }
    
    /* Pero ocultar cuando no hay hover */
    .menu-item-has-children:not(:hover) .sub-menu:not(.open) {
        display: none !important;
    }
}

/* En móvil, reset */
@media (max-width: 992px) {
    .sub-menu {
        display: none !important;
    }
    .sub-menu.open {
        display: block !important;
    }
}


/* ======================================================
   MODALES - FONDO SÓLIDO (CORREGIDO)
   ====================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 99999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal.open {
    display: flex !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal .modal-content {
    background: white !important;
    border-radius: 16px;
    padding: 30px 35px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 100000;
}

.modal .modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: #999;
    transition: all 0.3s;
    z-index: 10;
}

.modal .modal-close:hover {
    color: #e74c3c;
}

