/* ==========================================================================
   1. VARIABLES Y BASE (Identidad Entre Valles)
   ========================================================================== */
:root {
    --azul-ev: #005689;       /* Azul oficial del logo */
    --azul-oscuro: #003d61;
    --gris-oscuro: #333333;   /* Color para textos */
    --gris-suave: #f8f9fa;    /* Fondos ligeros */
    --blanco: #ffffff;
    --transicion: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --sombra-elegante: 0 20px 40px rgba(0, 0, 0, 0.08);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--gris-oscuro);
    background-color: var(--blanco);
    overflow-x: hidden;
}

/* ==========================================================================
   2. PRELOADER
   ========================================================================== */
#preloader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--blanco);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.loader-bus {
    width: 180px;
    animation: busDrive 2s infinite ease-in-out;
}

@keyframes busDrive {
    0% { transform: translateX(-30px); opacity: 0.7; }
    50% { transform: translateX(30px); opacity: 1; }
    100% { transform: translateX(-30px); opacity: 0.7; }
}

/* ==========================================================================
   3. NAVEGACIÓN (PC: CLAVADA / MÓVIL: LIBRE)
   ========================================================================= */
header {
    background: var(--blanco);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 900;
    position: relative; /* Desclavado por defecto */
}

/* REGLA MAESTRA: Solo se clava en pantallas de PC */
@media (min-width: 851px) {
    header {
        position: sticky;
        top: 0;
    }
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    min-height: 80px;
}

.logo img {
    height: 60px;
    width: auto;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--azul-ev);
    font-weight: 600;
    transition: var(--transicion);
}

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

.btn-nav {
    background: var(--azul-ev);
    color: var(--blanco) !important;
    padding: 10px 25px;
    border-radius: 50px;
    cursor: pointer;
    border: none;
}

/* ==========================================================================
   4. HERO SLIDER
   ========================================================================== */
.hero-slider {
    position: relative;
    width: 100%;
    height: 70vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.slider-wrapper {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

.slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.slide.active { opacity: 1; }

.hero-content {
    position: relative;
    z-index: 10;
    color: var(--blanco);
    text-align: center;
}

.hero-content h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    text-shadow: 3px 3px 15px rgba(0,0,0,0.7);
    text-transform: uppercase;
}

.hero-content p {
    margin-top: 14px;
    font-size: clamp(1.05rem, 2vw, 1.7rem);
    text-shadow: 2px 2px 12px rgba(0,0,0,0.65);
}

.hero-content h1,
.hero-content p {
    transition: opacity .35s ease, transform .35s ease;
}

.hero-text-in {
    opacity: 1;
    transform: translateY(0);
}

.hero-text-out {
    opacity: 0;
    transform: translateY(24px);
}


/* ==========================================================================
   5. SECCIÓN QUIÉNES SOMOS
   ========================================================================== */
#nosotros-info {
    position: relative;
    background-image: linear-gradient(rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.94)), 
                      url('../img/breadcrumb_bg.jpg');
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

.quienes-somos-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    color: var(--azul-ev) !important;
    text-transform: uppercase;
    font-weight: 700;
}

.title-divider {
    width: 80px;
    height: 4px;
    background: var(--azul-ev);
    margin: 15px auto;
    border-radius: 10px;
}

.lead-text {
    max-width: 850px;
    margin: 0 auto;
    font-size: 1.25rem;
    color: var(--gris-oscuro);
    line-height: 1.8;
}

.mision-vision-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding-top: 20px;
}

.mv-card {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 45px;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0, 86, 137, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: var(--transicion);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mv-card:hover {
    transform: translateY(-12px);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 30px 60px rgba(0, 86, 137, 0.15);
    border-color: var(--azul-ev);
}

.mv-icon {
    width: 90px;
    height: 90px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blanco);
    border-radius: 50%;
    padding: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    transition: var(--transicion);
}

.mv-card:hover .mv-icon {
    background: #eaf4fb;
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 12px 26px rgba(0, 86, 137, 0.18);
}

.mv-icon img {
    width: 100%;
    transition: var(--transicion);
}

.mv-card:hover .mv-icon img {
    filter: none;
    transform: scale(1.05);
}

