/*
 * ---------------------------------------------------
 * TRANSPORTE UNIÓN SALAZAR - ESTILOS CSS PRINCIPALES
 * Versión 8.6 - correccion de scroll en servicios
 * ---------------------------------------------------
 * Contenido:
 * 0. Panel de Control de Diseño (Variables CSS)
 * 1. Estilos Generales y Base
 * 2. Estilos del Encabezado (Header)
 * 3. Estilos de la Navegación (Nav)
 * 4. Estilos de Contenido Específico
 * 5. Estilos del Carrusel de Imágenes
 * 6. Estilos del Botón Flotante (CTA)
 * 7. Estilos del Footer
 * 8. Clases de Utilidad y JavaScript
 * 9. Estilos del Modal de Cotización
 * 10. Estilos de Componentes Globales (Spinner)
 * ---------------------------------------------------
 */
/* ============================================== */
/* 0. PANEL DE CONTROL DE DISEÑO (VARIABLES CSS)  */
/* ============================================== */
:root {
    --color-primary: #1e3a8a;
    --color-primary-light: #284b63;
    --color-accent: #ea580c;
    --color-accent-hover: #d97706;
    --color-text-base: #333;
    --color-background: #f8f8f8;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-whatsapp: #25d366;
    --color-whatsapp-hover: #128c7e;
    --color-text-light: #ffffff;
    --color-link-footer: #facc15;
    --font-main: 'Open Sans', sans-serif;
    --font-headings: 'Montserrat', sans-serif;
    --header-height-mobile: 60px;
    --header-height-desktop: 80px;
}

/* ============================================== */
/* 1. ESTILOS GENERALES Y BASE                    */
/* ============================================== */
*, *::before, *::after {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height-mobile) + 20px);
}

@media (min-width: 992px) {
    html {
        scroll-padding-top: calc(var(--header-height-desktop) + 20px);
    }
}

body {
    font-family: var(--font-main);
    color: var(--color-text-base);
    background-color: var(--color-background);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    padding-top: var(--header-height-mobile);
}

@media (min-width: 992px) {
    body {
        padding-top: var(--header-height-desktop);
    }
}

body.modal-open {
    overflow: hidden;
}

main {
    padding-bottom: 50px;
}

section {
    background-color: var(--color-surface);
    padding: 30px;
    margin: 0 auto 30px auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 1100px;
}
@media (max-width: 1100px) {
    section {
        margin-left: 15px;
        margin-right: 15px;
    }
}

h2 {
    color: var(--color-text-base);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 0.5em;
    margin-bottom: 1em;
    margin-top: 0;
    font-size: 1.8em;
}
@media (min-width: 992px) {
    h2 {
        font-size: 2.2em;
    }
}
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: var(--color-accent);
}

/* ============================================== */
/* 2. ESTILOS DEL ENCABEZADO (HEADER)             */
/* ============================================== */
header {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: 0 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    height: var(--header-height-mobile);
}
@media (min-width: 992px) {
    header {
        padding: 0 2em;
        height: var(--header-height-desktop);
    }
}

.header-logo {
    max-height: 40px;
    width: auto;
}
@media (min-width: 992px) {
    .header-logo {
        max-height: 50px;
    }
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-button {
    background-color: var(--color-accent);
    color: var(--color-text-light);
    font-size: 0.8em;
    padding: 0.5em 1em;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease-in-out;
    white-space: nowrap;
}
.header-button:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
}

/* ============================================== */
/* 3. ESTILOS DE LA NAVEGACIÓN (NAV)              */
/* ============================================== */
.nav-toggle {
    background: transparent;
    color: var(--color-text-light);
    border: none;
    cursor: pointer;
    padding: 0.4em;
    font-size: 1.6em;
    z-index: 1002;
    display: block;
}
@media (min-width: 992px) {
    .nav-toggle {
        display: none !important;
    }
}

nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(30, 58, 138, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 999;
    visibility: hidden;
}
nav.show {
    transform: translateX(0);
    visibility: visible;
}
@media (min-width: 992px) {
    nav {
        position: static;
        height: auto;
        width: auto;
        background-color: transparent;
        transform: none;
        visibility: visible;
        margin-right: 20px;
    }
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}

nav li a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 1.2em;
    padding: 0.5em 1em;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}
nav li a:hover {
    background-color: var(--color-accent);
}

@media (min-width: 992px) {
    nav ul {
        flex-direction: row;
        gap: 1.2em;
    }

    nav li a {
        font-size: 1em;
        padding: 0.5em 0.7em;
        position: relative; 
        text-decoration: none;
        color: var(--color-text-light);
        transition: color 0.3s ease, transform 0.3s ease;
    }

    nav li a::after {
        content: '';
        position: absolute;
        width: 100%;
        height: 2px;
        background-color: var(--color-accent);
        bottom: -4px;
        left: 0;
        transform: scaleX(0);
        transform-origin: center;
        transition: transform 0.3s ease-out;
    }

    nav li a:hover {
        color: var(--color-link-footer);
        background-color: transparent;
        transform: translateY(-3px);
    }

    nav li a:hover::after {
        transform: scaleX(1);
    }
}

