/* ==========================================
   CSS VARIABLES & DESIGN TOKENS (TechTonic Pro)
   ========================================== */
:root {
    /* Brand */
    --primary: #B7FF3C;
    --primary-2: #A3E635;
    --primary-glow: rgba(183, 255, 60, .28);

    /* Dark UI */
    --secondary: #0F172A;
    --secondary-dark: #020617;

    --bg-app: #000000;
    --bg-sidebar: rgba(255, 255, 255, .03);
    --bg-card: rgba(255, 255, 255, .06);
    --bg-card-strong: rgba(255, 255, 255, .09);
    --bg-input: rgba(255, 255, 255, .08);

    --text-primary: #EAF2FF;
    --text-secondary: rgba(234, 242, 255, .78);
    --text-muted: rgba(234, 242, 255, .55);
    --text-on-dark: #F8FAFC;

    --border-color: rgba(255, 255, 255, .10);
    --border-strong: rgba(183, 255, 60, .25);

    --accent-success: #10B981;
    --accent-warning: #F59E0B;
    --accent-error: #EF4444;

    /* Shadows */
    --shadow-md: 0 10px 22px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, .45);

    /* Spacing */
    --spacing-xs: .5rem;
    --spacing-sm: .75rem;
    --spacing-md: 1.25rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Radius */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;

    /* Transitions */
    --transition-base: 250ms cubic-bezier(.4, 0, .2, 1);
}

/* ==========================================
   RESET & BASE
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   LAYOUT
   ========================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 440px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
    border-right: 1px solid var(--border-color);
    box-shadow: 12px 0 40px rgba(0, 0, 0, .35);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.map {
    width: 100%;
    height: 100%;
}

/* ==========================================
   SIDEBAR HEADER
   ========================================== */
.sidebar-header {
    padding: var(--spacing-xl) var(--spacing-lg);
    background: linear-gradient(180deg, rgba(183, 255, 60, .10), rgba(255, 255, 255, .02));
    border-bottom: 1px solid rgba(183, 255, 60, .22);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.app-brand {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 1;
}

.logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.app-logo {
    height: 90px;
    width: auto;
    object-fit: contain;
    opacity: .95;
    filter: drop-shadow(0 10px 28px rgba(0, 0, 0, .55)) drop-shadow(0 0 18px rgba(183, 255, 60, .22));
}

.app-title {
    font-size: 1.55rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-transform: uppercase;
}

.app-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Pulsante AVVIA nell'header */
.optimize-btn-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 16px;
    border: 1px solid rgba(183, 255, 60, .35);
    border-radius: 12px;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .35), transparent 45%),
        linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #0b0f0a;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    cursor: pointer;
    box-shadow:
        0 8px 20px rgba(183, 255, 60, .22),
        inset 0 -3px 0 rgba(0, 0, 0, .18);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    white-space: nowrap;
    min-width: 70px;
}

.optimize-btn-header svg {
    width: 18px;
    height: 18px;
}

.optimize-btn-header:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 28px rgba(183, 255, 60, .28),
        inset 0 -3px 0 rgba(0, 0, 0, .16);
}

.optimize-btn-header:active {
    transform: translateY(1px);
    box-shadow:
        0 6px 16px rgba(183, 255, 60, .20),
        inset 0 2px 0 rgba(0, 0, 0, .22);
}

/* ==========================================
   SIDEBAR CONTENT
   ========================================== */
.sidebar-content {
    flex: 1;
    padding: var(--spacing-xl);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .03);
    border-radius: 10px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .10);
    border-radius: 10px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .16);
}

/* ==========================================
   INPUT SECTION (CARDS)
   ========================================== */
.input-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    background: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.input-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.72rem;
    font-weight: 850;
    color: rgba(234, 242, 255, .88);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.label-location-detail {
    color: var(--primary);
    /* Lime Green */
    margin-left: var(--spacing-xs);
    font-weight: 700;
}

.label-icon {
    width: 16px;
    height: 16px;
    color: rgba(234, 242, 255, .85);
}

/* Inputs */
.address-input,
.warehouse-input {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-base);
}

.address-input {
    font-family: 'Inter', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    line-height: 1.6;
    resize: vertical;
    min-height: 180px;
}

.address-input:focus,
.warehouse-input:focus {
    outline: none;
    border-color: rgba(183, 255, 60, .55);
    box-shadow: 0 0 0 4px rgba(183, 255, 60, .18);
    background: rgba(255, 255, 255, .10);
}

.address-input::placeholder,
.warehouse-input::placeholder {
    color: rgba(255, 255, 255, .35);
}

/* Sidebar Footer */
.sidebar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.footer-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.address-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    font-weight: 600;
}

/* ==========================================
   SMALL ACTIONS (UPLOAD / RESET)
   ========================================== */
.clear-btn-small,
.upload-btn-small {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    transition: all var(--transition-base);
}

.clear-btn-small:hover {
    color: #ffd0d0;
    background: rgba(239, 68, 68, .10);
    border-color: rgba(239, 68, 68, .18);
}

