/* --- assets/css/rutasNew.css (V2 - FIXED) --- */

/* =================================================================== */
/* 1. LAYOUT PRINCIPAL                                                 */
/* =================================================================== */

html,
body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden;
}

#header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
}

.culi-banner {
    text-align: center;
    color: #f5c842;
    font-size: 0.9em;
    margin-bottom: 1em;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.85;
}

#gpx-main-content {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto 2rem auto;
    display: flex;
    flex-direction: column;
    /* FIX: Alineamos al centro para que la cápsula no se estire */
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 2rem;
}

/* =================================================================== */
/* 2. CONTROLES DE CARGA (GLASS PANEL)                                 */
/* =================================================================== */
.gpx-controls.glass-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 100%;
    /* Aseguramos que el panel de controles ocupe el ancho */
}

#gpxFileInput {
    display: none;
}

.file-upload-btn,
.strava-btn,
.analyze-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 20px;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
    line-height: 1;
    text-decoration: none;
    border: 1px solid transparent;
}

/* Colores Botones */
.file-upload-btn {
    background: rgba(28, 180, 149, 0.15);
    border-color: #1cb495;
    color: #1cb495;
}

.file-upload-btn:hover {
    background: #1cb495;
    color: #000;
    box-shadow: 0 0 15px rgba(28, 180, 149, 0.4);
}

.strava-btn {
    background: rgba(252, 76, 2, 0.15);
    border-color: #fc4c02;
    color: #fc4c02;
}

.strava-btn:hover {
    background: #fc4c02;
    color: #fff;
    box-shadow: 0 0 15px rgba(252, 76, 2, 0.4);
}

.analyze-btn {
    background: #1cb495;
    color: #000;
    border: none;
    /* CAMBIO: De 8px a 50px para que sea redondo como los otros */
    border-radius: 50px;

    /* Aseguramos negrita y espaciado */
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(28, 180, 149, 0.3);
    /* Sombra suave */
}

.analyze-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.analyze-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.upload-status-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 44px;
}

#fileNameDisplay {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* =================================================================== */
/* 3. VISUALIZACIÓN DE DATOS (Header, Telemetría)                      */
/* =================================================================== */

#routeHeader {
    text-align: center;
    margin-bottom: 1.5rem;
    width: 100%;
}

.route-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #f5c842;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(245, 200, 66, 0.3);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.activity-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(28, 180, 149, 0.2);
    border: 1px solid #1cb495;
    color: #fff;
    padding: 5px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.share-btn-icon {
    background: transparent;
    border: 1px solid #f5c842;
    color: #f5c842;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 5px;
}

.share-btn-icon:hover {
    background: #f5c842;
    color: #000;
    box-shadow: 0 0 10px rgba(245, 200, 66, 0.6);
}

/* --- FIX CÁPSULA DE RESUMEN --- */
.geo-capsule {
    display: inline-flex;
    /* Esto hace que se ajuste al contenido */
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 2px solid #1cb495;
    border-radius: 50px;
    padding: 10px 30px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    white-space: nowrap;

    /* Aseguramos que no se estire */
    width: auto;
    max-width: 100%;
}

.geo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
}

.geo-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.3);
}

/* Grid Telemetría */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
}

