/* ==========================================================================
   RADAR FERROVIARIO EN VIVO - ESTILOS VISUALES
   Centro de Control y Monitoreo Satelital de Formaciones Ferroviarias
   ========================================================================== */

/* Fuente oficial DinPro */
@font-face {
    font-family: 'DinPro';
    src: url('dinpro.otf') format('opentype');
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0b0e14;
}

.radar-body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #0b0e14;
    font-family: 'DinPro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

/* ==========================================================================
   BARRA SUPERIOR DE CONTROL DEL RADAR
   ========================================================================== */
.radar-top-bar {
    height: 54px;
    flex: 0 0 54px;
    width: 100%;
    background: #111620;
    border-bottom: 1px solid #1e2634;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    gap: 10px;
}

.radar-top-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.radar-btn-nav {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #1d2533;
    border: 1px solid #2d3a4f;
    color: #a0aec0;
    text-decoration: none;
    padding: 6px 11px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.radar-btn-nav:hover {
    background: #2a3547;
    color: #ffffff;
    border-color: #30a9e0;
}

.radar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}

.radar-dish-icon {
    font-size: 1.3em;
    color: #30a9e0;
    animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.brand-text h1 {
    font-size: 1.05em;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.8px;
    color: #ffffff;
    line-height: 1.1;
    white-space: nowrap;
}

.sub-brand {
    font-size: 0.65em;
    font-weight: bold;
    color: #718096;
    letter-spacing: 0.8px;
    display: block;
    white-space: nowrap;
}

.radar-live-indicator {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(0, 0, 0, 0.4);
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid #232d3d;
    flex-shrink: 0;
}

.live-label {
    color: #00e676;
    font-size: 0.75em;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.train-counter-badge {
    background: #1a2332;
    padding: 2px 7px;
    border-radius: 4px;
    color: #cbd5e1;
    font-size: 0.8em;
    border: 1px solid #2e3b4e;
    white-space: nowrap;
}

.train-counter-badge strong {
    color: #38bdf8;
}

/* ==========================================================================
   BARRA FLOTANTE DE FILTROS DE LÍNEA (MODERNA Y RESPONSIVA)
   ========================================================================== */
.radar-floating-line-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 850;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(17, 24, 38, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid #28374d;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    max-width: 95vw;
}

.line-filter-chip {
    background: #171f2b;
    border: 1px solid #273446;
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
}

.line-filter-chip .dot-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.chip-roca .dot-indicator { background-color: #30a9e0; }
.chip-mitre .dot-indicator { background-color: #0072ce; }
.chip-sanmartin .dot-indicator { background-color: #00828a; }
.chip-sarmiento .dot-indicator { background-color: #00853f; }
.chip-belgrano .dot-indicator { background-color: #d9381e; }

.line-filter-chip:hover {
    background: #232f40;
    color: #ffffff;
}

.line-filter-chip.active {
    background: #1e293b;
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* Lado Derecho de la Barra Superior */
.radar-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-mobile-search-toggle {
    display: none;
}

.radar-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.radar-search-wrapper .search-icon {
    position: absolute;
    left: 10px;
    color: #64748b;
    font-size: 0.85em;
    pointer-events: none;
}

#radar-search-input {
    background: #171f2b;
    border: 1px solid #283547;
    color: #f1f5f9;
    padding: 5px 28px 5px 28px;
    border-radius: 6px;
    font-size: 0.82em;
    width: 170px;
    outline: none;
    transition: all 0.2s ease;
}

#radar-search-input:focus {
    border-color: #38bdf8;
    width: 220px;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.9em;
}

/* Botones de Acción */
.radar-btn-action {
    background: #171f2b;
    border: 1px solid #273446;
    color: #cbd5e1;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s ease;
}

.radar-btn-action:hover {
    background: #232f40;
    color: #ffffff;
    border-color: #38bdf8;
}

#refresh-timer-badge {
    font-size: 0.85em;
    color: #38bdf8;
    min-width: 22px;
}

/* Botones Rápidos de Modo de Mapa */
.quick-map-modes {
    display: flex;
    align-items: center;
    background: #171f2b;
    border: 1px solid #283547;
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
}

.quick-mode-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 4px 9px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.quick-mode-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.quick-mode-btn.active {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Selector de Capas de Mapa */
.map-layer-selector {
    position: relative;
}

.layer-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #151a24;
    border: 1px solid #283547;
    border-radius: 8px;
    width: 290px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
}

.layer-dropdown.visible {
    display: flex;
}

.layer-option {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid #1e2634;
    transition: all 0.15s ease;
}

.layer-option:last-child {
    border-bottom: none;
}

.layer-option:hover {
    background: #1f2736;
}

.layer-option.active {
    background: #1e293b;
    border-left: 3px solid #38bdf8;
}

.layer-option i {
    font-size: 1.2em;
    color: #38bdf8;
    width: 24px;
    text-align: center;
}

.layer-desc strong {
    display: block;
    font-size: 0.9em;
    color: #ffffff;
}

.layer-desc small {
    display: block;
    font-size: 0.75em;
    color: #8fa0b5;
    line-height: 1.2;
}

/* ==========================================================================
   MAPA PRINCIPAL Y VISTA LEAFLET
   ========================================================================== */
.radar-main-content {
    flex: 1 1 auto;
    width: 100%;
    height: calc(100vh - 60px);
    position: relative;
    overflow: hidden;
    background-color: #07090e;
}

#map,
.map-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    background-color: #07090e;
    z-index: 1;
}

/* Sobrescrituras para Controles de Leaflet */
.leaflet-bar {
    border: 1px solid #283547 !important;
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-bar a {
    background-color: #171f2b !important;
    color: #cbd5e1 !important;
    border-bottom: 1px solid #283547 !important;
}

.leaflet-bar a:hover {
    background-color: #243042 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   MARCADORES DE TRENES EN EL MAPA (ALTA DEFINICIÓN)
   ========================================================================== */
.custom-train-leaflet-icon {
    background: transparent !important;
    border: none !important;
}

.train-map-marker {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.train-marker-body {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
    border: 2px solid #ffffff;
    transition: transform 0.2s ease;
}

.train-map-marker:hover .train-marker-body {
    transform: scale(1.15);
}

.train-marker-body.electric {
    background: radial-gradient(circle, #0284c7 0%, #0369a1 100%);
}

.train-marker-body.diesel {
    background: radial-gradient(circle, #ea580c 0%, #c2410c 100%);
}

.train-marker-body .train-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid #38bdf8;
    opacity: 0.8;
    animation: markerPulse 2s infinite ease-out;
}

@keyframes markerPulse {
    0% { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Flecha Direccional de Rumbo (Heading Indicator) */
.train-bearing-arrow {
    position: absolute;
    top: -12px;
    left: 50%;
    margin-left: -6px;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    font-size: 1.15em;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.9));
    transform-origin: 6px 31px;
    pointer-events: none;
    z-index: 10;
}

.train-code-badge {
    position: absolute;
    bottom: -18px;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.72em;
    font-weight: 800;
    white-space: nowrap;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.train-speed-badge {
    position: absolute;
    top: -14px;
    background: #0284c7;
    color: #ffffff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.65em;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

/* ==========================================================================
   MARCADORES DE ESTACIONES EN EL MAPA
   ========================================================================== */
.station-dot-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.station-dot-marker:hover {
    transform: scale(1.6);
    z-index: 1000 !important;
}

.station-dot-marker.dot-roca { background-color: #30a9e0; }
.station-dot-marker.dot-mitre { background-color: #0072ce; }
.station-dot-marker.dot-sanmartin { background-color: #00828a; }
.station-dot-marker.dot-sarmiento { background-color: #00853f; }
.station-dot-marker.dot-belgrano { background-color: #d9381e; }

/* Popups de Leaflet Personalizados */
.leaflet-popup-content-wrapper {
    background: #171f2b !important;
    color: #f1f5f9 !important;
    border: 1px solid #2d3d52 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 12px 16px !important;
    line-height: 1.4 !important;
}

.leaflet-popup-tip {
    background: #171f2b !important;
    border: 1px solid #2d3d52 !important;
}

.station-popup h4 {
    margin: 0 0 4px 0;
    font-size: 1.15em;
    color: #ffffff;
}

.station-popup .popup-line-pill {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 6px;
}

.station-popup .popup-info {
    font-size: 0.85em;
    color: #94a3b8;
    margin-bottom: 8px;
}

.station-popup .popup-btn-board {
    display: block;
    background: #30a9e0;
    color: white;
    text-align: center;
    padding: 6px 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: bold;
    transition: background 0.2s ease;
}

.station-popup .popup-btn-board:hover {
    background: #0284c7;
}

/* ==========================================================================
   PANEL LATERAL (LISTA DE FORMACIONES)
   ========================================================================== */
.radar-sidebar {
    position: absolute;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 350px;
    background: rgba(19, 25, 36, 0.94);
    backdrop-filter: blur(12px);
    border: 1px solid #27354a;
    border-radius: 10px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.radar-sidebar:not(.visible) {
    transform: translateX(-370px);
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #233042;
}

.sidebar-tabs {
    display: flex;
    gap: 6px;
}

.sidebar-tab {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.85em;
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.sidebar-tab:hover {
    color: #ffffff;
}

.sidebar-tab.active {
    background: #1e293b;
    color: #38bdf8;
}

.sidebar-close-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.1em;
    cursor: pointer;
}

.sidebar-close-btn:hover {
    color: #ffffff;
}

.sidebar-tab-content {
    display: none;
    flex-grow: 1;
    overflow: hidden;
}

.sidebar-tab-content.active {
    display: flex;
    flex-direction: column;
}

.sidebar-trains-scroll, .sidebar-stations-scroll {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Tarjeta de Formación en la Lista */
.train-list-card {
    background: #171f2b;
    border: 1px solid #27354a;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.train-list-card:hover {
    background: #202b3d;
    border-color: #38bdf8;
    transform: translateY(-1px);
}

.train-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.train-list-code {
    font-size: 1em;
    font-weight: bold;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.train-list-speed {
    background: #0369a1;
    color: #ffffff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
}

.train-list-route {
    font-size: 0.85em;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.train-list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    color: #94a3b8;
}

/* ==========================================================================
   FICHA TÉCNICA DE LA FORMACIÓN (INSPECTOR DE MATERIAL RODANTE - PUNTO 3)
   ========================================================================== */
.formation-inspector {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 440px;
    max-width: calc(100vw - 40px);
    z-index: 900;
    display: none;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.formation-inspector.visible {
    display: block;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.inspector-card {
    background: rgba(17, 24, 39, 0.96);
    backdrop-filter: blur(14px);
    border: 1px solid #334155;
    border-radius: 12px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.inspector-header {
    background: #1e293b;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
}

.formation-tag {
    display: flex;
    align-items: center;
    gap: 12px;
}

.traction-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #0284c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    color: white;
}

.formation-code-title {
    font-size: 1.3em;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.formation-model-subtitle {
    font-size: 0.85em;
    color: #94a3b8;
}

.inspector-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.6em;
    cursor: pointer;
    line-height: 1;
}

.inspector-close-btn:hover {
    color: #ffffff;
}

.inspector-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.badges-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.inspector-badge {
    font-size: 0.75em;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.badge-line { background: #30a9e0; color: white; }
.badge-traction { background: #1e293b; border: 1px solid #475569; color: #cbd5e1; }
.badge-service { background: #334155; color: #f8fafc; }
.badge-status { background: #009a44; color: white; transition: background-color 0.2s ease; }
.badge-status.status-en-anden { background: #009a44; color: white; }
.badge-status.status-detenido-intermedia { background: #0ea5e9; color: white; }
.badge-status.status-aproximando { background: #f59e0b; color: white; }
.badge-status.status-en-marcha { background: #0284c7; color: white; }
.badge-status.status-en-via { background: #64748b; color: white; }

.train-list-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72em;
    font-weight: bold;
    color: white;
    white-space: nowrap;
}
.train-list-status.status-anden { background: #009a44; }
.train-list-status.status-detenido { background: #0ea5e9; }
.train-list-status.status-aprox { background: #f59e0b; }
.train-list-status.status-marcha { background: #0284c7; }
.train-list-status.status-via { background: #64748b; }

.inspector-drag-handle {
    display: none;
    width: 38px;
    height: 4px;
    background: #475569;
    border-radius: 2px;
    margin: 8px auto 2px auto;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    z-index: 1400;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.visible {
    opacity: 1;
    display: block;
}

/* Grid de Telemetría */
.telemetry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.telemetry-box {
    background: #131b26;
    border: 1px solid #233042;
    border-radius: 8px;
    padding: 8px 12px;
}

.telemetry-label {
    display: block;
    font-size: 0.75em;
    color: #718096;
    margin-bottom: 2px;
}

.telemetry-value {
    font-size: 1.15em;
    font-weight: bold;
    color: #f1f5f9;
}

.telemetry-value strong {
    color: #38bdf8;
    font-size: 1.25em;
}

/* Detalles del Recorrido */
.route-details-box {
    background: #131b26;
    border: 1px solid #233042;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-terminals {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.route-terminals small {
    display: block;
    font-size: 0.7em;
    color: #718096;
}

.route-terminals strong {
    font-size: 1.05em;
    color: #ffffff;
}

.route-arrow {
    color: #38bdf8;
    font-size: 1.2em;
}

.next-station-row {
    font-size: 0.85em;
    color: #94a3b8;
    border-top: 1px solid #1e2736;
    padding-top: 6px;
    line-height: 1.35;
}

.next-station-row strong {
    color: #f8fafc;
}

.technical-row {
    font-size: 0.75em;
    color: #64748b;
    border-top: 1px dashed #1e2736;
    padding-top: 4px;
    word-break: break-all;
}

/* Botones de Acción */
.inspector-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.action-btn-primary, .action-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.action-btn-primary {
    background: #0284c7;
    border: none;
    color: white;
}

.action-btn-primary:hover {
    background: #0369a1;
}

.action-btn-secondary {
    background: #1e293b;
    border: 1px solid #334155;
    color: #f1f5f9;
}

.action-btn-secondary:hover {
    background: #334155;
    color: white;
}

/* ==========================================================================
   REGLAS RESPONSIVAS Y ADAPTACIÓN MULTIPANTALLA (PC, TABLET, CELULARES)
   ========================================================================== */

/* Laptops y pantallas intermedias (<= 1200px) */
@media (max-width: 1200px) {
    .sub-brand {
        display: none !important;
    }
    .quick-map-modes {
        display: none !important;
    }
    #radar-search-input {
        width: 150px;
    }
    #radar-search-input:focus {
        width: 190px;
    }
}

/* Tablets (<= 992px) */
@media (max-width: 992px) {
    .current-layer-name {
        display: none;
    }
    .radar-sidebar {
        width: 310px;
    }
    .formation-inspector {
        width: 380px;
    }
}

/* Teléfonos y Dispositivos Móviles (<= 768px) */
@media (max-width: 768px) {
    .radar-top-bar {
        height: 50px;
        flex: 0 0 50px;
        padding: 0 8px;
        gap: 6px;
    }

    .radar-top-left {
        gap: 6px;
    }

    .btn-nav-text {
        display: none;
    }

    .radar-btn-nav {
        padding: 6px 9px;
        font-size: 0.85em;
    }

    .brand-text h1 {
        font-size: 0.9em;
        letter-spacing: 0.5px;
    }

    .radar-dish-icon {
        font-size: 1.1em;
    }

    .live-label {
        display: none;
    }

    .train-counter-unit {
        display: none;
    }

    .train-counter-badge {
        font-size: 0.75em;
        padding: 2px 6px;
    }

    .btn-sidebar-label {
        display: none;
    }

    /* Búsqueda en Móvil: Se activa como barra expandida al presionar el ícono */
    .btn-mobile-search-toggle {
        display: flex !important;
        padding: 6px 10px;
    }

    .radar-search-wrapper {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 50px;
        background: #111620;
        z-index: 1200;
        padding: 0 10px;
    }

    .radar-search-wrapper.mobile-active {
        display: flex;
    }

    #radar-search-input {
        width: 100% !important;
        font-size: 0.9em;
        padding: 6px 30px;
    }

    /* Barra Flotante de Filtros de Línea en Móvil: Deslizable táctil horizontal */
    .radar-floating-line-bar {
        top: 6px;
        left: 6px;
        right: 6px;
        transform: none;
        max-width: calc(100vw - 12px);
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        border-radius: 20px;
        padding: 4px 6px;
    }

    .radar-floating-line-bar::-webkit-scrollbar {
        display: none;
    }

    .line-filter-chip {
        padding: 4px 8px;
        font-size: 0.75em;
        flex-shrink: 0;
    }

    /* Panel Lateral como Drawer Móvil */
    .radar-sidebar {
        position: fixed;
        top: 50px;
        left: 0;
        bottom: 0;
        width: 86vw;
        max-width: 340px;
        z-index: 1500;
        border-radius: 0 14px 14px 0;
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.85);
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .radar-sidebar.visible {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .radar-sidebar:not(.visible) {
        transform: translateX(-105%);
    }

    /* Inspector como Bottom Sheet en Móvil */
    .formation-inspector {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        z-index: 1600;
        margin: 0;
    }

    .inspector-card {
        border-radius: 18px 18px 0 0;
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85);
        border-bottom: none;
    }

    .inspector-drag-handle {
        display: block;
    }

    .inspector-header {
        padding: 10px 14px;
    }

    .formation-code-title {
        font-size: 1.1em;
    }

    .formation-model-subtitle {
        font-size: 0.78em;
    }

    .traction-icon {
        width: 34px;
        height: 34px;
        font-size: 1.1em;
    }

    .inspector-body {
        padding: 12px 14px;
        gap: 10px;
    }

    .telemetry-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .telemetry-box {
        padding: 6px 10px;
    }

    .telemetry-label {
        font-size: 0.7em;
    }

    .telemetry-value {
        font-size: 1em;
    }

    .telemetry-value strong {
        font-size: 1.1em;
    }

    .inspector-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}