.upload-btn-small:hover {
    color: rgba(234, 242, 255, .92);
    background: rgba(183, 255, 60, .10);
    border-color: rgba(183, 255, 60, .22);
}

/* ==========================================
   PRIMARY BUTTON (COMPACT) - AVVIA LOGISTICA
   - Ridotto di default + ancora più compatto su mobile
   ========================================== */
.optimize-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* se vuoi icona+testo separati: cambia in space-between */
    gap: var(--spacing-sm);
    padding: 1.05rem 1.25rem;
    /* ridotto */
    border: 1px solid rgba(183, 255, 60, .35);
    border-radius: 16px;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .35), transparent 45%),
        linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #0b0f0a;
    font-size: 0.98rem;
    /* ridotto */
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .10em;
    cursor: pointer;
    box-shadow:
        0 14px 34px rgba(183, 255, 60, .22),
        inset 0 -5px 0 rgba(0, 0, 0, .18);
    transition: transform var(--transition-base), box-shadow var(--transition-base), filter var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    /* evita "AVVIA" e "LOGISTICA" su due righe */
}

.optimize-btn::after {
    content: "";
    position: absolute;
    inset: -40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
    transform: rotate(20deg) translateX(-60%);
    transition: transform 600ms ease;
    pointer-events: none;
}

.optimize-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 20px 48px rgba(183, 255, 60, .28),
        inset 0 -5px 0 rgba(0, 0, 0, .16);
    filter: saturate(1.05);
}

.optimize-btn:hover::after {
    transform: rotate(20deg) translateX(60%);
}

.optimize-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 12px 28px rgba(183, 255, 60, .20),
        inset 0 4px 0 rgba(0, 0, 0, .22);
}

.optimize-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .12);
    color: rgba(234, 242, 255, .55);
    box-shadow: none;
}

/* Se nel bottone hai un’icona SVG/IMG con classe btn-icon */
.optimize-btn .btn-icon {
    width: 20px;
    height: 20px;
}

/* Se usi wrapper per icona tipo .btn-mark e testo .btn-text */
.optimize-btn .btn-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(11, 15, 10, .08);
    border: 1px solid rgba(11, 15, 10, .10);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.optimize-btn .btn-text {
    text-align: center;
    line-height: 1.05;
}

/* ==========================================
   GOOGLE MAPS BUTTON
   ========================================== */
/* ==========================================
   NAVIGATION BOX & LEGS
   ========================================== */
.navigation-box {
    background: var(--bg-card);
    border: 1px solid rgba(183, 255, 60, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.4s ease-out;
}

.navigation-box.hidden {
    display: none;
}

.navigation-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

.navigation-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.legs-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.leg-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
}

.leg-button:hover {
    background: rgba(183, 255, 60, 0.1);
    border-color: var(--primary);
    transform: translateX(4px);
}

.leg-icon-wrapper {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leg-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.leg-name {
    font-size: 0.85rem;
    font-weight: 700;
}

.leg-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==========================================
   MULTI-APP NAVIGATION STYLES
   ========================================== */
.leg-container {
    margin-bottom: 16px;
}

.leg-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px 8px 0 0;
    border: 1px solid rgba(183, 255, 60, 0.2);
}

.navigation-apps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 0 0 8px 8px;
    border: 1px solid rgba(183, 255, 60, 0.2);
    border-top: none;
}

.navigation-app-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: rgba(183, 255, 60, 0.1);
    border: 1px solid rgba(183, 255, 60, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: Inter, sans-serif;
}

.navigation-app-btn:hover {
    background: rgba(183, 255, 60, 0.2);
    border-color: rgba(183, 255, 60, 0.5);
    transform: translateY(-2px);
}

.navigation-app-btn:active {
    transform: translateY(0);
}

.app-icon {
    font-size: 24px;
}

.app-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* Mobile: stack verticalmente se lo spazio è limitato */
@media (max-width: 480px) {
    .navigation-apps-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   INFO PANEL
   ========================================== */
.info-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 900;
}

/* ==========================================
   SIDEBAR FOOTER
   ========================================== */
.sidebar-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid rgba(183, 255, 60, .22);
    background: rgba(255, 255, 255, .03);
}

.footer-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
}

/* ==========================================
   MAP OVERLAY & LOADING
   ========================================== */
.map-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    /* Medium Transparency */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    z-index: 9999;
    backdrop-filter: blur(4px);
    /* Reduced blur for visibility */
}

.map-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(255, 255, 255, .15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 28px rgba(183, 255, 60, .18);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-van {
    width: 280px;
    /* Branded image size */
    position: relative;
    padding-bottom: 20px;
    animation: van-run 0.6s ease-in-out infinite alternate,
        van-bounce 0.25s ease-in-out infinite;
    z-index: 6;
}

.van-img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(183, 255, 60, .35));
}

/* ==========================================
   BADGES & POPUP ENHANCEMENTS
   ========================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.badge-ok {
    background: rgba(183, 255, 60, 0.2);
    color: #B7FF3C;
    border: 1px solid rgba(183, 255, 60, 0.4);
}

.badge-warn {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

/* ==========================================
   GEOCODE RESULTS & WARNINGS
   ========================================== */
