/* =========================================
   1. VARIABLES DE COLOR Y TIPOGRAFÍA (GRUPO IGNIS)
   ========================================= */
:root {
    /* Paleta Ignis */
    --rojo-ignis: #3d2a2a;
    --morado-ignis: #29213a;
    --tierra-ignis: #725e4c;
    --blanco-ignis: #ededed;
    --header-social: #663e3e;
    
    /* Textos Main */
    --text-equivoca: #b58383;
    --text-corregimos: #f8f4dd;

    /* Tipografías */
    --font-black: Arial, Helvetica, sans-serif;
    --font-white: "Ebrima", sans-serif;

    /* Variables extraídas para el detalles.html (modo premium) */
    --fondo-oscuro: #0d0d0d;
    --seccion-oscura: #1a1a1a;
    --dorado-ignis: #b69d74;
}

/* =========================================
   2. RESETEO Y BASE
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; /* Desplazamiento suave para todas las anclas */
}

body {
    font-family: var(--font-black); 
    background-color: var(--blanco-ignis);
    color: #000;
    overflow-x: hidden; /* Evita cualquier scroll horizontal accidental */
}

/* Clases utilitarias */
.text-white-section {
    font-family: var(--font-white);
    color: var(--blanco-ignis);
}

.section-title, .section-title-white {
    font-family: var(--font-black);
    margin-bottom: 20px;
    font-size: clamp(1.8rem, 5vw, 2.5rem); /* Texto fluido */
}

.section-title { color: #000; }
.section-title-white { color: var(--blanco-ignis); }

/* --- BARRA DE PROGRESO DE LECTURA --- */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--text-equivoca);
    z-index: 1001; /* Por encima del header */
    transition: width 0.1s ease;
}

/* =========================================
   3. NAVEGACIÓN Y HEADERS
   ========================================= */
/* --- HEADER PEGAJOSO (STICKY) --- */
.top-header {
    background-color: var(--tierra-ignis);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 50px;
    color: var(--blanco-ignis);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.4s ease;
}

/* Clase que se activará con JS al bajar */
.top-header.scrolled {
    padding: 8px 50px;
    background-color: var(--rojo-ignis);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    color: var(--blanco-ignis);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #ccc;
}

.lang-btn {
    font-weight: bold;
    border-left: 1px solid rgba(255,255,255,0.3);
    padding-left: 20px;
}

.social-header {
    background-color: var(--header-social);
    padding: 12px 20px;
    color: var(--blanco-ignis);
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    text-align: center;
}

.social-icons-container {
    display: flex;
    gap: 15px;
    align-items: center;
}

.social-icon {
    height: 20px;
    width: auto;
    display: block;
    transition: transform 0.2s ease;
}

.social-link:hover .social-icon {
    transform: scale(1.2);
}

/* =========================================
   4. SECCIÓN HERO (Inicio)
   ========================================= */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.71), rgba(0, 0, 0, 0.71)), url('assets/fondo-maquina.jpg');
    background-size: cover;
    background-position: center;
    height: 80vh;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
}

.hero-title h1 {
    font-size: clamp(2rem, 8vw, 4.5rem) !important; /* Se ajusta entre 2rem y 4.5rem */
    line-height: 1.1;
    color: var(--blanco-ignis);
}

.hero-title .equivoca { color: var(--text-equivoca); }
.hero-title .corregimos { color: var(--text-corregimos); }

.hero-subtitle {
    margin-top: 20px;
    font-size: clamp(1rem, 3vw, 1.2rem);
    max-width: 600px;
    line-height: 1.5;
}

