/* =========================================
   VARIABLES Y RESET GLOBAL
========================================== */
:root {
    /* Paleta de Colores Corporativa */
    --primary-color: #E60000; /* Rojo Intenso */
    --primary-dark: #cc0000;  /* Rojo más oscuro para hover */
    --text-dark: #1a1a1a;
    --text-body: #555555;
    --bg-light: #f9f9f9;
    --white: #ffffff;
    
    /* Tipografías */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Roboto', sans-serif;
    
    /* Medidas */
    --section-padding: 80px 0;
    --container-width: 1140px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-body);
    background-color: var(--white);
    /* Previene desplazamiento horizontal indeseado en móviles */
    overflow-x: hidden; 
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Clases de Utilidad */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.section-padding {
    padding: var(--section-padding);
}

.bg-light {
    background-color: var(--bg-light);
}

.color-accent {
    color: var(--primary-color);
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.section-title p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    border: 2px solid transparent;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--white);
    color: var(--white);
}

.btn-outline:hover {
    background-color: var(--white);
    color: var(--text-dark);
}

/* =========================================
   HEADER & NAV (MODIFICADO)
========================================== */
.navbar {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    height: 110px; /* Altura aumentada para escritorio */
    display: flex;
    align-items: center;
    transition: height 0.3s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    /* CRÍTICO: Evita que los elementos se vayan a otra línea */
    flex-wrap: nowrap; 
}

/* Contenedor del Logo + Texto */
.logo {
    /* Permite que el contenedor del logo se encoja si falta espacio */
    flex: 1; 
    min-width: 0; 
    margin-right: 15px;
}

.logo a {
    display: flex;
    align-items: center;
    /* gap: 15px;  <-- ELIMINADO para compatibilidad Safari antiguo */
    text-decoration: none;
}

/* Imagen del Logo (Desktop) */
.nav-logo-img {
    height: 120px; /* Tamaño grande para PC */
    width: auto;
    object-fit: contain;
    flex-shrink: 0; 
    margin-right: 15px; /* REEMPLAZO DE GAP para Safari */
}

/* Texto del Logo */
.logo h1 {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    /* Intenta mantener una línea en escritorio */
    white-space: nowrap; 
}

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

.nav-links a {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links .btn-nav {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 8px 20px;
    border-radius: 4px;
}

.nav-links .btn-nav:hover {
    background-color: var(--primary-dark);
    color: var(--white);
}

/* Botón Hamburguesa */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dark);
    /* CRÍTICO: El botón nunca debe encogerse ni desaparecer */
    flex-shrink: 0; 
}

/* =========================================
   HERO SECTION
========================================== */
.hero {
    height: 90vh; 
    background-image: url('../images/fondo.png');
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 80px; 
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.hero-content {
    position: relative;
    z-index: 2;
    color: var(--white);
    /* MODIFICACIÓN CLAVE AQUÍ */
    max-width: 100%; /* Antes era 800px. Ahora ocupa todo el ancho disponible */
}

.hero-content h1 {
    color: var(--white);
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 30px;
    color: #f0f0f0;
    justify-content: center;
}

.hero-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* =========================================
   SERVICIOS
========================================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--white);
    padding: 40px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    text-align: center;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.service-card:hover {
    transform: translateY(-10px);
    border-bottom: 3px solid var(--primary-color);
}

.icon-box {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.service-card h3 {
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.service-card ul {
    text-align: left;
    margin-top: 20px;
}

.service-card ul li {
    margin-bottom: 10px;
    color: var(--text-body);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
}

.service-card ul li i {
    color: var(--primary-color);
    margin-right: 10px;
    margin-top: 4px;
    min-width: 15px;
}

/* =========================================
   PRODUCTOS (GALERÍA)
========================================== */
.filters-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 2px solid #ddd;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-body);
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--white);
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transform: translateY(-5px);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover; 
    background-color: #f4f4f4;
}

.product-info {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    justify-content: space-between;
}

.product-info h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.product-info .btn-sm {
    background-color: var(--text-dark);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 15px;
}

.product-info .btn-sm:hover {
    background-color: var(--primary-color);
}

.load-more-container .btn-outline {
    border: 2px solid #ddd;
    color: var(--text-dark);
    transition: var(--transition);
}

.load-more-container .btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}

/* =========================================
   MARCAS (BRAND GRID)
========================================== */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 40px;
    align-items: center;
    justify-items: center;
    padding: 20px 0;
}

.brand-grid img {
    max-width: 100%;
    max-height: 80px; 
    width: auto;
    /* Eliminados los filtros de gris para que se vea a color siempre */
    transition: all 0.4s ease;
    cursor: pointer;
}

.brand-grid img:hover {
    transform: scale(1.1); 
}

/* =========================================
   FEATURES / POR QUÉ ELEGIRNOS
========================================== */
.features-section {
    background-color: var(--text-dark);
    color: var(--white);
    padding: 60px 0;
}

.features-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: center;
}