.geocode-results {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    animation: fadeIn 0.4s ease-out;
}

.geocode-results.hidden {
    display: none;
}

.geocode-warning-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.geocode-warning-text {
    font-size: 0.75rem;
    color: #ef4444;
    font-weight: 600;
}

.geocode-warning-addr {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

@keyframes van-run {
    from {
        transform: translateX(-10px);
    }

    to {
        transform: translateX(10px);
    }
}

@keyframes van-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.loading-text {
    font-size: 1rem;
    color: rgba(234, 242, 255, .80);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ==========================================
   UTILITY
   ========================================== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   RESPONSIVE DESIGN (MOBILE OPTIMIZATION)
   ========================================== */

/* Bottone Toggle Mobile (Nascosto su Desktop) */
.mobile-toggle-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 50%;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(183, 255, 60, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
    justify-content: center;
}

.mobile-toggle-btn svg {
    width: 28px;
    height: 28px;
}

@media (max-width: 768px) {
    .mobile-toggle-btn {
        display: flex;
    }

    .app-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 80vh;
        z-index: 9998;
        background: var(--bg-app);
        border-top: 1px solid var(--border-color);
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        /* Nascosta di default */
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
    }

    .sidebar.active {
        transform: translateY(0);
        /* Mostra sidebar */
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    }

    /* Maniglia per il drag visivo (stile bottom sheet) */
    .sidebar::before {
        content: '';
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
        margin: 12px auto;
        display: block;
    }

    .map-container {
        height: 100vh;
        width: 100%;
    }

    .sidebar-header {
        padding: 10px 20px;
    }

    .sidebar-content {
        padding: 0 20px 20px 20px;
        overflow-y: auto;
        flex: 1;
    }

    /* Animazione Rotazione Bottone */
    .sidebar.active~.mobile-toggle-btn {
        transform: rotate(90deg);
        background: #fff;
    }
}

@media (max-width: 520px) {
    .app-title {
        font-size: 1.2rem;
    }

    .optimize-btn {
        height: 60px;
        font-size: 0.9rem;
    }
}

/* ==========================================
   MAP OVERRIDES (Leaflet Dark Theme)
   ========================================== */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #000000 !important;
    /* Absolute Black */
    color: #FFFFFF !important;
    /* Pure White Text */
    border: 1px solid rgba(183, 255, 60, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.leaflet-popup-content {
    margin: 14px 18px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.leaflet-container a.leaflet-popup-close-button {
    color: rgba(234, 242, 255, 0.5) !important;
    padding: 10px 10px 0 0;
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: #B7FF3C !important;
}

/* Context Menu in Popup */
.map-context-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.ctx-btn {
    width: 100%;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    text-align: left;
}

.start-btn {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.start-btn:hover {
    background: rgba(245, 158, 11, 0.25);
    transform: translateX(4px);
}

.stop-btn {
    background: rgba(183, 255, 60, 0.15);
    color: #B7FF3C;
    border: 1px solid rgba(183, 255, 60, 0.3);
}


/* Saved Routes */
.saved-routes-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 8px;
}

.saved-routes-container::-webkit-scrollbar {
    width: 4px;
}

.saved-routes-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.saved-route-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
}

.saved-route-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.route-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.route-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.route-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.route-actions-row {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.action-btn-xs {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.65rem;
    padding: 4px 8px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 700;
    transition: all 0.2s;
}

.action-btn-xs:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-load {
    color: #B7FF3C;
    border-color: rgba(183, 255, 60, 0.2);
}

.btn-load:hover {
    background: rgba(183, 255, 60, 0.1);
}

.btn-merge {
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.2);
}

.btn-merge:hover {
    background: rgba(96, 165, 250, 0.1);
}

.btn-delete {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.empty-state {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 10px;
    font-style: italic;
}

/* ==========================================
   MODAL (GUIDE)
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-app);
    width: 100%;
    max-width: 900px;
    height: 85vh;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #020617;
    /* match guide style */
}

/* ==========================================
   TOGGLE SWITCH
   ========================================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(183, 255, 60, 0.3);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(24px);
    background-color: #0b0f0a;
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px rgba(183, 255, 60, 0.2);
}

/* ==========================================
   AUTO-SAVE TOAST NOTIFICATION
   ========================================= */
.auto-save-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #0b0f0a;
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(183, 255, 60, 0.4);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.auto-save-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.auto-save-toast svg {
    flex-shrink: 0;
}

.auto-save-toast.hidden {
    display: flex;
}

/* ==========================================
   GEOLOCATE BUTTON
   ========================================== */
.geolocate-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    background: rgba(11, 15, 10, 0.95);
    border: 2px solid var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.geolocate-btn svg {
    color: var(--primary);
    transition: all 0.3s ease;
}

.geolocate-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(183, 255, 60, 0.4);
}

.geolocate-btn:hover svg {
    color: #0b0f0a;
    transform: rotate(90deg);
}

.geolocate-btn:active {
    transform: scale(0.95);
}

.geolocate-btn.locating {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow: 0 4px 20px rgba(183, 255, 60, 0.6);
    }
}
