/* ==========================================================================
   DISEÑO DE SISTEMA - VARIABLES Y TEMAS (RutaOptima)
   ========================================================================== */
:root {
    /* Tema Oscuro (Por defecto) */
    --bg-app: #0b0f19;
    --bg-panel: rgba(15, 23, 42, 0.7);
    --bg-card: rgba(30, 41, 59, 0.55);
    --bg-input: rgba(15, 23, 42, 0.6);
    --bg-hover: rgba(51, 65, 85, 0.4);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(99, 102, 241, 0.5);
    
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-accent: #a5b4fc;
    
    --accent: #6366f1; /* Indigo */
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --accent-glow: rgba(99, 102, 241, 0.35);
    
    --accent-success: #10b981; /* Verde */
    --accent-success-glow: rgba(16, 185, 129, 0.2);
    --accent-warning: #f59e0b; /* Naranja */
    --accent-danger: #f43f5e; /* Rojo */
    --accent-danger-hover: #e11d48;
    
    --glass-blur: blur(16px);
    --shadow-elevation: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px var(--accent-glow);
    
    --scroll-thumb: #334155;
    --scroll-track: #1e293b;
    --map-filter: invert(90%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.light-theme {
    /* Tema Claro */
    --bg-app: #f1f5f9;
    --bg-panel: rgba(255, 255, 255, 0.75);
    --bg-card: rgba(241, 245, 249, 0.8);
    --bg-input: #ffffff;
    --bg-hover: rgba(226, 232, 240, 0.8);
    
    --border-color: rgba(15, 23, 42, 0.08);
    --border-color-focus: rgba(99, 102, 241, 0.5);
    
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --text-accent: #4f46e5;
    
    --accent: #4f46e5;
    --accent-hover: #3730a3;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --accent-glow: rgba(79, 70, 229, 0.15);
    
    --accent-success: #059669;
    --accent-success-glow: rgba(5, 150, 105, 0.15);
    --accent-warning: #d97706;
    --accent-danger: #e11d48;
    --accent-danger-hover: #be123c;
    
    --shadow-elevation: 0 10px 30px -5px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.2);
    
    --scroll-thumb: #cbd5e1;
    --scroll-track: #f1f5f9;
    --map-filter: none;
}

/* ==========================================================================
   ESTILOS BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Scrollbars personalizadas */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--scroll-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Contenedor principal de la app */
.app-container {
    display: flex;
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ==========================================================================
   SIDEBAR PANEL (Controles y Ajustes)
   ========================================================================== */
.sidebar-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    bottom: 16px;
    width: 400px;
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    z-index: 1000;
    box-shadow: var(--shadow-elevation);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
}

/* Header del panel */
.app-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.app-header .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Botón alternador de tema */
.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.theme-toggle-btn .sun-icon,
.theme-toggle-btn .lucide-sun,
.dark-theme .theme-toggle-btn .moon-icon,
.dark-theme .theme-toggle-btn .lucide-moon {
    display: none !important;
}

.theme-toggle-btn .moon-icon,
.theme-toggle-btn .lucide-moon,
.dark-theme .theme-toggle-btn .sun-icon,
.dark-theme .theme-toggle-btn .lucide-sun {
    display: block !important;
    width: 18px;
    height: 18px;
}


/* Contenido del Sidebar */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Tarjetas de control */
.control-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.card-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

/* ==========================================================================
   SECCIONES Y CONTROLES ESPECÍFICOS
   ========================================================================== */

/* Punto de Partida */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(148, 163, 184, 0.1);
    margin-bottom: 10px;
}

.status-indicator.success {
    background: var(--accent-success-glow);
    color: var(--accent-success);
}

.status-indicator.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-warning);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.status-indicator.success .status-dot {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Buscador e Inputs */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 400;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: var(--text-muted);
    cursor: pointer;
}

.search-icon-btn:hover {
    color: var(--accent);
}

.search-icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Listas de Sugerencias */
.suggestions-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1100;
    list-style: none;
    box-shadow: var(--shadow-elevation);
    backdrop-filter: var(--glass-blur);
}

.suggestions-list li {
    padding: 10px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: normal;
    line-height: 1.4;
    word-break: break-word;
}

.suggestions-list li:last-child {
    border-bottom: none;
}