/* ============================================== */
/* 4. ESTILOS DE CONTENIDO ESPECÍFICO             */
/* ============================================== */


/* ===> ¡NUEVAS REGLAS AÑADIDAS AQUÍ! <=== */
#hero #slide-1 {
    background-image: url('../img/imageen2.jpg');
}

#sobre-nosotros {
    background-image: url('../img/sobre-nosotros.jpeg');
}

#compromiso-ambiental {
    background-image: url('../img/ambiental.jpeg');
}
/* ===> FIN DE LAS NUEVAS REGLAS <=== */
#sobre-nosotros, #compromiso-ambiental {
    max-width: none;
    padding: 0;
    position: relative;
    background-size: cover;
    background-position: center bottom;
    background-attachment: fixed;
    color: var(--color-text-light);
    text-align: center;
}
#sobre-nosotros::before, #compromiso-ambiental::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
    z-index: 1;
}
.about-content-overlay, .environmental-content-overlay {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
}
#sobre-nosotros h2, #compromiso-ambiental h2 {
    color: var(--color-text-light);
    border-bottom-color: var(--color-accent);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}
#sobre-nosotros p, #compromiso-ambiental p {
    font-size: 1.1em;
    line-height: 1.8;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}
.about-cta-button {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 25px;
    background-color: var(--color-accent);
    color: var(--color-text-light);
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.about-cta-button:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
    color: var(--color-text-light);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}
.service-item {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.4s ease;
}
.service-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.service-item i {
    font-size: 2.5em;
    color: var(--color-primary);
    margin-bottom: 15px;
    transition: color 0.3s ease;
}
.service-item:hover i {
    color: var(--color-accent);
}
.service-item h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-family: var(--font-headings);
}
.service-details {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 25px;
    background-color: var(--color-surface);
    transform: translateY(100%);
    transition: opacity 0.4s ease, transform 0.4s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.service-item.expanded {
    grid-column: 1 / -1;
    min-height: 300px;
    cursor: default;
    transform: translateY(0);
}
.service-item.expanded .service-preview {
    opacity: 0;
    transform: translateY(-100%);
}
.service-item.expanded .service-details {
    opacity: 1;
    transform: translateY(0);
}
.services-grid.expanded {
    /* ***** CAMBIO IMPORTANTE AQUÍ ***** */
    /* Le damos una altura mínima al contenedor para evitar que la página salte */
    min-height: 350px;
    align-content: start;
}
.services-grid.expanded .service-item:not(.expanded) {
    opacity: 0.2;
    pointer-events: none;
    transform: scale(0.95);
}
.close-service {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 2em;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 10;
}
.close-service:hover {
    color: var(--color-text-base);
}

/* ============================================== */
/* 5. ESTILOS DEL CARRUSEL DE IMÁGENES            */
/* ============================================== */
#hero {
    padding: 0;
    margin: 0;
    width: 100%;
    height: calc(100vh - var(--header-height-mobile));
    background-color: var(--color-background);
    max-width: none;
    margin-bottom: 30px;
}
@media (min-width: 992px) {
    #hero {
        height: calc(100vh - var(--header-height-desktop));
    }
}
.carousel-container { position: relative; width: 100%; height: 100%; overflow: hidden; }
.carousel-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.7s ease-in-out; background-size: cover; background-position: center; }
.carousel-slide.active { opacity: 1; }

.slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 80px 40px 40px 40px;
    color: var(--color-text-light);
    z-index: 5;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 10%, transparent 100%);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transition-delay: 0.4s;
}
.carousel-slide.active .slide-content {
    opacity: 1;
    transform: translateY(0);
}
@media (min-width: 768px) { 
    .slide-content { 
        width: 60%;
        max-width: 700px;
        left: 40px;
        bottom: 40px;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.85) 20%, transparent 100%);
        padding: 40px;
        border-radius: 0;
    } 
}
.slide-content h3 {
    font-family: var(--font-headings);
    font-size: clamp(1.8em, 4vw, 3em);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    margin-top: 0;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.slide-content p {
    font-size: clamp(1em, 2.5vw, 1.2em);
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    max-width: 600px;
}

.carousel-navigation { position: absolute; top: 50%; width: 100%; transform: translateY(-50%); display: flex; justify-content: space-between; padding: 0 15px; z-index: 10; }
.carousel-navigation button { background-color: rgba(0, 0, 0, 0.4); color: var(--color-text-light); padding: 10px 15px; border: none; border-radius: 50%; cursor: pointer; font-size: 1.5em; transition: background-color 0.3s ease; }
.carousel-navigation button:hover { background-color: rgba(0, 0, 0, 0.7); }
.carousel-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; gap: 12px; }
.carousel-dots .dot { width: 12px; height: 12px; background-color: rgba(255, 255, 255, 0.6); border-radius: 50%; cursor: pointer; transition: background-color 0.3s ease; }
.carousel-dots .dot.active { background-color: var(--color-accent); }

