/* --- assets/css/gpx.css --- */

/* =================================================================== */
/* 1. LAYOUT PRINCIPAL Y SCROLL                                        */
/* =================================================================== */
html,
body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    justify-content: flex-start !important;
    padding-bottom: 0 !important;
}

#gpx-main-content {
    width: 95%;
    max-width: 1100px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}


/* =================================================================== */
/* 2. CONTROLES DE CARGA (Alineación Reforzada)                        */
/* =================================================================== */
.gpx-controls.glass-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 1rem 2rem;
    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);
    flex-wrap: wrap;
}

/* Input file oculto */
#gpxFileInput {
    display: none;
}

/* Estilo BASE estricto para ambos botones */
.file-upload-btn,
.strava-btn {
    display: inline-flex;
    /* Flexbox interno para centrar icono/texto */
    align-items: center;
    justify-content: center;
    height: 46px;
    /* Altura forzada */
    padding: 0 24px;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    box-sizing: border-box;
    /* Vital para que padding/border no sumen */
    margin: 0;
    /* Quitar márgenes nativos */
    line-height: 1;
    /* Resetear line-height */
}

/* Colores Botón Cargar */
.file-upload-btn {
    background-color: rgba(28, 180, 149, 0.2);
    border: 1px solid #1cb495;
    color: #1cb495;
}

.file-upload-btn:hover {
    background-color: #1cb495;
    color: #000;
    box-shadow: 0 0 15px rgba(28, 180, 149, 0.4);
    transform: translateY(-2px);
}

/* Colores Botón Strava */
.strava-btn {
    background: rgba(252, 76, 2, 0.2);
    border: 1px solid #fc4c02;
    color: #fc4c02;
    gap: 8px;
    /* Espacio entre icono y texto */
}

.strava-btn:hover {
    background: #fc4c02;
    color: #fff;
    box-shadow: 0 0 15px rgba(252, 76, 2, 0.4);
    transform: translateY(-2px);
}


/* Wrapper de estado */
.upload-status-wrapper {
    display: flex;
    align-items: center;
    height: 46px;
    /* Misma altura exacta */
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0 6px 0 20px;
    margin-left: 10px;
    box-sizing: border-box;
    /* Asegurar altura real */
}

#fileNameDisplay {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    margin-right: 10px;
    line-height: 44px;
    /* Centrado vertical texto */
}

/* Botón Analizar */
.analyze-btn {
    height: 34px;
    padding: 0 15px;
    background: #1cb495;
    border: none;
    color: #000;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.analyze-btn:hover {
    background: #fff;
}

.analyze-btn:disabled {
    opacity: 0.5;
    background: #555;
    color: #888;
    cursor: wait;
}


/* =================================================================== */
/* 3. VISUALIZACIÓN DE DATOS (Cápsula y Panel)                         */
/* =================================================================== */

/* Cápsula de Resumen Simple (Local) */
.geo-capsule.gpx-summary {
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    border-color: #f5c842;
    border-bottom-width: 1px;
    transition: opacity 0.6s ease;
}

.geo-capsule.gpx-summary .geo-item span {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    margin-left: 8px;
}

.geo-divider {
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 0 15px;
    display: inline-block;
}

/* Cabecera de Ruta (Nombre y Tipo) */
.route-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #f5c842;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 15px rgba(245, 200, 66, 0.3);
    line-height: 1.2;
}

.activity-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(28, 180, 149, 0.2);
    border: 1px solid #1cb495;
    color: #fff;
    padding: 4px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(28, 180, 149, 0.2);
}

.activity-badge i {
    color: #1cb495;
    font-size: 1rem;
}

/* Botón Share (Icono) */
.share-btn-icon {
    background: transparent;
    border: 1px solid #f5c842;
    color: #f5c842;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 10px;
    font-size: 0.8rem;
}

.share-btn-icon:hover {
    background: #f5c842;
    color: #000;
    box-shadow: 0 0 10px rgba(245, 200, 66, 0.5);
    transform: scale(1.1);
}

/* Panel de Telemetría (Grid Dashboard) */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
    margin-bottom: 1.5rem;
}

