* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
}

body { display: flex; flex-direction: column; }

.hidden { display: none !important; }

/* Bloque de búsqueda dentro del sidebar (el mapa ocupa todo el alto) */
.pl-brand {
    background: #1a237e;
    color: white;
    padding: 12px 14px 14px;
    flex-shrink: 0;
}

.pl-title-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 12px;
}

.pl-title-row h1 { font-size: 15px; font-weight: 700; }

.pl-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.pl-field {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 0 14px;
    height: 48px;
    color: rgba(255, 255, 255, 0.85);
}

.pl-day { width: 100%; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; }

/* Recuadro de placa colombiana (amarillo, caracteres negros) */
.pl-plate-box {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: 100%;
    max-width: 290px;
    align-self: center;
    height: 74px;
    padding: 16px 12px 0;
    border-radius: 12px;
    border: 3px solid #1c1c1c;
    background: linear-gradient(180deg, #ffe45c 0%, #ffd21f 55%, #f2b800 100%);
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.55),
        inset 0 -6px 10px rgba(160, 110, 0, 0.25),
        0 6px 14px rgba(0, 0, 0, 0.45);
    cursor: text;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.pl-plate-box::before,
.pl-plate-box::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #f3f3f3, #7a7a7a);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.pl-plate-box::before { left: 8px; }
.pl-plate-box::after { right: 8px; }

.pl-plate-box:focus-within {
    transform: translateY(-1px);
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.55),
        inset 0 -6px 10px rgba(160, 110, 0, 0.25),
        0 0 0 3px rgba(249, 115, 22, 0.9),
        0 8px 18px rgba(0, 0, 0, 0.5);
}

.pl-plate-top {
    position: absolute;
    top: 4px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 5px;
    color: #1c1c1c;
    text-indent: 5px;
    pointer-events: none;
}

.pl-plate-box input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    text-align: center;
    text-transform: uppercase;
    font-family: 'Charles Wright', 'Arial Black', Impact, 'Helvetica Neue', sans-serif;
    font-size: 38px;
    font-weight: 900;
    letter-spacing: 7px;
    text-indent: 7px;
    color: #161616;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.pl-plate-box input::placeholder {
    color: rgba(22, 22, 22, 0.28);
    text-shadow: none;
}

.pl-label { font-size: 11px; opacity: 0.75; line-height: 1; }

.pl-field input,
.pl-field select {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
}

.pl-field input::placeholder { color: rgba(255, 255, 255, 0.7); font-weight: 400; text-transform: none; }
.pl-field select { text-transform: none; cursor: pointer; }
.pl-field select option { color: #111827; }
.pl-field input[type="date"] { color-scheme: dark; cursor: pointer; text-transform: none; }

.pl-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 22px;
    height: 48px;
    background: #f97316;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.pl-search:disabled { opacity: 0.6; cursor: wait; }

.pl-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 12px;
    margin-top: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
}

.pl-legend span { display: flex; align-items: center; gap: 5px; }
.pl-flag { color: #ef4444; font-style: normal; font-size: 13px; }

.pl-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #1a73e8;
    color: white;
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
}

.pl-rainbow {
    display: inline-block;
    width: 22px;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(90deg, #1a73e8, #ea4335, #34a853, #fbbc04, #9c27b0);
}

.pl-body { display: flex; flex: 1; min-height: 0; position: relative; }

.pl-side {
    width: 310px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
}

#plTrips { padding: 12px; }


/* Columna derecha: mapa + barra de reproducción + gráfica (mismo ancho que el mapa; el sidebar queda a un lado) */
.pl-main { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }

.pl-map-wrap { position: relative; flex: 1; min-height: 0; min-width: 0; }
#plMap { position: absolute; inset: 0; }

.pl-trip-start {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.pl-trip-end {
    font-size: 20px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.pl-toast {
    position: absolute;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: 90%;
    background: rgba(31, 41, 55, 0.92);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pl-toast.pl-toast-hidden { opacity: 0; }
.pl-toast.pl-toast-error { background: rgba(185, 28, 28, 0.95); }

/* Barra de reproducción */
.pl-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: #1b2036;
    color: white;
    font-size: 13px;
    flex-shrink: 0;
}

.pl-play {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: none;
    background: #f97316;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pl-mult {
    background: #2f3654;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 6px;
    font-size: 12px;
    font-weight: 700;
}

.pl-time { font-weight: 700; min-width: 76px; }
.pl-speed { color: #38bdf8; font-weight: 600; min-width: 84px; text-align: right; }
.pl-counter { color: #9aa1b9; font-size: 11px; min-width: 64px; text-align: right; }

.pl-seek {
    flex: 1;
    min-width: 80px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    background: #3a3f55;
    cursor: pointer;
}

.pl-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f97316;
    border: 2px solid white;
    cursor: pointer;
}

.pl-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f97316;
    border: none;
    cursor: pointer;
}

/* Gráfica de velocidad */
.pl-chart {
    background: white;
    padding: 6px 14px 8px;
    flex-shrink: 0;
    border-top: 1px solid #e5e7eb;
}

.pl-chart-title { font-size: 12px; font-weight: 600; color: #4b5563; margin-bottom: 2px; }
.pl-chart-canvas { position: relative; height: 110px; }

.pl-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;
}

.pl-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    color: white;
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 720px) {
    .pl-side {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1200;
        width: min(340px, 88vw);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }
    .pl-side.pl-open { transform: none; }
    .pl-player { flex-wrap: wrap; row-gap: 6px; }
    .pl-seek { order: 5; flex-basis: 100%; }
    .pl-chart-canvas { height: 90px; }
}

.pl-search { justify-content: center; }

/* Botón hamburguesa: colapsa/expande el sidebar */
.pl-side-toggle {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.98);
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pl-side-toggle:active { transform: scale(0.95); }

.pl-side { transition: width 0.2s ease; }

@media (min-width: 721px) {
    .pl-side.pl-collapsed {
        width: 0;
        padding: 0;
        border-right: none;
        overflow: hidden;
    }
}
