/**
 * Estilos exclusivos para la sección Ruta de Carrera (Diseño de Alto Impacto)
 */

:root {
    --route-red: #ff3b30;
    --route-green: #76ff03; /* Verde neón institucional */
    --font-race: "Arial Black", -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-bg-dark: #090909;
}

.route-section {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 50px 20px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.route-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* --- Encabezado --- */
.route-header {
    text-align: left;
    margin-bottom: 30px;
}

.route-title {
    font-family: var(--font-race);
    color: #ffffff;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: -1px;
}

/* ==========================================================================
   ESTRUCTURA DEL CONTENEDOR MAESTRO (Layout Móvil Primero)
   ========================================================================== */
.route-layout-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
}

/* --- Bloque Izquierdo: Caja de Mapa con Bordes Neón --- */
.route-map-main-block {
    background: #121212;
    border-radius: 20px;
    border: 2px solid rgba(118, 255, 3, 0.3);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
}

/* Barras de acción internas */
.map-top-action-bar,
.map-bottom-action-bar {
    background-color: transparent;
    padding: 15px 20px;
    display: flex;
    box-sizing: border-box;
}

.map-top-action-bar { justify-content: flex-end; }
.map-bottom-action-bar { justify-content: center; }

.action-bar-btn {
    background-color: var(--route-green);
    color: #000000;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(118, 255, 3, 0.3);
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: #000000;
    border-radius: 50%;
}

/* Iframe del Mapa con Altura Optimizada */
.map-frame-container {
    position: relative;
    width: 100%;
    height: 380px;
    overflow: hidden;
    background-color: #1a1a1a;
}

.map-frame-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ==========================================================================
   BLOQUE DERECHO: BARRA LATERAL TÉCNICA
   ========================================================================== */
.route-data-sidebar {
    background-color: var(--sidebar-bg-dark);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
    text-align: center;
    width: 100%;
}

.stat-number-giant {
    font-family: var(--font-race);
    color: var(--route-green);
    font-size: clamp(3.5rem, 8vw, 5.5rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -2px;
}

.stat-decorator-line {
    width: 60px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 10px auto 0 auto;
}

.sidebar-icon-center {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 10px 0;
}

.racer-sidebar-svg {
    max-height: 160px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(118, 255, 3, 0.6));
}

.stat-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 10px;
}

.info-label {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
}

.info-value-highlight {
    font-family: var(--font-race);
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    line-height: 1.1;
}

.info-sublabel {
    font-family: var(--font-race);
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
}

/* ==========================================================================
   AJUSTES RESPONSIVOS CRÍTICOS (Móviles y Tablets)
   ========================================================================== */
@media (max-width: 991px) {
    .map-frame-container iframe {
        pointer-events: none; /* Desactiva el mapa por defecto para que deje bajar la página */
    }
    
    .map-frame-container.active iframe {
        pointer-events: auto; /* Activa el mapa para interactuar con el dedo al hacer tap */
    }
}

@media (max-width: 768px) {
    .map-frame-container {
        /* CONTROL DE RUTA COMPLETA: Subimos a 450px para ver todo el lienzo del mapa de arriba a abajo */
        height: 450px; 
    }
    
    .route-map-main-block {
        gap: 0;
    }
    
    .map-top-action-bar, 
    .map-bottom-action-bar {
        padding: 10px 15px;
    }
}

@media (max-width: 360px) {
    .map-frame-container {
        height: 400px; /* Tamaño seguro para teléfonos muy delgados */
    }
}

/* ==========================================================================
   DISTRIBUCIÓN EN 2 COLUMNAS (PC)
   ========================================================================== */
@media (min-width: 992px) {
    .route-section {
        padding: 60px 0;
    }

    .route-layout-grid {
        display: grid;
        grid-template-columns: 1fr 320px;
        gap: 30px;
        align-items: stretch;
    }

    .map-frame-container {
        flex-grow: 1;
        height: 100%;
        min-height: 480px;
    }

    .map-frame-container iframe {
        pointer-events: auto; /* Siempre activo en ordenadores */
    }
}

/* ==========================================================================
   ANIMACIÓN NATIVA
   ========================================================================== */
.route-animate {
    opacity: 0;
    will-change: transform, opacity;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.drop-down { transform: translateY(-30px); }
.fade-up { transform: translateY(40px); }

.route-active .drop-down,
.route-active .fade-up {
    opacity: 1;
    transform: translateY(0);
}


   /* ==========================================================================
   ESTILOS PARA LA IMAGEN DEL MAPA RESPONSIVO
   ========================================================================== */
/* 1. Ajustes del contenedor para que respete el contenido */
.mapa-responsivo {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    background: #000; /* Color de fondo por si la imagen tarda en cargar */
    display: flex; /* Asegura que la imagen se comporte bien */
}

/* 2. Aseguramos que la imagen sea totalmente responsiva */
.mapa-responsivo img {
    width: 100%;
    height: auto; /* IMPORTANTE: esto hace que la altura sea proporcional al ancho */
    display: block;
    object-fit: contain; /* Cambiado a 'contain' para ver toda la ruta sin recortes */
}

/* 3. Ajuste fino para móviles */
@media (max-width: 768px) {
    .mapa-responsivo {
        aspect-ratio: auto; /* Quitamos la restricción rígida */
        min-height: unset;  /* Quitamos alturas forzadas que pueden cortar la imagen */
    }

    .mapa-responsivo img {
        max-height: 70vh; /* La imagen no superará el 70% de la altura de la pantalla */
        object-fit: contain;
    }
}