.telemetry-card {
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 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 h4 {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin: 0 0 0.5rem 0;
}

.telemetry-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Roboto', sans-serif;
}

.telemetry-card .unit {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 2px;
}

.telemetry-card .sub-value {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
}

.telemetry-card i.bg-icon {
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 4rem;
    opacity: 0.05;
    pointer-events: none;
}

/* Terminal IA */
.ai-terminal {
    border-left: 4px solid #f5c842;
    padding: 0 !important;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: rgba(10, 10, 10, 0.85);
}

.ai-header-bar {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #f5c842;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.ai-content-text {
    padding: 1.5rem;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    font-size: 0.95rem;
}

.ai-content-text h3 {
    color: #1cb495;
    font-size: 1.1rem;
    text-transform: uppercase;
    margin-bottom: 1rem;
    border-bottom: 1px dashed rgba(28, 180, 149, 0.3);
    padding-bottom: 0.5rem;
}

.ai-content-text p {
    margin-bottom: 1rem;
}

.ai-content-text p:last-child {
    margin-bottom: 0;
    color: #f5c842;
    font-style: italic;
}

.ai-content-text::after {
    content: '▋';
    display: inline-block;
    animation: blink 1s infinite;
    color: #1cb495;
    margin-left: 5px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* =================================================================== */
/* 4. MAPA Y GRÁFICO                                                   */
/* =================================================================== */
.map-wrapper {
    width: 100%;
    height: 60vh;
    min-height: 400px;
    position: relative;
    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;
    /* Por debajo de los controles pero encima de los tiles */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), transparent 20%, transparent 80%, rgba(0, 0, 0, 0.4)),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 4px);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

/* Marcadores */
.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%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
}

.poi-start {
    background: #1cb495;
    box-shadow: 0 0 15px #1cb495;
}

.poi-end {
    background: #ff3e4d;
    box-shadow: 0 0 15px #ff3e4d;
}

/* Controles Leaflet */
.leaflet-container {
    background: #1a1a1a;
    font-family: 'Roboto', sans-serif;
}

.leaflet-bar a {
    background-color: rgba(20, 20, 20, 0.8);
    color: #1cb495;
    border-color: rgba(255, 255, 255, 0.2);
}

.leaflet-bar a:hover {
    background-color: #1cb495;
    color: #000;
}

.leaflet-control-layers {
    background: rgba(20, 20, 20, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #e0e0e0 !important;
    border-radius: 4px !important;
}

.leaflet-control-layers-toggle {
    filter: invert(1) brightness(2);
}

.leaflet-control-layers-expanded {
    padding: 10px !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 13px !important;
}

/* Gráfico */
#elevationChartWrapper {
    width: 100%;
    padding: 1rem;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

#elevationChartWrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* =================================================================== */
/* 5. VENTANAS MODALES (Strava y Share)                                */
/* =================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 20000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.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;
    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: #666;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #fff;
}

/* Lista Strava */
.strava-list-container {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    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;
    text-align: left;
}

.strava-item:hover {
    background: rgba(252, 76, 2, 0.15);
}

.strava-name {
    font-weight: bold;
    color: #fff;
    font-size: 0.95rem;
}

.strava-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.strava-select-icon {
    color: #fc4c02;
    opacity: 0;
    transition: opacity 0.2s;
}

.strava-item:hover .strava-select-icon {
    opacity: 1;
}

/* Preview Imagen */
#previewContainer {
    margin: 15px 0;
    border: 1px solid #333;
    border-radius: 8px;
    overflow-y: auto;
    background: #000;
    scrollbar-width: thin;
    scrollbar-color: #1cb495 #222;
}

#btnDownloadImage {
    margin-top: 10px;
    width: 100%;
    justify-content: center;
    background-color: #1cb495;
    color: #000;
}

#btnDownloadImage:hover {
    background-color: #fff;
}