.telemetry-card {
    background: rgba(20, 20, 20, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.telemetry-card.type-total {
    border-top: 3px solid #1cb495;
}

.telemetry-card.type-speed {
    border-top: 3px solid #3498db;
}

.telemetry-card.type-elev {
    border-top: 3px solid #f5c842;
}

.telemetry-card.type-stops {
    border-top: 3px solid #ff3e4d;
}

.telemetry-card.type-climb {
    border-top: 3px solid #9b59b6;
}

.telemetry-card h4 {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.telemetry-card .value {
    font-family: 'Roboto', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.telemetry-card .unit {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 3px;
    font-weight: 400;
}

.telemetry-card .sub-value {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 8px;
}

.telemetry-card i.bg-icon {
    position: absolute;
    bottom: -15px;
    right: -15px;
    font-size: 5rem;
    opacity: 0.05;
    pointer-events: none;
}

/* =================================================================== */
/* 4. IA TERMINAL                                                      */
/* =================================================================== */
.ai-terminal {
    background: rgba(10, 10, 10, 0.9);
    border-left: 4px solid #f5c842;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    width: 100%;
}

.ai-header-bar {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #f5c842;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-content-text {
    padding: 1.5rem;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    font-size: 0.95rem;
}

.ai-content-text::after {
    content: '▋';
    animation: blink 1s infinite;
    color: #f5c842;
    margin-left: 5px;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* =================================================================== */
/* 5. MAPA LEAFLET                                                     */
/* =================================================================== */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

#mapContainer {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    z-index: 1;
}

.map-overlay-fx {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.map-ctrl-btn {
    position: absolute;
    left: 10px;
    z-index: 1001;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #1cb495;
    color: #1cb495;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.map-ctrl-btn:hover {
    background: #1cb495;
    color: #000;
}

#btnMapFullscreen {
    top: 10px;
}

#btnToggleAnim {
    top: 55px;
    display: none;
}

.map-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
}

#elevationChartWrapper {
    width: 100%;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
}

.leaflet-container {
    background: #1a1a1a;
    font-family: 'Roboto', sans-serif;
}

.leaflet-bar a {
    background-color: rgba(20, 20, 20, 0.9) !important;
    color: #1cb495 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.leaflet-bar a:hover {
    background-color: #1cb495 !important;
    color: #000 !important;
}

.leaflet-control-layers-toggle {
    /* 1. Icono SVG de Capas (Color Verde #1cb495) */
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%231cb495' d='M11.99 2.005L2 7.002l9.99 5 9.99-5-9.99-4.997zm0 9l2.79-1.39-2.79-1.4-2.79 1.4 2.79 1.39zM2 12l9.99 5 9.99-5V10l-9.99 5L2 10v2zm0 5l9.99 5 9.99-5V15l-9.99 5L2 15v2z'/%3E%3C/svg%3E") !important;

    /* 2. Estilo del Botón (Igual que los otros controles) */
    background-color: rgba(20, 20, 20, 0.95) !important;
    border: 1px solid #1cb495 !important;
    border-radius: 6px !important;

    /* 3. Tamaño y posición del icono */
    width: 36px !important;
    height: 36px !important;
    background-size: 20px 20px !important;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Efecto Hover */
.leaflet-control-layers-toggle:hover {
    background-color: #1cb495 !important;
    /* Invertimos el color del icono a negro/blanco al pasar el ratón usando filtros */
    filter: brightness(0) invert(0);
    box-shadow: 0 0 15px rgba(28, 180, 149, 0.6);
}

/* Ajuste del menú desplegable cuando se abre */
.leaflet-control-layers-expanded {
    background: rgba(10, 10, 10, 0.95) !important;
    border: 1px solid #1cb495 !important;
    color: #fff !important;
    border-radius: 8px !important;
    padding: 10px !important;
    font-family: 'Roboto', sans-serif !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8) !important;
}

/* =================================================================== */
/* 6. MODALES ESPECÍFICOS (FIX: Posicionamiento y Overlay)             */
/* =================================================================== */

.modal-overlay {
    display: none;
    /* JS controla esto */
    position: fixed;
    /* OBLIGATORIO para cubrir pantalla */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* Fondo oscuro */
    z-index: 20000;
    /* Encima de todo */
    backdrop-filter: blur(5px);

    /* CENTRADO FLEX PARA EL CONTENIDO */
    align-items: center;
    justify-content: center;
}

/* TRUCO: Si el JS pone display:block, forzamos flex para centrar */
.modal-overlay[style*="display: block"] {
    display: flex !important;
}

.modal-content {
    background-color: #0a0a0a;
    padding: 2rem;
    border: 1px solid #1cb495;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    /* Ancho máximo limitado */
    box-shadow: 0 0 50px rgba(28, 180, 149, 0.2);
    position: relative;
    text-align: center;
    animation: modalPopIn 0.3s ease-out;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-modal {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 1000;
    /* <--- CAMBIO IMPORTANTE: Aumentado de 10 a 1000 */
    background: rgba(0, 0, 0, 0.5);
    /* Opcional: fondo oscuro para que resalte sobre la imagen */
    width: 35px;
    /* Opcional: Área de clic más grande */
    height: 35px;
    line-height: 35px;
    border-radius: 50%;
}

.close-modal:hover {
    color: #fff;
    background: #ff3e4d;
}

/* Lista Strava */
.strava-list-container {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: #000;
}

.strava-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.2s;
}

.strava-item:hover {
    background: rgba(252, 76, 2, 0.15);
}

.strava-name {
    font-weight: bold;
    color: #fff;
    display: block;
}

.strava-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
    display: block;
}

