/* =================================================== */
/* --- 1. VARIABLES CSS Y PALETA DE COLORES (LIGHT & DARK MODE) --- */
/* =================================================== */

/* MODO CLARO: Paleta por defecto */
:root {
    /* Colores de Marca */
    --primary-color: #1A4B7D; /* Azul Marino Oscuro (Confianza) */
    --accent-color: #76D7C4; /* Verde Lima/Menta (Energía/Fresco) */
    
    /* Fondos y Superficies */
    --background-color: #F7F8FC; /* Fondo Principal (Blanco Roto) */
    --surface-color: white; /* Color de fondo de Tarjetas/Secciones */
    
    /* Texto y Sombras */
    --text-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* MODO OSCURO (Se activa con la clase body.dark-mode) */
body.dark-mode {
    --primary-color: #76D7C4; /* Invertido: Acento es ahora el primario */
    --accent-color: #1A4B7D; /* Invertido: Primario es ahora el acento */
    --background-color: #121212; /* Fondo Negro Oscuro */
    --surface-color: #1f1f1f; /* Fondo de Tarjetas/Elementos (Gris Oscuro) */
    --text-color: #E0E0E0; /* Texto Gris Claro */
    --shadow-color: rgba(255, 255, 255, 0.05); /* Sombra muy sutil */

    /* SOLUCIÓN DE ÚLTIMO RECURSO: Forzar la base del tema */
    background-color: var(--background-color) !important; 
    color: var(--text-color) !important; 
}

/* --- PREFERENCIA DEL SISTEMA OPERATIVO (Anti-Flash) --- */
/* Aplica el modo oscuro inmediatamente si el SO lo prefiere */
@media (prefers-color-scheme: dark) {
    body {
        --primary-color: #76D7C4; 
        --accent-color: #1A4B7D; 
        --background-color: #121212; 
        --surface-color: #1f1f1f; 
        --text-color: #E0E0E0; 
        --shadow-color: rgba(255, 255, 255, 0.05); 
    }
}

/* =================================================== */
/* --- 2. RESETEO Y TIPOGRAFÍA GLOBAL --- */
/* =================================================== */

body {
    font-family: Arial, sans-serif; 
    line-height: 1.6;
    margin: 0;
    padding: 0;
    
    /* Usa las variables de color del :root (Modo Claro por defecto) */
    background-color: var(--background-color); 
    color: var(--text-color); 
    transition: background-color 0.4s, color 0.4s; 
}

h1, h2, h3 {
    color: var(--primary-color);
    transition: color 0.4s;
}

main {
    padding: 20px 5%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Aplicación global del color de superficie a elementos contenedores */
header, footer, .feature-card, .review-card, 
.service-category, #contact-form-section, 
#map-section, .history-block, .gallery-item {
    background: var(--surface-color);
    box-shadow: 0 1px 4px var(--shadow-color);
    transition: background-color 0.4s, box-shadow 0.4s;
}

/* Estilo de los encabezados de página */
.page-header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 20px;
}

/* =================================================== */
/* --- 3. ENCABEZADO, NAVEGACIÓN Y FOOTER --- */
/* =================================================== */

header {
    padding: 20px 5%; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; 
    z-index: 20; 
    box-shadow: 0 2px 5px var(--shadow-color);
}

header h1 {
    font-size: 1.8em; 
    font-weight: 900; 
    letter-spacing: -0.5px;
}

/* Botones del Header */
.theme-toggle, .menu-toggle {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--primary-color);
    transition: color 0.3s;
}

.menu-toggle {
    display: none; /* Oculto por defecto en desktop */
}

/* Estilo del menú de desktop */
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 25px; 
}

nav ul li a {
    color: var(--text-color);
    font-weight: 600; 
    padding: 5px 0;
    position: relative;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: var(--primary-color);
}

/* Efecto de barra de acento al pasar el ratón */
nav ul li a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    background: var(--accent-color);
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease-in-out;
    border-radius: 2px;
}

nav ul li a:hover:after {
    width: 100%;
}

/* --- FOOTER PROFESIONAL --- */
footer {
    text-align: center;
    padding: 25px 5%;
    margin-top: 50px;
    font-size: 0.9em;
    border-top: 1px solid rgba(120, 120, 120, 0.2); 
    color: var(--text-color);
    background-color: var(--surface-color); 
    box-shadow: none;
}


/* =================================================== */
/* --- 4. BOTONES Y LLAMADAS A LA ACCIÓN (CTA) --- */
/* =================================================== */

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-color);
    opacity: 0.8;
}

.cta-primary {
    display: inline-block;
    background-color: var(--accent-color); 
    color: var(--primary-color) !important; 
    padding: 10px 20px;
    border-radius: 50px; 
    margin-top: 15px;
    text-transform: uppercase;
    font-weight: bold;
    box-shadow: 0 4px 6px var(--shadow-color);
    border: none;
    transition: background-color 0.3s, transform 0.3s;
}

.cta-primary:hover {
    background-color: #5ab5a6; 
    transform: translateY(-2px);
}

.link-secondary {
    color: var(--text-color);
    font-weight: bold;
    transition: color 0.3s;
}

nav ul li .cta-button {
    box-shadow: none; 
}

nav ul li .cta-button:after {
    content: none;
}

/* =================================================== */
/* --- 5. INDEX.HTML Y SECCIONES GLOBALES --- */
/* =================================================== */

/* --- Sección HERO Impactante --- */
#hero-original {
    display: flex;
    align-items: center;
    gap: 50px;
    padding: 60px 0;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-text-content {
    flex: 1.2;
}

