/* Forzamos a que el navegador no deje márgenes ni barras de scroll internas molestas */
html, body, main, section {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Evita doble barra de scroll si el iframe mide lo mismo que el mapa */
    background-color: transparent; /* Se adapta al fondo de tu WordPress */
}


/* Aísla el renderizado del mapa para mejorar los FPS */
#mapaTrayectoria {
    contain: layout;
    background: #f8fafc; /* Color base mientras cargan los tiles */
}

/* El mapa se estira al 100% del tamaño que le asigne el iframe en Elementor */
#mapaTrayectoria.mapa-trayecto {
    width: 100%;
    height: 100vh; /* Ocupa el 100% del alto de la ventana del iframe */
}

/* Evita el conflicto de Tailwind con los Tiles del mapa */
.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
    display: inline !important;
}

.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.85) !important;
}




/* Ocultamos el nav-info en el header-anv */
#nav-info {display:none;}


/* Contenedor principal debajo del zoom */
.kpi-vertical-panel {
    margin-top: 10px !important; /* Separación del botón de zoom */
    background: rgba(255, 255, 255, 0.85);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border: 2px solid rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto; /* Permite interactuar si añades botones */
}

.kpi-card {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.kpi-card:last-child { border: none; }

.kpi-label {
    font-size: 0.6rem;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    text-align: center;
}

.kpi-value {
    font-size: 0.8rem;
    font-weight: 900;
    color: #333;
    font-family: 'Courier New', monospace; /* Estilo náutico */
    text-align: center;
}

.kpi-value small { font-size: 10px; color: #888; }


/* Mostramos el rango de datos mostrado en el mapa */
.range-info-panel {
    margin-bottom: 10px !important; /* Para que no tape el "© OpenStreetMap" */
    margin-right: 10px !important;
    background: rgba(255, 255, 255, 0.85);
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    font-family: Arial, sans-serif;
}

.range-container {
    display: flex;
    flex-direction: column;
}

.range-title {
    font-size: 9px;
    color: #0d6efd; /* Azul como la trayectoria */
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.range-dates {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: #444;
    line-height: 1.4;
}

.range-dates strong {
    color: #000;
    font-size: 9px;
}

/* Personalización del selector de capas de Leaflet */
.leaflet-control-layers {
    border-radius: 8px !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    font-family: 'Arial', sans-serif;
    font-size: 12px;
}

.leaflet-control-layers-expanded {
    padding: 10px !important;
    background: rgba(255, 255, 255, 0.95);
}

/*  Mostramos la ultima actualización y cuanto queda para actualizar */
.sync-info-panel {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-right: 10px !important;
    margin-bottom: 20px !important; /* Espacio para atribuciones */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    font-family: 'Monaco', 'Consolas', monospace;
}
.sync-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sync-label {
    display: block;
    font-size: 9px;
    color: #64748b;
    font-weight: bold;
    text-transform: uppercase;
}
.sync-value {
    display: block;
    font-size: 11px;
    color: #1e293b;
}
#countdown-timer {
    color: #0d6efd; /* Azul para resaltar la cuenta atrás */
    font-weight: bold;
}

/* ESTILOS PARA WIDGET DE MAGALLANES */
.magallanes-widget {
    background: rgba(15, 23, 42, 0.9); /* Azul muy oscuro tipo náutico */
    color: white;
    padding: 10px;
    margin-bottom: 1rem !important;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    min-width: 160px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mag-header {
    font-size: 0,7rem;
    letter-spacing: 1px;
    font-weight: bold;
    color: #94a3b8;
    margin-bottom: 4px;
}

.mag-dist {text-align:center;}

.mag-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: #3b82f6;
}

.mag-unit { font-size: 12px; margin-left: 4px; color: #64748b; }

.mag-eta {
    margin-top: 8px;
    border-top: 1px solid #334155;
    padding-top: 5px;
}

.mag-eta small { display: block; font-size: 9px; color: #94a3b8; }
.mag-eta strong { font-size: 13px; color: #f8fafc; }

.mag-progress-container {
    background: #334155;
    height: 6px;
    border-radius: 3px;
    margin: 8px 0 2px 0;
    overflow: hidden;
}
.mag-progress-bar {
    background: #3b82f6;
    height: 100%;
    transition: width 0.5s ease;
}
.mag-progress-text {
    font-size: 9px;
    color: #94a3b8;
    text-align: right;
}

.mag-info-block { margin: 10px 0; }
.mag-label { font-size: 9px; color: #94a3b8; margin-bottom: 2px; }
.mag-time-base { font-size: 0.8rem; font-weight: 500; color: #f8fafc; }
.mag-time-highlight { font-size: 0.8rem; font-weight: 800; display: flex; align-items: center; justify-content: space-between; }
.mag-trend-tag { font-size: 12px; font-weight: 700; background: rgba(0,0,0,0.2); padding: 2px 6px; border-radius: 4px; }
.mag-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 0; }

/* Ajuste para móviles */
@media (max-width: 600px) {
    .magallanes-widget {
        min-width: 120px;
        padding: 6px;
    }
    .mag-val { font-size: 18px; }
}

/* SELECTOR DE ETAPAS  */
.etapa-select-container {
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    box-shadow: none;
}

#etapa-select {
    padding: 2px 5px;
    font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
    font-size: 12px;
}


/* TOGGLE PARA CONTROLES */
.toggle-controls-btn {
    width: 30px !important;
    height: 30px !important;
    line-height: 34px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toggle-controls-btn:hover {
    background-color: #f4f4f4 !important;
}

/* ESTILOS PARA WIDGET HISTORICO */
/* Contenedor con el efecto de desvanecimiento */
.chart-scroll-container {
    width: 100%;
    position: relative;
    /* Máscara para el degradado lateral */
    -webkit-mask-image: linear-gradient(to right, 
        transparent, 
        black 5%, 
        black 95%, 
        transparent
    );
    mask-image: linear-gradient(to right, 
        transparent, 
        black 5%, 
        black 95%, 
        transparent
    );
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
}

/* Ajuste para que el canvas no se pegue a los bordes */
.chart-render-wrapper {
    padding: 0 10px;
    min-width: 800px; /* Forzamos el ancho en móviles */
    height: 350px;
}

/* Ocultamos la barra de scroll por defecto para un look más limpio */
.chart-scroll-container::-webkit-scrollbar {
    display: none;
}
.chart-scroll-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}