/* ══════════════════════════════════════════════════════════════
   B.U.S. GPS — Tema monocromático v2.0.0
   Paleta gris-pizarra (slate) con un único acento poco saturado.
   Sin alternancia claro/oscuro: una sola superficie profesional,
   ni demasiado oscura ni deslumbrante, apta para uso diurno y
   nocturno en la calle.
   ══════════════════════════════════════════════════════════════ */
:root {
    /* Familia neutra única (fría, ligeramente azulada) */
    --slate-950: #14171b;
    --slate-900: #1b1f24;
    --slate-800: #262b32;
    --slate-700: #333941;
    --slate-600: #454c56;
    --slate-500: #5b6470;
    --slate-400: #7c8592;
    --slate-300: #a4acb6;
    --slate-200: #c9cfd6;
    --slate-100: #e4e7ea;
    --slate-50:  #eef0f2;

    /* Superficies: medio-claras, profesionales, sin negro puro ni blanco puro */
    --primary-bg:    var(--slate-100);
    --secondary-bg:  #f6f7f8;
    --tertiary-bg:   #ffffff;
    --quaternary-bg: var(--slate-200);

    /* Acento único: azul-pizarra desaturado (~35% saturación) */
    --accent-color:     #3c5878;
    --accent-color-raw: 60, 88, 120;
    --accent-hover:      #30475f;
    --accent-dim:        rgba(60, 88, 120, 0.12);

    --text-color:      var(--slate-900);
    --text-secondary:  var(--slate-600);
    --text-muted:      var(--slate-500);

    --button-bg:     var(--slate-100);
    --button-hover:  var(--slate-200);
    --border-color:  var(--slate-200);
    --border-light:  var(--slate-300);

    --success-color: #3c6b52;
    --warning-color: #8a7a4f;
    --error-color:   #a4453f;

    --shadow-sm: 0 1px 2px 0 rgba(20, 23, 27, 0.06);
    --shadow:    0 4px 10px -2px rgba(20, 23, 27, 0.10), 0 2px 4px -2px rgba(20, 23, 27, 0.06);
    --shadow-lg: 0 12px 24px -6px rgba(20, 23, 27, 0.14), 0 4px 8px -4px rgba(20, 23, 27, 0.08);
    --shadow-xl: 0 20px 40px -10px rgba(20, 23, 27, 0.18), 0 8px 16px -8px rgba(20, 23, 27, 0.10);

    --border-radius:    0.75rem;
    --border-radius-sm: 0.5rem;
    --border-radius-lg: 1rem;
    --transition:      all 0.15s ease-out;
    --transition-fast: all 0.1s ease-out;
    --glass-bg:     rgba(246, 247, 248, 0.92);
    --glass-border: rgba(20, 23, 27, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--primary-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--text-color);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6, .app-name, .linea-numero, button, .btn {
    font-family: 'Manrope', 'Inter', sans-serif;
}

/* Cifras con ancho fijo: velocidad, hora, número de coche */
.tabular, .bus-time, .bus-number, .time-value {
    font-variant-numeric: tabular-nums;
}

/* ===== HEADER ===== */

.main-header {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    transition: var(--transition);
    overflow: visible;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(20,23,27,0.12));
    transition: var(--transition);
}

.logo:hover { transform: scale(1.05); }

.app-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.01em;
}

/* ===== OPTIONS MENU ===== */

.options-menu {
    position: relative;
    display: inline-block;
    z-index: 1001;
}

.options-toggle {
    background: var(--button-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.1rem;
    transition: var(--transition);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.options-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
}

.options-toggle:active { transform: translateY(0) scale(0.96); }

.options-toggle.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-1px) rotate(90deg);
    box-shadow: var(--shadow-lg);
}

/* ===== SETTINGS POPOVER ===== */

.settings-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 10001;
}

.settings-popover::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 16px;
    width: 10px;
    height: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

.settings-popover.show {
    opacity: 1;
    transform: translateY(0);
}

/* ===== DROPDOWN MENU ===== */

.options-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.97);
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 10000;
    overflow: hidden;
}

.options-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    z-index: -1;
}

.options-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item1 {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-out;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    min-height: 56px;
    white-space: nowrap;
    color: var(--text-color);
}

.dropdown-item1:last-child { border-bottom: none; }

.dropdown-item1:hover {
    background: var(--tertiary-bg);
    color: var(--accent-color);
    transform: translateX(2px);
}

.dropdown-item1:active { transform: translateX(1px) scale(0.99); }