.mv-text h3 {
    color: var(--azul-ev) !important;
    font-size: 1.6rem;
    margin-bottom: 20px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.mv-text p {
    color: #444;
    font-size: 1.05rem;
    line-height: 1.8;
}

/* ==========================================================================
   6. SECCIÓN SERVICIOS
   ========================================================================== */

#servicios .text-center,
#servicios .section-title,
#servicios .lead-text {
    text-align: center;
}


.section-header-center,
#flota,
#trayectoria .text-center,
#trayectoria .section-title,
#trayectoria .lead-text,
#responsabilidad .text-center,
#responsabilidad .section-title,
#responsabilidad .lead-text,
#contacto .text-center,
#contacto .section-title,
#contacto .lead-text {
    text-align: center;
}

#flota .section-title {
    text-align: center;
}

.servicios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.servicio-card {
    height: 350px;
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: var(--transicion);
}

.servicio-card:hover {
    transform: translateY(-10px) scale(1.02);
}

.servicio-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0, 86, 137, 0.9) 10%, rgba(0, 86, 137, 0.2) 100%);
    display: flex;
    align-items: flex-end;
    padding: 30px;
    transition: var(--transicion);
}

.servicio-card:hover .servicio-overlay {
    background: linear-gradient(to top, rgba(0, 86, 137, 0.95) 30%, rgba(0, 86, 137, 0.4) 100%);
}

.servicio-info h3 {
    color: var(--blanco);
    font-size: 1.8rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.servicio-info p {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    line-height: 1.4;
    transform: translateY(20px);
    opacity: 0;
    transition: var(--transicion);
}

.servicio-card:hover .servicio-info p {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   7. SECCIÓN CONTACTO / COTIZACIÓN
   ========================================================================== */
.contacto-bg {
    background: var(--gris-suave);
}

.contact-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 50px;
    box-shadow: 0 20px 50px rgba(0, 86, 137, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.5);
    max-width: 900px;
    margin: 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    color: var(--azul-ev);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--azul-ev);
    box-shadow: 0 0 0 4px rgba(0, 86, 137, 0.1);
}

.btn-enviar {
    background: var(--azul-ev);
    color: white;
    padding: 18px 50px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 10px 20px rgba(0, 86, 137, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.btn-enviar:hover {
    background: var(--azul-oscuro);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 86, 137, 0.3);
}

/* ==========================================================================
   8. VENTANA MODAL (Detalles de Contacto)
   ========================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--blanco);
    margin: 5vh auto;
    padding: 40px;
    width: 90%;
    max-width: 550px;
    border-radius: 30px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    animation: slideDown 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

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

.close-modal {
    position: absolute;
    right: 25px; top: 20px;
    font-size: 32px; color: var(--azul-ev);
    cursor: pointer;
    transition: var(--transicion);
}

.close-modal:hover { color: #ff4d4d; }

.modal-logo { max-width: 220px; display: block; margin: 0 auto 20px; }

.contact-item {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.contact-item i { color: #00aeef; font-size: 1.4rem; width: 25px; text-align: center; }
.contact-info strong { color: var(--azul-ev); display: block; font-size: 0.85rem; text-transform: uppercase; }

.social-icons-modal {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.social-icons-modal a {
    width: 45px; height: 45px;
    background: #00aeef;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transicion);
}

.social-icons-modal a:hover { transform: translateY(-5px); background: var(--azul-ev); }

/* ==========================================================================
   9. SECCIÓN FLOTA Y VALORES
   ========================================================================== */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.section-padding { padding: 80px 0; }
.pt-0 { padding-top: 0 !important; }

.img-full {
    width: 100%;
    height: auto;
    border-radius: 15px;
}

.flota-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--sombra-elegante);
    transition: var(--transicion);
}

.card:hover { transform: translateY(-8px); }

.card img {
    width: 100%; height: 260px;
    object-fit: cover;
}

.card-info {
    padding: 22px;
    text-align: center;
    background: var(--azul-ev);
    color: var(--blanco);
}

/* ==========================================================================
   10. FOOTER (PERFECCIONADO: LUMINOSO Y SIN BORDES)
   ========================================================================== */
footer {
    min-height: 400px;
    height: auto;
    background-size: cover;
    background-position: center;
    position: relative;
}