.suggestions-list li:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.suggestions-list .loading-item {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.suggestions-list .no-results-item {
    text-align: center;
    color: var(--accent-danger);
    cursor: default;
}

.suggestions-list.hidden {
    display: none;
}

/* Tip / Muted Text */
.tip-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.icon-inline {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--text-accent);
}

/* Botones */
.btn-group-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.flex-1 {
    flex: 1;
}

button {
    font-family: inherit;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn {
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    box-shadow: var(--shadow-glow);
}

.primary-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.5);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.primary-btn:disabled {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.6;
}

.secondary-btn {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-accent);
}

.btn-full {
    width: 100%;
    padding: 10px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
}

.text-btn {
    background: transparent;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
}

.text-btn.danger {
    color: var(--accent-danger);
}

.text-btn.danger:hover {
    background: rgba(244, 63, 94, 0.1);
    border-radius: 6px;
}

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

/* Contenedor del listado de paradas */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stops-list-container {
    max-height: 240px;
    overflow-y: auto;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.25);
    border: 1px solid var(--border-color);
}

.placeholder-content {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.placeholder-content svg {
    width: 32px;
    height: 32px;
    stroke-width: 1.5;
    opacity: 0.5;
}

.placeholder-content p {
    font-size: 0.75rem;
    line-height: 1.4;
}

.stops-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.stop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    animation: slideIn 0.2s ease-out forwards;
}

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

.stop-item:last-child {
    border-bottom: none;
}

.stop-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.stop-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.stop-badge.start {
    background: var(--accent-success);
}

.stop-badge.dest {
    background: var(--accent-danger);
}

.stop-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.stop-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
}

.action-icon-btn:hover {
    background: var(--bg-hover);
}

.action-icon-btn.delete-btn:hover {
    color: var(--accent-danger);
    background: rgba(244, 63, 94, 0.1);
}

.action-icon-btn svg {
    width: 14px;
    height: 14px;
}

/* Configuraciones */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.styled-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 10px;
    outline: none;
    font-size: 0.8rem;
    font-weight: 400;
    cursor: pointer;
    width: 100%;
}

.styled-select:focus {
    border-color: var(--border-color-focus);
}

/* Contenedor de Acción Principal */
.action-container {
    margin: 8px 0;
}

.action-container button {
    width: 100%;
}

/* ==========================================================================
   RESULTADOS DE OPTIMIZACIÓN
   ========================================================================== */
.results-card {
    border: 1.5px solid var(--accent-success);
    background: rgba(16, 185, 129, 0.04);
}

.success-text {
    color: var(--accent-success) !important;
}

.success-text svg {
    color: var(--accent-success) !important;
}

.results-stats {
    display: flex;
    gap: 8px;
}

.stat-box {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.results-route-list h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.optimized-steps-list {
    margin-left: 20px;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-primary);
}

.optimized-steps-list li {
    padding-left: 4px;
    line-height: 1.4;
}

.optimized-steps-list li strong {
    color: var(--text-accent);
}

.export-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.export-btn {
    width: 100%;
    padding: 10px;
}

.gmaps-btn {
    background: #4285F4;
    color: #ffffff;
    border: none;
}

.gmaps-btn:hover {
    background: #357ae8;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.4);
    transform: translateY(-1px);
}

.gmaps-btn svg {
    margin-right: 2px;
}

/* Tramos de Google Maps */
.gmaps-links-area {
    width: 100%;
}

.gmaps-multi-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(66, 133, 244, 0.08);
    border: 1px solid rgba(66, 133, 244, 0.25);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 6px;
}

.multi-links-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-accent);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.gmaps-buttons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.gmaps-segment-btn {
    background: #4285F4;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    width: 100%;
}

.gmaps-segment-btn:hover {
    background: #357ae8;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
    transform: translateY(-1px);
}

.gmaps-segment-btn:active {
    transform: translateY(0);
}