.hero-image-container {
    flex: 1;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 20px var(--shadow-color);
}

.hero-image-container img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease-in-out;
}

.subtitle {
    font-size: 1.1em;
    color: #888; 
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.accent-text {
    color: var(--accent-color);
}

.hero-actions {
    margin-top: 25px;
    display: flex;
    gap: 20px;
    align-items: center;
}

/* --- Sección Key Stats (Cifras Clave) --- */
#key-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    
    background-color: var(--primary-color);
    color: white; 
    
    padding: 30px 20px; 
    margin: 40px auto;
    border-radius: 12px; 
    max-width: 1200px;
    box-shadow: 0 8px 15px var(--shadow-color); 
    transition: background-color 0.4s;
}

.stat-item {
    text-align: center;
    padding: 0 30px; 
    background: none; 
    border-right: 1px solid rgba(255, 255, 255, 0.4); 
}

.stat-item:last-child {
    border-right: none;
}

.stat-number {
    font-size: 3em; 
    font-weight: 700; 
    color: var(--accent-color); 
    display: block;
    line-height: 1.1;
    background: none;
}

.stat-item p {
    margin: 5px 0 0 0;
    font-size: 1.1em;
    opacity: 0.9;
    color: white; 
}

/* --- Tarjetas (Destacados, Servicios, Reseñas) --- */
.feature-card, .review-card, .service-category, .history-block {
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

/* =================================================== */
/* --- 6. ESTILOS DE PÁGINAS ESPECÍFICAS --- */
/* =================================================== */

/* --- GALERÍA (galeria.html) --- */
#photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 20px; 
    padding: 20px 0;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden; 
    transition: transform 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px var(--shadow-color);
}

.gallery-item img {
    width: 100%;
    height: 250px; 
    object-fit: cover; 
    display: block;
}

/* --- SERVICIOS (servicios.html) --- */
#service-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 30px;
    padding: 20px 0;
}

.service-category h3 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--background-color); 
    padding-bottom: 10px;
    margin-top: 0;
}

.service-category ul {
    list-style: none;
    padding: 0;
}

/* --- CONTACTO (contacto.html) --- */
#contact-form-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    border-radius: 8px;
}

#contact-form input,
#contact-form select,
#contact-form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; 
    font-size: 1em;
    background: var(--background-color); 
    color: var(--text-color);
    transition: background 0.4s;
}

.contact-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--background-color);
    text-align: center;
}

/* --- UBICACIÓN (ubicacion.html) --- */
#map-section {
    padding: 30px;
    border-radius: 8px;
}

.interest-points {
    margin-top: 30px;
    padding: 15px;
    border: 1px dashed var(--primary-color); 
    border-radius: 4px;
}

/* --- RESEÑAS (reseñas.html) --- */
#reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); 
    gap: 25px;
    padding: 20px 0;
}

.review-card {
    padding: 30px;
    border-radius: 8px;
    border-top: 5px solid var(--accent-color); 
}

/* =================================================== */
/* --- 7. MEDIA QUERIES PARA RESPONSIVIDAD MÓVIL (MAX-WIDTH: 768px) --- */
/* =================================================== */

@media (max-width: 900px) {
    /* Ajustes para tabletas y escritorios pequeños */
    #hero-original {
        flex-direction: column;
        padding: 40px 0;
        text-align: center;
    }
    .hero-text-content { order: 2; }
    .hero-image-container { order: 1; margin-bottom: 30px; }
    .hero-actions { justify-content: center; }
    #featured-services { flex-direction: column; gap: 25px; }
}


@media (max-width: 768px) {
    
    /* A. Encabezado y Navegación */
    header {
        padding: 15px 3%;
        flex-wrap: wrap; 
    }
    
    .theme-toggle { order: 2; margin-right: 15px; }
    .menu-toggle { display: block; order: 3; }
    
    /* Menú Desplegable Móvil */
    #nav-menu {
        display: none; 
        position: absolute;
        top: 100%; 
        left: 0;
        width: 100%;
        background: var(--surface-color);
        box-shadow: 0 4px 6px var(--shadow-color);
        z-index: 100; 
    }
    
    #nav-menu.active { display: block; }
    #nav-menu ul { flex-direction: column; padding: 10px 0; }
    #nav-menu ul li { margin: 0; border-bottom: 1px solid var(--background-color); }
    #nav-menu ul li a { display: block; padding: 10px 5%; }
    nav ul li a:after { content: none; }

    /* B. Contenido General */
    main { padding: 15px 10px; }
    
    /* C. Sección Key Stats (Tarjetas sobre Fondo Sutil) */
    #key-stats {
        flex-direction: column; 
        padding: 20px 3%;
        margin: 20px auto;
        box-shadow: none; 
        background-color: rgba(26, 75, 125, 0.08); 
        gap: 15px; 
    }

    body.dark-mode #key-stats {
        background-color: rgba(118, 215, 196, 0.08); 
    }

    .stat-item {
        width: 100%;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 8px var(--shadow-color);
        border-left: 5px solid var(--accent-color); 
        border-right: none; 
        background-color: var(--surface-color); 
    }
    
    .stat-number {
        color: var(--primary-color); 
        font-size: 2.2em;
    }

    .stat-item p {
        color: var(--text-color); 
    }

    /* D. Grids */
    #photo-grid, #service-list, #reviews-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* E. Footer */
    footer {
        padding: 15px 3%;
    }
}