/* --- BOTONES DEL HERO --- */
.hero-btns {
    display: flex;
    gap: 15px;
    margin-top: 35px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-hero, .btn-hero-outline {
    display: inline-block;
    padding: 15px 40px;
    font-weight: bold;
    border-radius: 5px;
    text-decoration: none;
    transition: 0.3s;
    text-align: center;
}

.btn-hero {
    background-color: #ffffff;
    color: #000000;
}

.btn-hero-outline {
    border: 2px solid #fff;
    color: #fff;
}

.btn-hero:hover, .btn-hero-outline:hover {
    background-color: var(--tierra-ignis);
    color: var(--blanco-ignis);
    transform: translateY(-3px);
}

/* =========================================
   5. SECCIÓN SERVICIOS
   ========================================= */
.servicios {
    background-image: url('assets/fondo-nubes.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 60px 20px;
    text-align: center;
}

.grid-servicios {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px;
    margin-top: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.tarjeta-servicio {
    position: relative;
    height: 350px;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Conexión de imágenes de fondo para las tarjetas (Reemplaza los inline styles) */
.card-traffic { background-image: url('assets/fondo-trafico.png'); }
.card-water { background-image: url('assets/fondo-agua.jpg'); }
.card-business { background-image: url('assets/fondo-negocios.jpg'); }
.card-government { background-image: url('assets/fondo-gobierno.png'); }

.tarjeta-servicio:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.tarjeta-servicio:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.tarjeta-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.tarjeta-contenido {
    position: relative;
    z-index: 2;
    padding: 20px;
    color: var(--blanco-ignis);
}

.btn-ver-mas {
    display: inline-block;
    background-color: var(--morado-ignis);
    color: var(--blanco-ignis);
    padding: 10px 20px;
    text-decoration: none;
    margin-top: 15px;
    transition: background 0.3s ease;
    position: relative; 
    z-index: 3;
}

.btn-ver-mas:hover {
    background-color: var(--rojo-ignis);
}

.bottom-bar {
    background-color: var(--tierra-ignis);
    height: 15px;
    width: 100%;
    position: absolute;
    bottom: 0; left: 0;
    z-index: 2;
}

/* =========================================
   6. TRACKER IGNIS (Monitoreo)
   ========================================= */
.tracker-section {
    padding: 60px 20px;
    text-align: center;
    background-color: #f9f9f9;
}

.tracker-subtitle {
    margin-bottom: 20px;
}

.search-box {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tracker-input {
    padding: 12px;
    width: 100%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px; /* Evita zoom en iOS */
}

.btn-tracker {
    padding: 12px 25px;
    background-color: var(--tierra-ignis);
    color: var(--blanco-ignis);
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s ease;
    font-size: 16px;
    font-weight: bold;
}

.btn-tracker:hover {
    background-color: var(--rojo-ignis);
}

.tracker-msg, .tracker-error {
    margin-top: 15px;
    font-weight: bold;
}
.tracker-msg { color: var(--tierra-ignis); }
.tracker-error { color: red; }

.tracker-result-box {
    margin-top: 30px;
    padding: 30px 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ccc;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.tracker-estatus {
    color: var(--rojo-ignis);
    margin: 15px 0;
    font-size: 1.5rem;
}

.tracker-fecha {
    font-size: 0.85rem;
    color: gray;
    margin-bottom: 25px;
}

.progress-container {
    margin-top: 20px;
    text-align: left;
}

.progress-track {
    width: 100%;
    background-color: #eee;
    height: 8px;
    border-radius: 5px;
    position: relative;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background-color: var(--morado-ignis);
    width: 0%;
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-marker {
    position: absolute;
    top: -12px;
    left: 0%;
    font-size: 1.2rem;
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.steps-container {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 13px;
}

/* Clases inyectadas por JS para los pasos del tracker */
.step-item {
    text-align: center;
    color: #999;
    flex: 1;
}

.step-item.active {
    color: var(--morado-ignis);
    font-weight: bold;
}

.step-item.current-pulse {
    animation: pulse-text 1.5s infinite;
}

.step-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #eee;
    margin: 0 auto 5px;
    line-height: 24px;
    font-size: 12px;
}

.step-item.active .step-circle {
    background-color: var(--morado-ignis);
    color: white;
}

@keyframes pulse-text {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* =========================================
   7. SECCIÓN CONTACTO Y FORMULARIO
   ========================================= */
.contacto-section {
    padding: 80px 20px;
    background-color: var(--tierra-ignis);
    color: var(--blanco-ignis);
    text-align: center;
}

.contacto-subtitle {
    margin-bottom: 40px;
}

.ignis-form {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ignis-form input,
.ignis-form select,
.ignis-form textarea {
    padding: 15px; /* Mayor área táctil para celular */
    border: none;
    border-radius: 6px;
    font-family: var(--font-black);
    font-size: 16px; /* Vital para que iOS no haga zoom auto */
    width: 100%;
}

.input-error {
    border: 2px solid #ff4d4d !important;
    background-color: #fff0f0 !important;
}

.btn-submit {
    padding: 18px;
    background-color: var(--morado-ignis);
    color: var(--blanco-ignis);
    border: none;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.3s ease;
    margin-top: 10px;
}

.btn-submit:hover {
    background-color: var(--rojo-ignis);
}

/* =========================================
   8. BOTONES FLOTANTES, POP-UP Y FOOTER
   ========================================= */
.escudo-flotante {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    cursor: pointer;
    z-index: 99;
    transition: transform 0.3s ease, filter 0.3s;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.escudo-flotante:hover {
    transform: scale(1.1);
}

/* --- WHATSAPP CON PULSO --- */
.whatsapp-flotante {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    cursor: pointer;
    z-index: 99;
    transition: transform 0.3s ease, filter 0.3s;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    animation: pulse-green 2s infinite;
    border-radius: 50%;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.whatsapp-flotante img {
    width: 100%;
    height: auto;
    display: block;
}

.whatsapp-flotante:hover {
    transform: scale(1.1);
}

/* --- BOTÓN VOLVER ARRIBA --- */
#backToTop {
    display: none; /* Se activa con JS */
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 98;
    background-color: var(--morado-ignis);
    color: white;
    border: none;
    
    /* EL TRUCO PARA QUE SEA UN CÍRCULO PERFECTO */
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    
    /* Centramos la flecha perfectamente en medio del círculo */
    display: flex;
    justify-content: center;
    align-items: center;
    
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#backToTop.visible {
    display: flex; /* Mantenemos el flexbox para que no se descentre al aparecer */
    animation: bounceIn 0.5s ease;
}

#backToTop:hover { 
    background-color: var(--tierra-ignis);
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

/* Una animación suave cuando aparece */
@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#backToTop.visible {
    display: block;
}

#backToTop:hover { background-color: var(--tierra-ignis); }

.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0; 
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.activo {
    opacity: 1;
    pointer-events: auto;
}

.modal-contenido {
    background-color: var(--blanco-ignis);
    padding: 40px 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    position: relative;
}

.modal-contenido h2 { color: var(--rojo-ignis); margin-top: 10px; }
.modal-contenido p { margin: 20px 0; line-height: 1.6; }

.cerrar-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 28px;
    cursor: pointer;
    font-weight: bold;
    color: var(--rojo-ignis);
}

.footer {
    background-color: var(--morado-ignis);
    color: var(--blanco-ignis);
    text-align: center;
    padding: 30px 20px;
    font-size: 0.9rem;
}

/* =========================================
   9. MEDIA QUERIES (MAGIA PARA IPHONE / CELULARES)
   ========================================= */
@media (max-width: 768px) {
    /* Header */
    .top-header {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Ajuste de Botones Flotantes para que no estorben */
    .escudo-flotante, .whatsapp-flotante {
        width: 50px;
        bottom: 20px;
    }
    .escudo-flotante { left: 20px; }
    .whatsapp-flotante { right: 20px; }

    /* EL TRUCO DEL TRACKER: Lista Vertical */
    .steps-container {
        flex-direction: column; /* Apila los elementos hacia abajo */
        gap: 15px;
        align-items: flex-start;
        padding-left: 10px;
    }
    
    /* Modifica los div que inserta el JS sin tocar el JS */
    .steps-container > div {
        display: flex !important; /* Fuerza flexbox */
        flex-direction: row !important;
        align-items: center;
        gap: 15px;
        text-align: left !important;
        width: 100%;
        font-size: 1.1rem; /* Texto más grande y legible */
    }

    /* Le da estilo al numerito (paso 1, 2, 3...) */
    .steps-container > div > div {
        background-color: rgba(0, 0, 0, 0.05);
        min-width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 0.9rem;
    }
}