.feature-item i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.feature-item h4 {
    color: var(--white);
    margin-bottom: 10px;
}

.feature-item p {
    color: #ccc;
    font-size: 0.9rem;
}

/* =========================================
   RESEÑAS
========================================== */
.review-placeholder-card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.btn-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
}

/* =========================================
   FOOTER & CONTACTO
========================================== */
footer {
    background-color: #111;
    color: #ccc;
    padding-top: 70px;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 50px;
    padding-bottom: 50px;
}

.footer-col {
    min-width: 300px;
}

.footer-col h3 {
    color: var(--white);
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 10px;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 2px;
    background-color: var(--primary-color);
}

.contact-info li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.contact-info i {
    color: var(--primary-color);
    margin-right: 15px;
    margin-top: 5px;
}

.contact-form input, 
.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: #222;
    border: 1px solid #333;
    color: var(--white);
    border-radius: 4px;
    font-family: inherit;
}

.contact-form input:focus, 
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.footer-bottom {
    background-color: #000;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    border-top: 1px solid #222;
}

/* Corrección Mapa: Ajuste para que el iframe ocupe todo */
.map-container {
    background: #222;
    overflow: hidden;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* =========================================
   MODAL (POPUP PRODUCTOS)
========================================== */
.modal {
    display: none; 
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex; 
}

.modal-content {
    background-color: var(--white);
    width: 100%;
    max-width: 900px; 
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    animation: slideDown 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    display: flex;
    flex-direction: row;
    padding: 0;
    overflow-y: auto; 
}

.modal-media-col {
    width: 50%;
    background-color: #f4f4f4;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #eee;
}

.img-wrapper {
    width: 100%;
    max-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.modal-media-col img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 4px;
}

.modal-info-col {
    width: 50%;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.modal-info-col h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--text-dark);
}

.btn-whatsapp {
    background-color: #25D366; 
    color: white;
    text-align: center;
    width: 100%;
    padding: 12px;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
}

@keyframes slideDown {
    from {transform: translateY(-50px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

/* =========================================
   FIX RESPONSIVO DEFINITIVO (MÓVIL / TABLET)
========================================== */
@media (max-width: 768px) {
    /* 1. Navbar elástica: Crece si el texto ocupa 2 líneas */
    .navbar {
        height: auto !important; 
        min-height: 70px;
        padding: 10px 0;
    }

    /* 2. Contenedor blindado: PROHIBIDO bajar de línea */
    .navbar .container {
        display: flex !important;
        flex-wrap: nowrap !important; /* Clave: Mantiene todo en una fila */
        align-items: center;
        justify-content: space-between;
        gap: 8px; /* Espacio mínimo vital */
    }

    /* 3. El Logo cede espacio: Se encoge para que quepa el botón */
    .logo {
        flex: 1; /* Toma el espacio disponible */
        min-width: 0; /* TRUCO MAGICO: Permite que el texto largo se comprima */
        margin-right: 5px;
    }

    .logo a {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    /* Imagen: Tamaño fijo, nunca se aplasta */
    .nav-logo-img {
        height: 35px !important;
        width: auto;
        flex-shrink: 0; 
        margin-right: 5px !important; /* Ajuste para móvil */
    }

    /* Texto: Letra pequeña y saltos de línea permitidos */
    .logo h1 {
        font-size: 11px !important; /* Tamaño seguro para móviles */
        line-height: 1.2;
        white-space: normal !important; /* Permite 2 líneas si es necesario */
        text-align: left;
        /* Limita a 2 líneas para que no se vea enorme */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* 4. Botón Menú: Intocable, siempre a la derecha */
    .menu-toggle {
        display: block !important;
        flex-shrink: 0 !important; /* Prohibido encogerse */
        font-size: 1.6rem;
        width: 30px; 
        text-align: right;
        color: var(--text-dark);
    }

    /* 5. Ajustes del Menú Desplegable */
    .nav-links {
        top: 100%; /* Se pega justo debajo del header, mida lo que mida */
        position: absolute;
        left: 0;
        width: 100%;
        background-color: var(--white);
        flex-direction: column;
        padding: 20px 0;
        border-top: 1px solid #eee;
        display: none;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }
    .nav-links.active { display: flex; }

    /* 6. Ajustes Generales para Móvil */
    .hero { margin-top: 80px; } /* Evita que el header tape el hero */
    .hero-content h1 { font-size: 1.8rem; }
    .hero-btns { flex-direction: column; }
    .btn { width: 100%; margin-bottom: 10px; }
    
    /* Grillas a 1 sola columna para que no se rompan */
    .services-grid, .products-grid { grid-template-columns: 1fr; }
    /* Logos de marcas: 2 por fila */
    .brand-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    
    /* Footer y Modal apilados */
    .footer-content, .modal-body { flex-direction: column; }
    .modal-media-col, .modal-info-col { width: 100%; padding: 20px; border: none; }
    .footer-col { width: 100%; }
}