@media (min-width: 992px) {
    .carousel-slide.bg-pos-bottom {
        background-position: center 75%;
    }
}

/* ============================================== */
/* 6. ESTILOS DEL BOTÓN FLOTANTE (CTA)            */
/* ============================================== */
.floating-cta-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040; 
    background-color: var(--color-accent);
    color: var(--color-text-light);
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, background-color 0.3s ease;
    animation: float-animation 3s ease-in-out infinite;
}
.floating-cta-button:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-5px);
    animation-play-state: paused;
}
@keyframes float-animation {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}
@media (max-width: 767px) {
    .floating-cta-button span {
        display: none;
    }
    .floating-cta-button {
        width: 50px;
        height: 50px;
        justify-content: center;
        padding: 0;
        font-size: 1.2em;
    }
}

/* ============================================== */
/* 7. ESTILOS DEL FOOTER                          */
/* ============================================== */
#site-footer { background-color: var(--color-primary); color: rgba(255, 255, 255, 0.8); padding: 40px 20px; }
.footer-container { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 30px; text-align: center; }
@media (min-width: 768px) { .footer-container { grid-template-columns: repeat(3, 1fr); text-align: left; } }
.footer-column h4 { color: var(--color-text-light); font-family: var(--font-headings); margin-bottom: 15px; border-bottom: 2px solid var(--color-accent); padding-bottom: 10px; display: inline-block; }
.footer-logo { max-width: 200px; margin-bottom: 15px; }
@media (max-width: 767px) { .footer-logo { margin-left: auto; margin-right: auto; } }
.footer-column ul { list-style: none; padding: 0; margin: 0; }
.footer-column ul li { margin-bottom: 10px; }
.footer-column ul a {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s ease, padding-left 0.3s ease;
}
.footer-column ul a:hover {
    color: var(--color-link-footer);
    padding-left: 5px;
}
.contact-info-list i { color: var(--color-accent); margin-right: 10px; width: 20px; text-align: center; }
.footer-bottom { max-width: 1200px; margin: 40px auto 0; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.2); display: flex; flex-direction: column; align-items: center; gap: 20px; }
@media (min-width: 768px) { .footer-bottom { flex-direction: row; justify-content: space-between; } }
.logos-laboratorios { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 15px; }
.logos-laboratorios img { height: 35px; opacity: 0.7; transition: opacity 0.3s ease; }
.logos-laboratorios img:hover { opacity: 1; }

/* ============================================== */
/* 8. CLASES DE UTILIDAD Y JAVASCRIPT             */
/* ============================================== */
.hidden { display: none !important; }

/* ============================================== */
/* 9. ESTILOS DEL MODAL DE COTIZACIÓN             */
/* ============================================== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); z-index: 1050; display: flex; justify-content: center; align-items: center; padding: 20px; opacity: 0; transition: opacity 0.3s ease; visibility: hidden; }
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal-content { background-color: var(--color-surface); padding: 25px; border-radius: 10px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); position: relative; width: 100%; max-width: 550px; max-height: 90vh; overflow-y: auto; transform: scale(0.9); transition: transform 0.3s ease; text-align: center;}
.modal-overlay:not(.hidden) .modal-content { transform: scale(1); }
.close-button { position: absolute; top: 10px; right: 15px; background: transparent; border: none; font-size: 2.5em; color: #aaa; cursor: pointer; line-height: 1; padding: 0; transition: color 0.2s ease; }
.close-button:hover { color: var(--color-text-base); }

.modal-content h2 {
    font-family: var(--font-headings);
    font-size: 1.8em;
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: 8px;
    border-bottom: none;
}
.modal-content p {
    margin-top: 0;
    margin-bottom: 25px;
    color: #666;
}
#contact-form {
    text-align: left;
}
#contact-form .form-group {
    margin-bottom: 18px;
}
#contact-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
}
#contact-form input,
#contact-form select,
#contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1em;
    font-family: var(--font-main);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#contact-form input:focus,
#contact-form select:focus,
#contact-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.2);
}
#contact-form button {
    width: 100%;
    padding: 14px;
    background-color: var(--color-accent);
    color: var(--color-text-light);
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
#contact-form button:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
}
#contact-form button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ============================================== */
/* 10. ESTILOS DE COMPONENTES GLOBALES (Spinner)  */
/* ============================================== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.spinner-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}
.spinner i {
    font-size: 3.5rem;
    color: var(--color-primary);
}
