:root {
    --primary-bg: #0a0a0a;
    --secondary-bg: #1a1a1a;
    --tertiary-bg: #2a2a2a;
    --quaternary-bg: #3a3a3a;
    --accent-color: #4f46e5;
    --accent-hover: #4338ca;
    --text-color: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --button-bg: #374151;
    --button-hover: #4b5563;
    --border-color: #374151;
    --border-light: #4b5563;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --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(26, 26, 26, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --primary-bg: #ffffff;
    --secondary-bg: #f8fafc;
    --tertiary-bg: #f1f5f9;
    --quaternary-bg: #e2e8f0;
    --text-color: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --button-bg: #e2e8f0;
    --button-hover: #cbd5e1;
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-bg: rgba(248, 250, 252, 0.95);
    --glass-border: rgba(0, 0, 0, 0.1);
}

* {
    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;
    transition: background-color 0.2s ease-out, color 0.2s ease-out;
}

/* ===== 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;
}

.main-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--accent-color) 0%, transparent 100%);
    opacity: 0.03;
    pointer-events: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1;
}

.logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: var(--transition);
}

.logo:hover { transform: scale(1.05); }

.app-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--text-color) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: var(--transition);
}

/* ===== 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::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    opacity: 0;
    transition: var(--transition);
    border-radius: inherit;
}

.options-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
}

.options-toggle:hover::before { opacity: 0.1; }

.options-toggle.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-1px) rotate(90deg);
    box-shadow: var(--shadow-lg);
}

.options-toggle.active::before { opacity: 0.2; }
.options-toggle i { position: relative; z-index: 1; transition: var(--transition); }

/* ===== SETTINGS POPOVER (debajo del botón de ajustes) ===== */

.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.95);
    transition: all 0.3s 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.2s 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-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.1);
}

.dropdown-icon i { transition: var(--transition); }

.install-item { color: var(--accent-color); font-weight: 700; }
.install-item .dropdown-icon {
    background: rgba(79, 70, 229, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(79, 70, 229, 0.2);
}
.install-item:hover { background: rgba(79, 70, 229, 0.1); 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; }

.theme-item .dropdown-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.theme-item:hover .dropdown-icon { background: var(--warning-color); color: white; border-color: var(--warning-color); }

.home-item .dropdown-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.home-item:hover .dropdown-icon { background: var(--success-color); color: white; border-color: var(--success-color); }

[data-theme="light"] .dropdown-item1 { color: var(--text-color); }
[data-theme="light"] .dropdown-icon { color: var(--text-secondary); }

/* ===== MAP ===== */

#map {
    flex: 1;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* ===== LOADING OVERLAY ===== */

.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10, 10, 10, 0.8);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center; 
    pointer-events: none;

}

[data-theme="light"] .loading-overlay { background: rgba(255, 255, 255, 0.8); }