/* Banner de Fallback */
.fallback-banner {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-warning);
    color: #000000;
    padding: 10px 18px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    font-size: 0.85rem;
    font-weight: 600;
    animation: slideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDown {
    from { transform: translate(-50%, -40px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.fallback-banner.hidden {
    display: none;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.banner-content svg {
    width: 18px;
    height: 18px;
}

.close-banner {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    color: #000000;
    opacity: 0.6;
    padding: 0 4px;
}

.close-banner:hover {
    opacity: 1;
}

/* ==========================================================================
   INTERACTIVE MAP VIEW
   ========================================================================== */
.map-view {
    flex: 1;
    height: 100%;
    z-index: 1;
    background-color: var(--bg-app);
}

/* Inversión de colores del mapa de Leaflet en tema oscuro para look Premium */
.dark-theme .leaflet-tile-container img {
    filter: var(--map-filter);
}

.dark-theme .leaflet-container {
    background: #111b2d;
}

/* Modificamos los popups y controles nativos de Leaflet */
.leaflet-popup-content-wrapper {
    background: var(--bg-app) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    backdrop-filter: var(--glass-blur);
    font-family: inherit;
}

.leaflet-popup-tip {
    background: var(--bg-app) !important;
    border: 1px solid var(--border-color);
}

.leaflet-bar {
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-elevation) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-bar a {
    background-color: var(--bg-panel) !important;
    backdrop-filter: var(--glass-blur);
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    transition: background 0.2s;
}

.leaflet-bar a:hover {
    background-color: var(--bg-hover) !important;
    color: var(--accent) !important;
}

.leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.6) !important;
    color: var(--text-muted) !important;
    backdrop-filter: var(--glass-blur);
    font-size: 0.65rem !important;
}

/* Estilo para los marcadores personalizados en el mapa */
.custom-div-icon {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: var(--accent);
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -16px 0 0 -16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 2px solid #ffffff;
}

.marker-pin::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffffff;
    position: absolute;
}

.marker-label {
    color: #ffffff;
    transform: rotate(45deg);
    font-weight: 700;
    font-size: 11px;
    z-index: 10;
    margin-bottom: 2px;
    margin-right: 2px;
}

.marker-pin.start {
    background: var(--accent-success);
    box-shadow: 0 0 12px var(--accent-success);
}
.marker-pin.start::after {
    display: none;
}

.marker-pin.dest {
    background: var(--accent-danger);
}
.marker-pin.dest::after {
    display: none;
}

/* Pulsación para GPS actual */
.gps-pulse-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4);
    animation: gpsPulse 2.5s infinite;
}

@keyframes gpsPulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* ==========================================================================
   LOADING OVERLAY (Animaciones Premium)
   ========================================================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: var(--glass-blur);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-overlay.hidden {
    display: none;
}

.spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-elevation);
    position: relative;
    max-width: 320px;
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.pulse-ring {
    position: absolute;
    top: 30px; /* Alineado con el spinner */
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: ringGlow 1.8s ease-out infinite;
    opacity: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ringGlow {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.6); opacity: 0; }
}

#loading-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ==========================================================================
   RESPONSIVIDAD MÓVIL
   ========================================================================== */
.sidebar-toggle-mobile {
    display: none;
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    cursor: pointer;
}

.sidebar-toggle-mobile svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 768px) {
    .sidebar-panel {
        top: 0;
        left: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
        transform: translateX(-100%);
    }
    
    .sidebar-panel.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle-mobile {
        display: flex;
    }
    
    .sidebar-toggle-mobile .close-icon.hidden,
    .sidebar-toggle-mobile .menu-icon.hidden {
        display: none;
    }
    
    .sidebar-toggle-mobile .close-icon,
    .sidebar-toggle-mobile .menu-icon {
        display: block;
    }
    
    .fallback-banner {
        width: calc(100% - 32px);
        font-size: 0.8rem;
    }
}

/* Estilos de Carga Masiva */
.card-separator {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 8px 0;
}
.card-separator::before,
.card-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}
.card-separator:not(:empty)::before {
    margin-right: .5em;
}
.card-separator:not(:empty)::after {
    margin-left: .5em;
}

.bulk-upload-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bulk-links {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.template-link {
    color: var(--text-accent);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.template-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.template-link svg {
    width: 14px;
    height: 14px;
}

/* Historial de Rutas */
.history-container {
    max-height: 250px;
    overflow-y: auto;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.25);
    border: 1px solid var(--border-color);
}

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    gap: 8px;
    transition: background-color 0.2s;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background-color: var(--bg-hover);
}

.history-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item-title {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-icon-btn.load-btn:hover {
    color: var(--accent-success);
    background: var(--accent-success-glow);
}