/* Animación carga */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================================================== */
/* 6. PLANTILLA OCULTA (IMAGEN SOCIAL 1080x1920)                       */
/* =================================================================== */
.social-card-template {
    position: fixed;
    top: 0;
    left: -9999px;
    width: 1080px !important;
    height: 1920px !important;
    background: #050505;
    font-family: 'Montserrat', sans-serif;
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.social-map-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.6;
    filter: brightness(0.8) contrast(1.2);
}

.social-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.1) 25%, rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0.95) 90%, rgba(0, 0, 0, 1) 100%);
    z-index: 1;
}

/* Cabecera compactada */
.social-header {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-top: 60px;
    flex: 0 0 auto;
}

.social-brand {
    /* Volvemos a la fuente original de la marca */
    font-family: 'Courier New', monospace !important;
    font-size: 3.5rem;
    font-weight: bold;
    letter-spacing: 8px;
    /* Espaciado original de la marca */
    color: #1cb495;
    text-shadow: 0 0 25px rgba(28, 180, 149, 0.8);
    text-transform: uppercase;
}

.social-date {
    font-family: 'Courier New', monospace !important;
    /* Volvemos a Mono */
    font-size: 1.8rem;
    color: #aaa;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 300;
}

/* Cápsula de Stats: Subida y compactada */
.social-stats-capsule {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-evenly;
    align-self: center;
    width: 80%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    padding: 25px 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    /* Margen pequeño respecto a la fecha */
    margin-top: 60px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.stat-val {
    font-family: 'Montserrat', sans-serif;
    font-size: 4.5rem;
    /* Tamaño potente */
    font-weight: 900;
    /* El peso más grueso disponible */
    color: #fff;
    line-height: 1;
    letter-spacing: -1px;
    /* Un poco más juntas para que parezcan compactas */
}

.stat-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.2rem;
    color: #f5c842;
    font-weight: 700;
    margin-top: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.stat-divider {
    width: 2px;
    background: rgba(255, 255, 255, 0.2);
    height: 80px;
}

/* Footer: Título más pequeño y IA Box */
.social-footer {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    padding: 0 80px 80px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    /* CAMBIO CLAVE: Este auto empuja el footer al fondo de la imagen */
    margin-top: auto;
}

.social-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 30px;
    text-shadow: 0 5px 20px rgba(0, 0, 0, 1);
    text-align: center;
}

.social-ai-box {
    background: rgba(20, 20, 20, 0.95);
    border-left: 10px solid #f5c842;
    padding: 30px 40px;
    text-align: left;
    color: #ddd;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.4rem;
    font-weight: 400;
    line-height: 1.5;
    display: flex;
    gap: 25px;
    align-items: flex-start;
    border-radius: 0 15px 15px 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    width: 100%;
}

.social-ai-box i {
    color: #f5c842;
    font-size: 2.5rem;
    flex-shrink: 0;
}

.social-chart-decor {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 250px;
    opacity: 0.2;
    z-index: -1;
    pointer-events: none;
}

/* =================================================================== */
/* 7. OTROS COMPONENTES (BOTONES, TOOLTIPS, ETC)                      */
/* =================================================================== */

.map-ctrl-btn {
    position: absolute;
    left: 10px;
    z-index: 1001;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #1cb495;
    color: #1cb495;
    width: 38px;
    height: 38px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#btnMapFullscreen {
    top: 10px;
}

#btnToggleAnim {
    top: 55px;
    display: none;
}

.map-ctrl-btn:hover {
    background: #1cb495;
    color: #000;
}

.map-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
}

.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;
    }
}

/* ICONOS DE PARADA (MANO MINI) */
.poi-marker-icon.poi-stop-mini {
    width: 16px !important;
    height: 16px !important;
    margin-left: -8px !important;
    margin-top: -8px !important;
    background: #ff3e4d;
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(255, 62, 77, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 8px;
}

.climb-tooltip-cyber {
    background: rgba(0, 242, 255, 0.9) !important;
    border: 1px solid #fff !important;
    color: #000 !important;
    font-weight: 800 !important;
}

.chartjs-tooltip {
    background: rgba(10, 10, 10, 0.9) !important;
    border: 1px solid #1cb495 !important;
    padding: 10px !important;
    font-family: 'Courier New', monospace !important;
}