.dropdown-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: var(--button-bg);
    border-radius: 8px;
    transition: var(--transition);
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 10px;
}

.dropdown-item1:hover .dropdown-icon {
    background: var(--accent-color);
    color: white;
    transform: scale(1.08);
}

.install-item { color: var(--accent-color); font-weight: 700; }
.install-item .dropdown-icon {
    background: var(--accent-dim);
    color: var(--accent-color);
    border: 1px solid rgba(var(--accent-color-raw), 0.2);
}
.install-item:hover { background: var(--accent-dim); color: var(--accent-hover); }
.install-item:hover .dropdown-icon { background: var(--accent-color); color: white; border-color: var(--accent-color); }
.install-item.hidden { display: none; }

.home-item .dropdown-icon {
    background: rgba(60, 107, 82, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(60, 107, 82, 0.2);
}
.home-item:hover .dropdown-icon { background: var(--success-color); color: white; border-color: var(--success-color); }

/* ===== MAP ===== */

#map {
    flex: 1;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* ===== SERVICE STATUS BANNER (errores API / sin coches) ===== */

.service-status-banner {
    position: fixed;
    top: 88px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 1002;
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.service-status-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.service-status-banner.banner-error {
    background: rgba(164, 69, 63, 0.95);
    color: #fff;
    animation: parpadeo-error 1.4s ease-in-out infinite;
}

.service-status-banner.banner-empty {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
}

@keyframes parpadeo-error {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}
.service-status-banner.banner-error.show { animation: parpadeo-error 1.4s ease-in-out infinite; }

/* ===== LOADING OVERLAY ===== */

.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(20, 23, 27, 0.45);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.spinner-container {
    text-align: center;
    z-index: 9999;
    padding: 2rem;
    background: var(--tertiary-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text { font-size: 0.9rem; font-weight: 600; color: var(--text-color); }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FIXED CONTROLS (bottom-right) ===== */

.fixed-controls {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.filter-button {
    pointer-events: all;
    position: relative;
    background: var(--tertiary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    cursor: pointer;
    overflow: visible;
}

.filter-button:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--accent-color-raw), 0.35);
}

.filter-button:active { transform: translateY(0) scale(0.97); }

.route-info { display: none; }
.route-divider { display: none; }

.info-panel {
    pointer-events: all;
    position: relative;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    overflow: visible;
}

.info-panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.info-panel:active { transform: translateY(0) scale(0.97); }

.report-problem {
    color: var(--error-color) !important;
    text-decoration: none;
}

.report-problem:hover {
    background: rgba(164, 69, 63, 0.1) !important;
    border-color: var(--error-color) !important;
    color: var(--error-color) !important;
}

/* ===== POPOVERS DE ETIQUETA ===== */

.map-btn-popover {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 10px;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1001;
}

.map-btn-popover::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: none;
    border-bottom: none;
}

.map-btn-popover.show {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ===== LOCATION BUTTON ===== */

.custom-location-control {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    z-index: 1000 !important;
    background: var(--tertiary-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 50% !important;
    box-shadow: var(--shadow-lg) !important;
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    color: var(--text-color) !important;
    padding: 0 !important;
    overflow: visible !important;
}

.custom-location-control:hover {
    background: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(var(--accent-color-raw), 0.35) !important;
}
.custom-location-control:active { transform: translateY(0) scale(0.97) !important; }

.location-popover {
    position: fixed;
    bottom: 30px;
    left: 86px;
    z-index: 1001;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 10px;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.location-popover::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-right: none;
    border-top: none;
}

.location-popover.show {
    opacity: 1;
    transform: translateX(0);
}

/* ===== MODAL ===== */

.modal { z-index: 9998; }

.modal-dialog {
    margin: 0;
    max-width: 100vw;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 30rem;
}

.modal-header {
    background: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: 1.25rem;
    color: var(--text-color);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    color: var(--text-color);
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    max-height: 60vh;
    background: var(--tertiary-bg);
    color: var(--text-color);
}

.modal-backdrop { background-color: rgba(20, 23, 27, 0.45) !important; }

.form-select,
.form-control { background-color: var(--secondary-bg); border-color: var(--border-color); color: var(--text-color); }
.form-text { color: var(--text-secondary); }
.btn-outline-primary { color: var(--accent-color); border-color: var(--accent-color); }
.btn-outline-primary:hover { background-color: var(--accent-color); border-color: var(--accent-color); }
.btn-check:checked + .btn-outline-primary { background-color: var(--accent-color); border-color: var(--accent-color); }
.btn-primary { background-color: var(--accent-color); border-color: var(--accent-color); transition: var(--transition); }
.btn-primary:hover { background-color: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { background-color: var(--slate-300); border-color: var(--slate-300); }

/* ===== ROUTE BUTTONS ===== */

.route-button {
    min-width: 90px;
    padding: 0.6rem;
    border: 2px solid var(--border-color);
    border-radius: 0.6rem;
    background: var(--secondary-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s ease-out;
    text-align: center;
}

.route-button:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.route-button:active { transform: translateY(0) scale(0.98); }

.route-button.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 10px rgba(var(--accent-color-raw), 0.35);
}

.route-button-name { font-size: 0.75rem; display: block; margin-top: 0.25rem; opacity: 0.9; }

/* ===== REQUEST STOP ===== */
/* MODIFICADO: la función se mantiene en el código, pero nunca se muestra al usuario */
.request-stop-container,
.request-stop-hidden {
    display: none !important;
}

.request-stop-button {
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(60, 107, 82, 0.35);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.ruta-linea-fila{
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.ruta-actual-label {
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: var(--accent-color);
    color: white;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(20, 23, 27, 0.2);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.4;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
}

.ruta-actual-label::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-left: none;
    border-bottom: none;
}

.ruta-actual-label .label-ruta { font-size: 11px; font-weight: 800; }
.ruta-actual-label .label-orientacion { font-size: 10px; font-weight: 500; opacity: 0.85; }

/* ===== BUS INFO CARDS ===== */

.bus-info-cards {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 280px;
}

.bus-info-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 0 2px 8px rgba(20,23,27,0.12);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.4s ease-out;
    min-height: 36px;
}

.bus-icon { font-size: 18px; flex-shrink: 0; }
.bus-details { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.bus-number { font-size: 12px; font-weight: 700; color: var(--text-color); white-space: nowrap; }
.bus-time { font-size: 11px; font-weight: 700; color: var(--success-color); white-space: nowrap; display: flex; align-items: center; gap: 3px; }

/* ===== STOP MARKER ===== */

.stop-marker {
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 0 4px rgba(164, 69, 63, 0.25);
    animation: pulse-stop 2s infinite;
}

/* ===== LEAFLET OVERRIDES ===== */

.leaflet-container { background: var(--slate-100); }
.leaflet-container a { color: inherit; }
.leaflet-control-zoom { margin-top: 88px !important; margin-left: 16px !important; }

.leaflet-bar {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    background: var(--tertiary-bg) !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-touch .leaflet-bar a {
    width: 44px !important; height: 44px !important;
    line-height: 42px !important; font-size: 1.1rem !important;
    border: none !important; background: transparent !important;
    color: var(--text-color) !important;
    transition: var(--transition) !important; font-weight: 600 !important;
}

.leaflet-touch .leaflet-bar a:hover { background: var(--accent-color) !important; color: white !important; }

.leaflet-popup-content {
    margin: 16px 20px !important; line-height: 1.5 !important;
    width: 220px !important; font-size: 0.85rem !important;
    font-weight: 500 !important; color: var(--slate-800) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-lg) !important;
    background: white !important;
}

/* ===== ANIMATIONS ===== */

@keyframes pulse-stop {
    0%, 100% { box-shadow: 0 0 0 0 rgba(164, 69, 63, 0.5); }
    50%      { box-shadow: 0 0 0 12px rgba(164, 69, 63, 0); }
}

@keyframes pulse-user {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-color-raw), 0.35); }
    50%      { box-shadow: 0 0 0 8px rgba(var(--accent-color-raw), 0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--secondary-bg); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== FOCUS / ACCESSIBILITY ===== */

.filter-button:focus-visible,
.custom-location-control:focus-visible,
.options-toggle:focus-visible,
.dropdown-item1:focus-visible,
.linea-button:focus-visible,
.route-button:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root { --border-color: #000000; --text-secondary: #000000; --text-muted: #1a1a1a; }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .main-header { left: 12px; right: 12px; top: 12px; height: 56px; padding: 0 1rem; }
    .options-dropdown { right: 28px; top: 68px; min-width: 180px; }
    .app-name { font-size: 0.95rem; }
    .options-toggle { width: 40px; height: 40px; font-size: 1rem; }
    .filter-button { width: 44px; height: 44px; font-size: 1.1rem; }
    .info-panel { width: 40px; height: 40px; font-size: 1rem; }
    .modal-dialog { padding: 0.75rem; align-items: flex-start; padding-top: 10vh; }
    .modal-body { padding: 1rem; max-height: fit-content; }
    .modal-header { padding: 1rem; }
    .modal-title { font-size: 1.05rem; }
    .leaflet-control-zoom { margin-left: 12px !important; margin-top: 72px !important; }
    .custom-location-control { left: 16px !important; bottom: 16px !important; width: 44px !important; height: 44px !important; }
    .fixed-controls { right: 16px !important; bottom: 16px !important; }
    .location-popover { left: 60px; bottom: 77px; }
    .bus-info-cards { top: 75px; right: 15px; max-width: 260px; }
    .bus-info-card { padding: 5px 8px; min-height: 32px; }
    .service-status-banner { top: 78px; font-size: 0.76rem; padding: 8px 16px; }
}

@media (max-width: 480px) {
    .main-header { left: 8px; right: 8px; top: 8px; height: 52px; padding: 0 0.75rem; }
    .options-dropdown { right: 24px; top: 60px; min-width: 180px; }
    .app-name { font-size: 0.85rem; }
    .options-toggle { width: 36px; height: 36px; font-size: 0.9rem; }
    .dropdown-item1 { padding: 12px 16px; font-size: 0.85rem; gap: 10px; min-height: 48px; }
    .dropdown-icon { width: 20px; height: 20px; font-size: 0.9rem; border-radius: 6px; }
    .filter-button { width: 42px; height: 42px; font-size: 1.05rem; }
    .info-panel { width: 38px; height: 38px; font-size: 0.95rem; }
    .modal-dialog { padding: 0.5rem; padding-top: 5vh; }
    .modal-body { padding: 0.875rem; max-height: fit-content; }
    .modal-header { padding: 0.875rem; }
    .modal-title { font-size: 0.95rem; }
    .custom-location-control { left: 12px !important; bottom: 74px !important; width: 42px !important; height: 42px !important; }
    .fixed-controls { right: 12px !important; bottom: 74px !important; }
    .leaflet-control-zoom { margin-left: 8px !important; margin-top: 64px !important; }
    .leaflet-touch .leaflet-bar a { width: 40px !important; height: 40px !important; line-height: 38px !important; font-size: 1rem !important; }
    .bus-info-cards { top: 70px; right: 12px; max-width: 240px; }
    .bus-icon { font-size: 16px; }
    .bus-number { font-size: 11px; }
    .bus-time { font-size: 10px; }
    .service-status-banner { top: 66px; font-size: 0.72rem; padding: 7px 14px; }
}

/* ===== BOTONES DE LÍNEA ===== */

.lineas-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.linea-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 10px 10px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: var(--secondary-bg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 90px;
    flex: 1;
    color: var(--text-color);
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    max-width: 10rem;
}

.linea-button:hover {
    border-color: var(--accent-color);
    background: var(--accent-dim);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(var(--accent-color-raw), 0.15);
}

.linea-button:active { transform: translateY(0) scale(0.98); }

.linea-button::after {
    content: '';
    position: absolute;
    top: 7px;
    right: 7px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    transition: all 0.18s ease;
}

.linea-button.active {
    border-color: var(--accent-color);
    background: var(--accent-dim);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-raw), 0.12), 0 6px 14px rgba(var(--accent-color-raw), 0.18);
    transform: translateY(-2px);
}

.linea-button.active::after {
    background: var(--accent-color);
    border-color: var(--accent-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

.linea-bus-icon { width: 32px; }
.linea-button.active .linea-bus-icon { color: var(--accent-color); transform: scale(1.1); }
.linea-button:hover .linea-bus-icon { transform: scale(1.08); }

.linea-numero {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
    color: var(--text-color);
}

.linea-button.active .linea-numero { color: var(--accent-color); }

.linea-subtitulo {
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
}

.linea-button.active .linea-subtitulo { color: var(--accent-color); opacity: 0.8; }

/* MODIFICADO: bloque "Próxima empresa" — visible, sin interacción, silueta apagada */
.linea-button.linea-proxima {
    cursor: not-allowed;
    opacity: 0.55;
    filter: grayscale(1);
    pointer-events: none;
}

.linea-button.linea-proxima:hover,
.linea-button.linea-proxima:active {
    transform: none;
    border-color: var(--border-color);
    background: var(--secondary-bg);
    box-shadow: none;
}

.linea-button.linea-proxima .linea-numero { color: var(--text-muted); font-style: italic; }
.linea-button.linea-proxima img { filter: brightness(0) opacity(0.35); }