.footer-overlay {
    position: relative;
    width: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.85), rgba(240, 245, 250, 0.9));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.footer-logo {
    max-width: 280px;
    filter: none !important;
    margin-bottom: 25px;
    transition: var(--transicion);
}

.footer-logo:hover {
    transform: scale(1.05);
}

.footer-nav {
    margin: 20px 0;
    width: 100%;
    max-width: 900px;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 0;
}

.footer-links a {
    color: var(--azul-ev) !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--azul-oscuro) !important;
}

.footer-copyright {
    margin-top: 25px;
    font-size: 0.85rem;
    color: #555 !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-copyright img {
    height: 25px;
    filter: none !important;
}

/* ==========================================================================
   12. TRAYECTORIA Y RESPONSABILIDAD SOCIAL
   ========================================================================== */
.timeline-vertical {
    position: relative;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px 0;
}

.timeline-vertical::before {
    content: '';
    position: absolute; left: 50%;
    width: 2px; height: 100%;
    background: #e0e0e0; transform: translateX(-50%);
}

.timeline-item {
    display: flex; justify-content: space-between;
    align-items: flex-start; width: 100%;
    margin-bottom: 40px; position: relative;
}

.timeline-date {
    width: 45%; text-align: right;
    font-weight: 800; color: var(--azul-ev);
    font-size: 1.2rem; padding-top: 5px;
}

.timeline-content {
    width: 45%; background: var(--gris-suave);
    padding: 20px; border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.timeline-item:nth-child(even) { flex-direction: row-reverse; }
.timeline-item:nth-child(even) .timeline-date { text-align: left; }

.timeline-dot {
    position: absolute; left: 50%; top: 15px;
    width: 16px; height: 16px;
    background: var(--azul-ev); border-radius: 50%;
    transform: translateX(-50%); border: 3px solid #fff;
    box-shadow: 0 0 0 3px var(--azul-ev); z-index: 2;
}

.timeline-item.highlight .timeline-content { background: var(--azul-ev); color: #fff; }
.timeline-item.highlight .timeline-content p { color: #fff; }

.rs-card {
    background: #fff; border-radius: 20px;
    overflow: hidden; box-shadow: var(--sombra-elegante);
    max-width: 1000px; margin: 0 auto;
}

.rs-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; align-items: center; }
.rs-info { padding: 40px; background-color: #fcfcfc; }
.rs-info h3 { font-size: 1.8rem; margin-bottom: 20px; font-weight: 700; color: var(--azul-ev); }
.rs-list { list-style: none; padding: 0; }
.rs-list li { margin-bottom: 15px; font-size: 1.1rem; display: flex; align-items: center; gap: 12px; }
.rs-list li i { color: var(--azul-ev); }

/* ==========================================================================
   CORRECCIÓN MÓVIL (HAMBURGUESA Y AJUSTE DE IMAGEN)
   ========================================================================== */
.menu-toggle {
    display: none;
    font-size: 28px;
    color: var(--azul-ev);
    cursor: pointer;
}

@media (max-width: 850px) {
    .menu-toggle { display: block; }

    .nav-links {
        position: fixed;
        right: -100%;
        top: 0;
        width: 80%;
        height: 100vh;
        background: white;
        flex-direction: column !important;
        justify-content: center;
        box-shadow: -10px 0 30px rgba(0,0,0,0.2);
        transition: 0.4s ease-in-out;
        z-index: 1001;
        gap: 30px;
    }

    .nav-links.active { right: 0; }
    
    header { position: relative !important; top: auto !important; }
    
    /* REGLA MAESTRA: Bajamos la altura en móvil vertical para que el bus se vea completo lateralmente */
    .hero-slider { 
        height: 35vh !important; 
    }

    .ev-top-datetime.ev-board { transform: scale(0.99); margin: 6px auto !important; height: 30px !important; }

    .mision-vision-grid, .form-grid, .rs-grid { grid-template-columns: 1fr; }
    .timeline-vertical::before { left: 20px; }
    .timeline-item { flex-direction: column !important; padding-left: 50px; }
    .timeline-date { width: 100%; text-align: left !important; margin-bottom: 10px; }
    .timeline-content { width: 100%; }
    .timeline-dot { left: 20px; }
    
    .navbar { min-height: auto !important; padding: 2px 0 !important; }
    .navbar .logo img { height: 38px; }
}

@media (max-height: 500px) and (orientation: landscape) {
    header { position: relative !important; }
    .ev-top-datetime.ev-board { display: none !important; }
    /* En modo apaisado volvemos a dar altura porque hay espacio lateral suficiente */
    .hero-slider { 
        height: 85vh !important; 
    }
}

/* ==========================================================================
   11. CONTINUIDAD VISUAL ENTRE SECCIONES: FOTO → LOGO → FOOTER
   ========================================================================== */
html, body {
    background-color: #eef2f6;
}

body {
    background: #eef2f6;
}

/* Primer tramo: se mantiene la foto del bus */
#nosotros-info {
    background-image: linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.90)), url('../img/breadcrumb_bg.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
}

/* Tramo medio: usamos el logo completo para que se lea entero */
#servicios,
section.container.section-padding.pt-0,
#flota,
#trayectoria,
#responsabilidad,
#contacto {
    background-image: linear-gradient(rgba(245, 247, 250, 0.94), rgba(245, 247, 250, 0.94)), url('../img/gevalles.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: min(92vw, 1400px) auto;
    background-attachment: scroll;
    background-color: #eef2f6 !important;
}

footer {
    background-position: center center !important;
    background-size: cover !important;
}

.contacto-bg {
    background-color: transparent !important;
}

@media (max-width: 991px) {
    #nosotros-info {
        background-attachment: scroll;
        background-position: center top;
    }

    #servicios,
    section.container.section-padding.pt-0,
    #flota,
    #trayectoria,
    #responsabilidad,
    #contacto {
        background-size: 94vw auto;
        background-position: center center;
    }
}
/* === Fondos alternados clavados restaurados: foto → logo → foto → logo === */

