/* css/history-player.css - Barra de reproducción del recorrido histórico */

/* Contenedor de barra + gráfica: ocupa solo el ancho del mapa, sin tapar el sidebar */
.history-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
}

.history-bar.hidden {
    display: none;
}

/* El mapa se acorta para que la barra y la gráfica no tapen el recorrido */
.map-view.has-history-bar .map-container {
    height: calc(100% - var(--history-bar-h, 190px));
}

.history-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #1b2036;
    color: white;
    font-size: 14px;
}

.history-player-play {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    border: none;
    background: #2f3654;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.history-player-play:hover {
    background: #3d466e;
}

.history-player-speed {
    background: #2f3654;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    flex-shrink: 0;
}

.history-player-time {
    font-weight: 700;
    min-width: 70px;
    flex-shrink: 0;
}

.history-player-speedval {
    color: #38bdf8;
    font-weight: 600;
    min-width: 80px;
    flex-shrink: 0;
}

/* La barra de desplazamiento va en su propia fila, a todo el ancho, justo encima de la gráfica (se alinean por la hora) */
.history-player { flex-wrap: wrap; row-gap: 8px; }
.history-player-seek {
    order: 5;
    flex: 1 1 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    background: #3a3f55;
    cursor: pointer;
    min-width: 80px;
}

.history-player-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #38bdf8;
    border: 2px solid white;
    cursor: pointer;
}

.history-player-seek::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #38bdf8;
    border: none;
    cursor: pointer;
}

.history-player-counter {
    margin-left: auto;
    font-size: 12px;
    color: #9aa1b9;
    min-width: 56px;
    text-align: right;
    flex-shrink: 0;
}

.history-player-marker-badge {
    margin-top: 4px;
    background: #2563eb;
    color: white;
    font-weight: 700;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    text-align: center;
}

@media (max-width: 768px) {
    .history-player {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .history-player-seek {
        order: 5;
        flex-basis: 100%;
    }
}

/* En escritorio el sidebar (320px) queda a la izquierda: la barra ocupa solo el ancho del mapa */
@media (min-width: 1024px) {
    .map-sidebar.open ~ .history-bar {
        left: 320px;
    }
}

/* En móvil el sidebar es un drawer sobre el mapa: la barra queda por debajo de él */
@media (max-width: 1023px) {
    .map-sidebar.open ~ .history-bar {
        z-index: 540;
    }
}

/* Gráfica de velocidad */
.history-chart {
    background: var(--bg-card, white);
    padding: 6px 14px 8px;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.history-chart-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #4b5563);
    margin-bottom: 2px;
}

.history-chart-canvas {
    position: relative;
    height: 110px;
}

@media (max-width: 768px) {
    .history-chart-canvas {
        height: 90px;
    }
}