#previewContainer {
    margin: 20px 0;
    border: 1px solid #333;
    border-radius: 8px;
    overflow-y: auto;
    max-height: 60vh;
    background: #000;

    /* CAMBIO: Centrar la etiqueta img dentro del div */
    display: flex;
    justify-content: center;
    align-items: center;
}

#btnDownloadImage {
    width: 100%;
    margin-top: 10px;
    background: #1cb495;
    color: #000;
    border: none;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================================================== */
/* 7. SOCIAL CARD TEMPLATE (Oculto)                                    */
/* =================================================================== */
.social-card-template {
    position: fixed;
    top: 0;
    left: -9999px;
    width: 1080px;
    height: 1920px;
    background: #050505;
    z-index: 9999;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    flex-direction: column;
}

.social-map-bg {
    position: absolute;
    width: 100%;
    height: 100%;

    /* CAMBIO: Asegurar que la captura del mapa se centre perfectamente */
    background-size: cover;
    background-position: center center;
    /* <--- ESTO FALTABA */
    background-repeat: no-repeat;

    opacity: 0.6;
}

.social-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.1) 30%, rgba(0, 0, 0, 0.95) 90%);
}

.social-header {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-top: 80px;
}

.social-brand {
    font-family: 'Courier New', monospace;
    /* <--- CAMBIO: Fuente estilo "Matrix/Tech" */
    font-size: 4rem;
    /* Un poco más grande */
    font-weight: 900;
    color: #1cb495;
    letter-spacing: 8px;
    /* Más espaciado */
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(28, 180, 149, 0.5);
    /* Resplandor */
}

.social-date {
    font-size: 1.8rem;
    color: #aaa;
    margin-top: 10px;
    letter-spacing: 2px;
}

.social-stats-capsule {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-around;
    width: 85%;
    margin: 80px auto 0;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 30px 0;
}

.stat-item {
    text-align: center;
}

.stat-val {
    /* CAMBIO: Usamos Montserrat (que ya tienes cargada) */
    font-family: 'Montserrat', sans-serif;
    font-size: 4.5rem;
    /* CAMBIO: Peso 900 (Extra Bold) para que los números se vean gordos y potentes */
    font-weight: 900;
    color: #fff;
    display: block;
    line-height: 0.9;
    /* Un poco más pegadito */
    letter-spacing: -1px;
    /* Juntar los números ligeramente para efecto compacto */
}

.stat-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    /* Un pelín más pequeño para contraste */
    color: #f5c842;
    font-weight: 700;
    letter-spacing: 2px;
    /* Letras separadas para estilo técnico */
    margin-top: 12px;
    text-transform: uppercase;
}

.social-footer {
    position: relative;
    z-index: 2;
    margin-top: auto;
    padding: 0 80px 100px;
    text-align: center;
}

.social-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.2rem;
    /* Tamaño controlado */
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    margin-bottom: 40px;
    line-height: 1.3;
    padding: 0 40px;
    word-wrap: break-word;
    /* Romper palabras largas */
}

.social-ai-box {
    background: rgba(20, 20, 20, 0.95);
    border-left: 10px solid #f5c842;
    padding: 35px;
    /* Más relleno */
    text-align: left;
    color: #ddd;

    /* <--- CAMBIO: Aumento de tamaño */
    font-size: 1.7rem;
    line-height: 1.5;

    display: flex;
    gap: 25px;
    border-radius: 0 15px 15px 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* =================================================================== */
/* 8. MARCADORES MAPA                                                  */
/* =================================================================== */
.bike-marker-icon {
    text-align: center;
    line-height: 30px;
    font-size: 18px;
    color: #fff;
    background: #f5c842;
    border-radius: 50%;
    box-shadow: 0 0 10px #f5c842;
    border: 2px solid #fff;
}

.poi-marker-icon {
    text-align: center;
    color: #fff;
    font-weight: 900;
    font-size: 14px;
    line-height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.poi-start {
    background: #1cb495;
    box-shadow: 0 0 15px #1cb495;
}

.poi-end {
    background: #ff3e4d;
    box-shadow: 0 0 15px #ff3e4d;
}

.climb-path-neon {
    filter: drop-shadow(0 0 8px #00f2ff);
    stroke-dasharray: 10, 5;
    animation: dash-move 2s linear infinite;
}

@keyframes dash-move {
    to {
        stroke-dashoffset: -15;
    }
}