.spinner-container {
    text-align: center;
    z-index: 9999;
    padding: 2rem;
    background: var(--secondary-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;
}

/* Botón de rutas — icono + texto mínimo */
.filter-button {
    pointer-events: all;
    position: relative;
    background: var(--secondary-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 6px 20px rgba(79, 70, 229, 0.4);
}

/* El route-info y route-divider ya no se usan visualmente en el botón,
   pero los dejamos ocultos por si el JS los referencia */
.route-info { display: none; }
.route-divider { display: none; }

/* Botón de reportar problema — solo icono circular */
.info-panel {
    pointer-events: all;
    position: relative;
    background: var(--secondary-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);
}

.report-problem {
    color: var(--error-color) !important;
    text-decoration: none;
}

.report-problem:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: var(--error-color) !important;
    color: var(--error-color) !important;
}

/* ===== POPOVERS DE ETIQUETA (aparecen al buscar y desaparecen solos) ===== */

.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 — solo icono circular ===== */

.custom-location-control {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    z-index: 1000 !important;
    background: var(--secondary-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 6px 20px rgba(79, 70, 229, 0.4) !important;
}

/* Popover del botón de ubicación (a la derecha del botón) */
.location-popover {
    position: fixed;
    bottom: 30px;
    left: 86px; /* 24px left + 48px botón + 14px gap */
    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(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 30rem;
}

.modal-header {
    background: var(--tertiary-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.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    color: var(--text-color);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    max-height: 60vh;
    background: var(--secondary-bg);
    color: var(--text-color);
}

.modal-backdrop { background-color: rgba(0, 0, 0, 0.5) !important; }
[data-theme="light"] .modal-backdrop { background-color: rgba(0, 0, 0, 0.3) !important; }

/* ===== DARK THEME MODAL OVERRIDES ===== */

[data-theme="dark"] .modal-content { background-color: #1a1a1a; color: #ffffff; }
[data-theme="dark"] .modal-header { background-color: #2a2a2a; border-bottom-color: #374151; }
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control { background-color: #2a2a2a; border-color: #374151; color: #ffffff; }
[data-theme="dark"] .form-text { color: #ffffffbf; }
[data-theme="dark"] .btn-outline-primary { color: #4f46e5; border-color: #4f46e5; }
[data-theme="dark"] .btn-outline-primary:hover { background-color: #4f46e5; border-color: #4f46e5; }
[data-theme="dark"] .btn-check:checked + .btn-outline-primary { background-color: #4f46e5; border-color: #4f46e5; }

/* ===== ROUTE BUTTONS ===== */

.route-button {
    min-width: 90px;
    padding: 0.5rem;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.route-button:hover {
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.route-button.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
    box-shadow: 0 4px 6px rgba(13, 110, 253, 0.4);
}

.route-button-name { font-size: 0.75rem; display: block; margin-top: 0.25rem; opacity: 0.9; }

[data-theme="dark"] .route-button { background: #2a2a2a; border-color: #374151; color: #ffffff; }
[data-theme="dark"] .route-button:hover { border-color: #4f46e5; }
[data-theme="dark"] .route-button.active { background: #4f46e5; border-color: #4f46e5; }

/* ===== REQUEST STOP (bottom-left) ===== */

.request-stop-container {
    position: fixed;
    bottom: 86px;
    left: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.request-stop-button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}
 
.ruta-linea-fila{
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}
.tiempo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
}

.tiempo-item i {
    font-size: 0.9rem;
    color: #a5b4fc;
}

.ruta-actual-label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: rgba(79, 70, 229, 0.95);
    color: white;
    font-family: 'Inter', 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(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    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;
}

/* Flecha apuntando hacia la derecha (hacia el botón) */
.ruta-actual-label::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: rgba(79, 70, 229, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    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;
}

#paradaPopover {
    right: auto;
    left: calc(100% + 10px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%) translateX(-6px);
    white-space: nowrap;
}

#paradaPopover.show {
    transform: translateY(-50%) translateX(0);
}

/* Flecha apuntando hacia la izquierda (hacia el botón) */
#paradaPopover::after {
    right: auto;
    left: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(225deg);
    border-left: none;
    border-bottom: none;
    border-right: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border);
}

.request-stop-button:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16,185,129,0.5); }
.request-stop-button:active { transform: translateY(0); }
.request-stop-button:disabled { background: #9ca3af; cursor: not-allowed; box-shadow: none; }

.tiempo-usuario-parada {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: rgba(0,0,0,0.6);
    border-radius: 12px;
    padding: 8px 8px;
    backdrop-filter: blur(8px);
}

.tiempo-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tiempo-content { display: flex; align-items: center; gap: 8px; }

.tiempo-caminando { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #10b981; }
.tiempo-auto { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #3b82f6; }
.tiempo-divider { width: 1px; height: 16px; background: var(--border-color); }

/* ===== 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(0,0,0,0.15);
    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: #10b981;
    white-space: nowrap; display: flex; align-items: center; gap: 3px;
}

.bus-chofer {
    font-size: 10px; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px;
}

/* ===== STOP MARKER ===== */

.stop-marker {
    background: #ef4444;
    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(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
}

/* ===== USER TIME PANEL ===== */

.user-time-panel {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    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);
    padding: 12px 16px;
    z-index: 1000;
    min-width: 280px;
    animation: slideUp 0.4s ease-out;
}

.panel-header {
    font-size: 11px; font-weight: 600; color: var(--text-secondary);
    text-align: center; margin-bottom: 8px;
    text-transform: uppercase; letter-spacing: 0.5px; display: block;
}

.time-options { display: flex; align-items: center; gap: 12px; }

.time-option { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }

.time-icon { font-size: 24px; }

.time-label {
    font-size: 10px; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
}

.time-value {
    font-size: 16px; font-weight: 800; color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

.time-divider { width: 1px; height: 40px; background: var(--border-color); }

/* ===== LEAFLET OVERRIDES ===== */

.leaflet-container { background: var(--primary-bg); }
.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(--secondary-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(--secondary-bg) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-lg) !important;
    background: white !important;
}

/* ===== ANIMATIONS ===== */

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(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,
.custom-location-control:focus,
.options-toggle:focus,
.dropdown-item1:focus { 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: #ffffff; --text-secondary: #ffffff; --text-muted: #cccccc; }
}

/* ===== 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: 1rem; }
    .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.125rem; }
    .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; }
    .request-stop-container { bottom: 72px; left: 16px; }
    .location-popover { left: 74px; bottom: 16px; }
    .bus-info-cards { top: 75px; right: 15px; max-width: 260px; }
    .bus-info-card { padding: 5px 8px; min-height: 32px; }
    .user-time-panel { min-width: 260px; padding: 10px 14px; bottom: 20px; }
    .time-value { font-size: 14px; }
    .time-icon { font-size: 20px; }
}

@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.9rem; }
    .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: 1rem; }
    .custom-location-control { left: 12px !important; bottom: 12px !important; width: 42px !important; height: 42px !important; }
    .fixed-controls { right: 12px !important; bottom: 12px !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; }
    .request-stop-container { bottom: 64px; left: 12px; }
    .request-stop-button { padding: 10px 14px; }
    .location-popover { left: 68px; bottom: 18px; }
    .tiempo-usuario-parada { padding: 8px 10px; }
    .tiempo-header { font-size: 9px; }
    .tiempo-caminando, .tiempo-auto { font-size: 11px; }
    .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; }
    .bus-chofer { font-size: 9px; max-width: 80px; }
    .user-time-panel { min-width: 240px; padding: 8px 12px; bottom: 16px; }
    .panel-header { font-size: 10px; margin-bottom: 6px; }
    .time-value { font-size: 13px; }
    .time-icon { font-size: 18px; }
    .time-label { font-size: 9px; }
}
/* ===== 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(--tertiary-bg);
    cursor: pointer;
    transition: all 0.22s 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: rgba(79, 70, 229, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.18);
}

.linea-button:active {
    transform: translateY(0);
}

/* Checkmark en la esquina */
.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: rgba(79, 70, 229, 0.13);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15), 0 6px 16px rgba(79, 70, 229, 0.2);
    transform: translateY(-2px);
}

.linea-button.active::after {
    background: var(--accent-color);
    border-color: var(--accent-color);
    /* checkmark via clip-path trick */
    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;
}

/* Ícono de bus dentro del botón */
.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);
}

/* Número/nombre de la línea */
.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);
}

/* Subtítulo de la línea (nombre corto) */
.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: rgba(79, 70, 229, 0.75);
}

/* Adaptación para tema oscuro (ya hereda variables, pero reforzar) */
[data-theme="dark"] .linea-button {
    background: var(--tertiary-bg);
}

[data-theme="dark"] .linea-button:hover {
    background: rgba(79, 70, 229, 0.1);
}

[data-theme="dark"] .linea-button.active {
    background: rgba(79, 70, 229, 0.15);
}