/* 1) Bloques con fondo clavado */
#nosotros-info,
#servicios,
section.container.section-padding.pt-0,
#flota,
#trayectoria,
#responsabilidad,
#contacto,
footer {
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
}

/* 2) Foto de bus clavada */
#nosotros-info {
    background-image:
        linear-gradient(rgba(245,247,250,.84), rgba(245,247,250,.88)),
        url('../img/slider-1.webp');
    background-size: cover, cover;
}

section.container.section-padding.pt-0 {
    background-image:
        linear-gradient(rgba(245,247,250,.84), rgba(245,247,250,.88)),
        url('../img/slider-5.webp');
    background-size: cover, cover;
}

#trayectoria {
    background-image:
        linear-gradient(rgba(245,247,250,.84), rgba(245,247,250,.88)),
        url('../img/slider-7.webp');
    background-size: cover, cover;
}

#contacto {
    background-image:
        linear-gradient(rgba(245,247,250,.84), rgba(245,247,250,.88)),
        url('../img/slider-3.webp');
    background-size: cover, cover;
}

/* 3) Logo clavado entre foto y foto */
#servicios,
#flota,
#responsabilidad {
    background-image:
        linear-gradient(rgba(245,247,250,.80), rgba(245,247,250,.84)),
        url('../img/logo-bg-gray-hires.png');
    background-size: auto, min(90vw, 1650px) auto;
    background-position: center center, center center;
}

/* 4) Footer con su fondo propio, centrado y estable */
footer {
    min-height: 285px;
    height: auto;
    position: relative;
    overflow: hidden;
    background-image:
        linear-gradient(rgba(245,247,250,.84), rgba(245,247,250,.90)),
        url('../img/footerbanner.jpg') !important;
    background-size: cover, min(100vw, 1920px) auto !important;
    background-position: center center, center bottom !important;
}

.footer-overlay {
    position: relative;
    width: 100%;
    background: transparent !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px 26px;
}

footer::before,
footer::after {
    content: none !important;
    display: none !important;
}

@media (max-width: 991px) {
    #nosotros-info,
    #servicios,
    section.container.section-padding.pt-0,
    #flota,
    #trayectoria,
    #responsabilidad,
    #contacto,
    footer {
        background-attachment: scroll !important;
    }

    #servicios,
    #flota,
    #responsabilidad {
        background-size: auto, 94vw auto;
    }

    footer {
        background-size: cover, 1400px auto !important;
        background-position: center center, center bottom !important;
    }
}
