/* Raggruppare gli stili per componente/sezione */

/* Variables */
:root {
    --primary: #4CAF50;
    --primary-hover: #45a049;
    --danger: #ff4444;
    --text-dark: #333;
    --text-light: #666;
    --border: #e0e0e0;
    --bg-light: #f8f9fa;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Stili per le statistiche flottanti */
.floating-route-stats {
    position: fixed; /* Cambiato da absolute a fixed per migliore posizionamento */
    bottom: 30px;
    left: 62.5%; /* Centrato rispetto alla parte della mappa (sidebar è 25%, quindi siamo al centro del 75% restante) */
    transform: translateX(-50%); /* Centrato perfettamente */
    z-index: 1002; /* Aumentato z-index per assicurarsi che sia sempre visibile */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 8px 12px; /* Ridotto da 10px 15px */
    width: 220px; /* Ridotto da 250px */
    font-size: 13px; /* Ridotto da 14px */
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(224, 224, 224, 0.8);
}

.floating-stats-content {
    display: flex;
    justify-content: space-between; /* Cambiato da space-around a space-between per più spazio tra gli elementi */
    align-items: center;
    width: 100%; /* Assicura che gli elementi si distanzino correttamente */
}

.floating-stat {
    display: flex;
    align-items: center;
    gap: 6px; /* Ridotto da 8px */
    color: #333;
    font-weight: 600;
    font-size: 14px; /* Ridotto da 15px */
}

.floating-stat svg {
    color: #4CAF50;
    stroke-width: 2.2;
}

/* Responsive per le statistiche flottanti */
@media screen and (max-width: 768px) {
    .floating-route-stats {
        bottom: calc(13vh + 10px); /* 10px sopra la bottom bar che è alta 13vh */
        left: 50%; /* Centrato orizzontalmente */
        transform: translateX(-50%); /* Correzione per centrare perfettamente */
        width: auto; /* Dimensione automatica in base al contenuto */
        max-width: 200px; /* Larghezza massima più contenuta */
        padding: 6px 12px; /* Padding più piccolo ma più largo ai lati */
        z-index: 1010; /* Z-index più alto per essere sopra tutti gli elementi della UI mobile */
        border-radius: 6px; /* Border radius leggermente ridotto */
    }
    
    .floating-stats-content {
        justify-content: space-between; /* Più spazio tra gli elementi */
        gap: 15px; /* Aggiunto gap esplicito tra gli elementi delle statistiche */
    }
    
    .floating-stat {
        font-size: 12px; /* Font più piccolo */
        gap: 5px; /* Spazio ridotto tra icona e testo */
        white-space: nowrap; /* Impedisce il wrapping del testo */
    }
    
    .floating-stat svg {
        width: 14px; /* Icona più piccola */
        height: 14px; /* Icona più piccola */
    }
}

body {
    font-family: Arial, sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Layout */
#sidebar {
    width: 25%;
    background: var(--bg-light);
    padding: 20px;
    overflow-y: auto;
    z-index: 2;
    transition: var(--transition);
}

#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* Componenti */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.button-primary {
    background: var(--primary);
    color: white;
}

.button-danger {
    background: var(--danger);
    color: white;
}

/* ... altri componenti ... */

/* Media Queries */
@media screen and (max-width: 768px) {
    body {
        flex-direction: column;
    }

    #sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
    width: 26px;
    height: 36px;
        height: 35vh;
        padding: 10px 10px 40px;
        transform: translateY(0);
        transition: transform 0.3s ease;
        z-index: 1000;
        background: #f8f9fa;
    }

    #map {
        width: 100%;
        height: 100vh !important;
    }

    .toggle-sidebar {
        display: block;
    }
    .toggle-sidebar.hidden {
        display: none !important;
    }

    .floating-upload {
        display: none;
    }

    /* ... altre regole mobile ... */
}

@media screen and (max-width: 480px) {
    /* Regole specifiche per schermi molto piccoli */
}

/* Layout Base */
/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Definire variabili CSS per colori e valori comuni */
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --text-color: #333;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Controlli Percorso - Desktop */
.route-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.route-control-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    color: #666;
    font-weight: 600;
    background: #f5f5f5;
}

.route-control-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.reverse-btn {
    background: #f5f5f5;
    border: 1px solid #c8e6c9;
}

.reverse-btn:hover {
    background: #f1f8f1;
    border-color: #4CAF50;
    transform: translateY(-1px);
}

.clear-btn {
    background: #f5f5f5;
    border: 1px solid #ffcdd2;
}

.clear-btn:hover {
    background: #fff5f5;
    border-color: #ef5350;
    transform: translateY(-1px);
}

.poi-options {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 12px;
}

/* Stili per i pulsanti del calcolo percorso - simile a poi-options */
.route-type-options {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 12px;
}

/* Nuovo stile per i pulsanti POI */
.poi-button {

    .route-item {
        flex-direction: column;
        padding: 16px;
    }

    .route-preview {
        width: 100%;
        flex: none;
        aspect-ratio: 4 / 3;
    }

    .route-details {
        width: 100%;
        gap: 10px;
    }
    flex: 1;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    width: 100%;
    height: 100%;
    box-shadow: var(--shadow-sm);
    outline: none;
    position: relative;
    overflow: hidden;
}

/* Colori specifici per ciascun tipo di POI */
.poi-button[data-poi-type="passes"] {
    border-color: rgba(40, 117, 43, 0.3);
}

.poi-button[data-poi-type="roads"] {
    border-color: rgba(33, 150, 243, 0.3);
}

.poi-button[data-poi-type="picnic"] {
    border-color: rgba(121, 85, 72, 0.3);
}

.poi-button[data-active="true"] {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

@keyframes subtle-pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(40, 117, 43, 0.3); }
    70% { box-shadow: 0 0 0 6px rgba(40, 117, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 117, 43, 0); }
}

@keyframes subtle-pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.3); }
    70% { box-shadow: 0 0 0 6px rgba(33, 150, 243, 0); }
    100% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}

@keyframes subtle-pulse-brown {
    0% { box-shadow: 0 0 0 0 rgba(121, 85, 72, 0.3); }
    70% { box-shadow: 0 0 0 6px rgba(121, 85, 72, 0); }
    100% { box-shadow: 0 0 0 0 rgba(121, 85, 72, 0); }
}

.poi-button[data-active="true"][data-poi-type="passes"] {
    background-color: rgba(40, 117, 43, 0.15);
    border-color: rgba(40, 117, 43, 0.5);
    animation: subtle-pulse-green 2s infinite;
}

.poi-button[data-active="true"][data-poi-type="roads"] {
    background-color: rgba(33, 150, 243, 0.15);
    border-color: rgba(33, 150, 243, 0.5);
    animation: subtle-pulse-blue 2s infinite;
}

.poi-button[data-active="true"][data-poi-type="picnic"] {
    background-color: rgba(121, 85, 72, 0.15);
    border-color: rgba(121, 85, 72, 0.5);
    animation: subtle-pulse-brown 2s infinite;
}

.poi-button[data-active="true"] .poi-icon {
    stroke-width: 2.5;
    transform: scale(1.1);
}

.poi-button[data-poi-type="passes"] .poi-icon {
    stroke: #28752B;
}

.poi-button[data-active="true"][data-poi-type="passes"] .poi-icon {
    stroke: #28752B;
}

.poi-button[data-poi-type="roads"] .poi-icon {
    stroke: #2196F3;
}

.poi-button[data-active="true"][data-poi-type="roads"] .poi-icon {
    stroke: #2196F3;
}

.poi-button[data-poi-type="picnic"] .poi-icon {
    stroke: #795548;
}

.poi-button[data-active="true"][data-poi-type="picnic"] .poi-icon {
    stroke: #795548;
}

.poi-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.poi-button[data-poi-type="passes"]:hover {
    background-color: rgba(40, 117, 43, 0.05);
    border-color: rgba(40, 117, 43, 0.4);
}

.poi-button[data-poi-type="roads"]:hover {
    background-color: rgba(33, 150, 243, 0.05);
    border-color: rgba(33, 150, 243, 0.4);
}

.poi-button[data-poi-type="picnic"]:hover {
    background-color: rgba(121, 85, 72, 0.05);
    border-color: rgba(121, 85, 72, 0.4);
}

.poi-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Stili specifici per i pulsanti del calcolo percorso */
.route-type-button[data-active="true"] {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.route-type-button[data-route-type="driving"][data-active="true"] {
    background-color: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.5);
}

.route-type-button[data-route-type="driving-no-toll"][data-active="true"] {
    background-color: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.5);
}

.route-type-button[data-route-type="cycling"][data-active="true"] {
    background-color: rgba(156, 39, 176, 0.15);
    border-color: rgba(156, 39, 176, 0.5);
}

.route-type-button[data-active="true"] .poi-icon {
    transform: scale(1.1);
}

.route-type-button[data-route-type="driving"][data-active="true"] span {
    color: #4CAF50;
    font-weight: 600;
}

.route-type-button[data-route-type="driving-no-toll"][data-active="true"] span {
    color: #FF9800;
    font-weight: 600;
}

.route-type-button[data-route-type="cycling"][data-active="true"] span {
    color: #9C27B0;
    font-weight: 600;
}

/* Stile per l'icona nei pulsanti POI */
.poi-icon {
    width: 22px;
    height: 22px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-width: 2;
}

/* Stile per il testo nei pulsanti POI */
.poi-button span {
    font-size: 0.85em;
    color: var(--text-dark);
    text-align: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    min-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.poi-button[data-active="true"][data-poi-type="passes"] span {
    color: #1e5720;
}

.poi-button[data-active="true"][data-poi-type="roads"] span {
    color: #0d6efd;
}

.poi-button[data-active="true"][data-poi-type="picnic"] span {
    color: #5d4037;
}

.notification-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
    font-size: 14px;
}

.notification-bar.closed {
    transform: translateY(-100%);
}

.notification-content {
    text-align: center; /* Centra il testo */
    justify-content: center; /* Centra gli elementi verticalmente */
    padding: 10px;       
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.upgrade-button {
    background: white;
    color: #4CAF50;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.upgrade-button:hover {
    background: #f0f0f0;
}

.notification-close {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

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

/* Aggiusta il padding del body quando la notifica è visibile */
body:not(.user-logged):not([data-shared="true"]) {
    padding-top: 0;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .notification-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding-right: 30px;
    }
    
    .notification-bar {
        padding: 10px;
    }
    
    body:not(.user-logged):not([data-shared="true"]) {
        padding-top: 0;
    }
}

/* Logo Mobile - nascosto su mobile come richiesto */
.mobile-logo {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1002;
    display: none; /* nascosto di default */
    align-items: center;
    justify-content: center;
}

.mobile-logo img {
    height: 24px;
    width: auto;
    display: block;
}

@media screen and (max-width: 768px) {
    /* nasconde completamente il logo sul planner mobile */
    .mobile-logo { display: none !important; }

    /* Geocoder allineato a sinistra e su un'unica riga con il pulsante indietro */
    .geocoder {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
        width: 80vw !important; /* massimo 80% dello schermo */
        max-width: 80vw !important;
        transform: none !important;
        display: flex !important;
        align-items: stretch !important;
        gap: 8px !important;
        flex-wrap: nowrap !important;
        z-index: 1001;
    }
    .geocoder input {
        border-radius: 12px;
        flex: 1 1 auto !important;
        min-width: 0 !important; /* evita overflow e va a capo */
        height: 44px; /* coerente con i controlli */
        padding: 0 16px;
    }
    /* Pulsante Indietro coerente con la grafica dell'input e sulla stessa riga */
    #undo-action-btn {
        flex: 0 0 auto !important;
        height: 44px !important;
        padding: 0 14px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 12px !important;
        background: #fff !important;
        white-space: nowrap !important; /* non va a capo */
        align-self: stretch;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    /* Su schermi molto stretti mostra solo l'icona per non farlo andare sotto */
    @media (max-width: 360px) {
        #undo-action-btn span { display: none !important; }
    }
}

/* Layout principale */
#sidebar {
    width: 25%;
    background: #f8f9fa;
    padding: 20px;
    overflow-y: auto;
    z-index: 2;
    transition: all 0.3s ease;
}

#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

.custom-marker {
    cursor: move;
    user-select: none;
    font-family: Arial, sans-serif;
    width: 24px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.custom-marker svg {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

.custom-marker.pending-marker .marker-fill {
    opacity: 0.75;
    stroke-dasharray: 4 2;
}

.custom-marker.pending-marker .marker-label {
    font-size: 10px;
}

.waypoint-confirmation-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 10010;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    width: 560px;
    backdrop-filter: blur(6px);
}

.waypoint-confirmation-bar__info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.waypoint-confirmation-bar__title {
    font-weight: 600;
    font-size: 15px;
    color: #1f2330;
}

.waypoint-confirmation-bar__location {
    font-size: 14px;
    color: #424759;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow: hidden;
}

.waypoint-confirmation-bar__location-label {
    font-weight: 500;
    color: #5f6475;
    flex: 0 0 auto;
}

.waypoint-confirmation-bar__location-value {
    font-weight: 600;
    color: #1f2330;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waypoint-confirmation-bar__hint {
    font-size: 13px;
    color: #5f6475;
}

.waypoint-confirmation-bar__actions {
    display: flex;
    gap: 10px;
}

.waypoint-confirmation-bar__actions button {
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.waypoint-confirmation-bar__cancel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(111, 116, 151, 0.68);
    color: #4a4f63;
}

.waypoint-confirmation-bar__cancel:hover {
    border-color: rgba(111, 116, 151, 0.9);
}

.waypoint-confirmation-bar__confirm {
    background: #2E7D32;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(46, 125, 50, 0.35);
}

.waypoint-confirmation-bar__confirm:hover {
    filter: brightness(1.08);
}

.waypoint-confirmation-bar__confirm.is-loading::after {
    content: '...';
    margin-left: 6px;
}

@media (max-width: 640px) {
    .waypoint-confirmation-bar {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
        bottom: 16px;
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }

    .waypoint-confirmation-bar__info {
        flex: 1 1 180px;
    }

    .waypoint-confirmation-bar__actions {
        width: 100%;
        display: flex;
        gap: 12px;
        flex: 1 1 100%;
        justify-content: center;
        align-items: center;
    }

    .waypoint-confirmation-bar__actions button {
        flex: 0 0 auto;
    }
}

/* Menu utente per desktop */
.user-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    margin-bottom: 15px;
    margin-top: -10px;
    margin-right: -10px;
}

/* Assicura che questi stili vengano applicati solo su dispositivi desktop */
@media screen and (min-width: 769px) {
    .control-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 6px;
        color: #495057;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
        cursor: pointer;
        min-width: fit-content;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
        backdrop-filter: blur(4px);
    }
}

@media screen and (min-width: 769px) {
    .control-btn span {
        flex: 0 1 auto;
        font-weight: inherit;
    }
}

.control-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-btn svg {
    width: 16px;
    height: 16px;
    color: #6c757d;
    transition: color 0.2s ease;
}

/* Stili per il menu account e il sottomenu */
@media screen and (min-width: 769px) {
    .account-menu {
        position: relative;
        display: inline-block;
    }
    
    .account-submenu {
        position: absolute;
        top: 100%;
        right: 0;
        background: white;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        min-width: 200px;
        z-index: 1010;
        display: none;
        margin-top: 5px;
        padding: 8px;
        flex-direction: column;
        gap: 6px;
    }
    
    .account-menu:hover .account-submenu {
        display: flex;
    }
    
    .account-btn {
        white-space: nowrap;
    }
}

.control-btn:hover svg {
    color: #495057;
}

/* Stile specifico per il pulsante Account */
@media screen and (min-width: 769px) {
    .account-btn svg:last-child {
        width: 12px;
        height: 12px;
        margin-left: 3px;
    }
    
    .account-menu:hover .account-btn svg:last-child {
        transform: rotate(180deg);
        transition: transform 0.3s ease;
    }
}

/* Stile speciale per il pulsante "Scopri Plus" */
.control-btn[href="index.php#pricing"] {
    background: #ffd700;
    border-color: #ffd700;
    color: #000;
    font-weight: 600;
}

.control-btn[href="index.php#pricing"] svg {
    color: #000;
}

.control-btn[href="index.php#pricing"]:hover {
    background: #ffed4a;
    border-color: #ffed4a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* Stile per il pulsante di logout */
.control-btn[href="logout.php"] {
    background: rgba(255, 245, 245, 0.9);
    border-color: rgba(255, 227, 227, 0.8);
    color: #e03131;
}

.control-btn[href="logout.php"] svg {
    color: #e03131;
}

.control-btn[href="logout.php"]:hover {
    background: rgba(255, 227, 227, 1);
    border-color: rgba(255, 168, 168, 0.8);
}

/* Stile per il pulsante "Segnala una strada" */
.report-road-btn {
    background: rgba(231, 245, 255, 0.9);
    border: none; /* Rimuovo il bordo */
    color: #1971c2;
    font-weight: normal;
}

.report-road-btn span {
    font-weight: normal;
}

.report-road-btn svg {
    color: #1971c2;
}

.report-road-btn:hover {
    background: rgba(208, 235, 255, 1);
}

@media screen and (max-width: 768px) {
    .report-road-btn {
        background-color: var(--primary) !important;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
    }
    
    .report-road-btn svg {
        margin: 0;
        width: 20px;
        height: 20px;
        position: static; /* Rimuovo il posizionamento assoluto */
        transform: none; /* Rimuovo la trasformazione */
    }
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upgrade-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100001;
    max-width: 90%;
    width: 400px;
    text-align: center;
}

.upgrade-popup p {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 16px;
    line-height: 1.5;
}

.upgrade-popup .popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 4px;
    line-height: 1;
    z-index: 100002;
    transition: color 0.2s ease;
}

.upgrade-popup .popup-close:hover {
    color: #333;
}

.upgrade-popup .upgrade-btn {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.upgrade-popup .upgrade-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.2);
}

.upgrade-btn {
    background-color: #4CAF50 !important;
    color: white !important;
}

/* Stili del sidebar */
.sidebar-logo {
    display: flex;
    align-items: center;
    padding: 15px;
    text-decoration: none;
    margin-bottom: 20px;
}

.sidebar-logo img {
    max-height: 40px;
    width: auto;
    transition: opacity 0.2s ease;
}

.sidebar-logo:hover img {
    opacity: 0.9;
}

/* Stili modernizzati per i controlli mappa */
.map-controls {
    margin: 15px 0;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.control-label {
    display: block;
    margin-bottom: 10px;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.95em;
}

.style-select {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.style-select:hover {
    border-color: #4CAF50;
    background-color: white;
}

.style-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Waypoints e lista */
.waypoint-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px;
    margin: 4px 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.waypoint-item:hover {
    border-color: #4CAF50;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.location-info {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: normal;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.remove-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    align-self: center;
}

.remove-btn:hover {
    background: #ff3333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 68, 68, 0.2);
}

/* Stili per i pulsanti di controllo waypoints - Desktop */
.waypoint-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.move-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.move-btn,
.waypoint-item .remove-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
    padding: 0;
    min-width: 28px;
    min-height: 28px;
}

.move-btn:hover {
    border-color: #4CAF50;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.waypoint-item .remove-btn {
    background: #fff5f5;
    border-color: #fecaca;
    color: #dc2626;
    margin-left: 6px;
}

.waypoint-item .remove-btn:hover {
    background: #fef2f2;
    border-color: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

/* Stili modernizzati per i pulsanti di azione */
.action-btn {
    /* Design uniforme per tutti i pulsanti */
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    padding: 12px 16px;
    margin: 8px 0;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    min-height: 44px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-size: 14px;
    text-decoration: none;
    text-align: left;
}

/* Assicura che il testo all'interno sia allineato a sinistra */
.action-btn * {
    text-align: left;
}

/* Contenuto testuale specifico */
.action-btn span,
.action-btn .button-text {
    text-align: left;
    flex: 1;
}

.action-btn:hover {
    border-color: #4CAF50;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.1);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Icone uniformi con colore verde */
.button-icon {
    width: 20px;
    height: 20px;
    color: #4CAF50;
    stroke: #4CAF50;
    fill: none;
    flex-shrink: 0;
}

/* Per le icone FontAwesome */
.action-btn .fas {
    color: #4CAF50;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

/* Stili per il menu download */
.download-menu {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
}

.download-option {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    color: #333;
}

.download-option:hover {
    background: #f5f5f5;
    color: #4CAF50;
}

/* Quick popup for Menu Percorso */
.route-quick-menu {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border: 1px solid #e6e6e6;
    overflow: hidden;
}

.route-menu-option {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-menu-option:hover {
    background: #f5f5f5;
    color: #4CAF50;
}

.route-menu-option svg,
.route-menu-option i {
    color: #4CAF50;
}

/* Route menu trigger larger and bold */
.route-menu-trigger {
    padding: 14px 18px;
}
.route-menu-trigger .button-text {
    /* Match 'Calcolo Percorso' label style */
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.95rem; /* align to control-label (approx 15.2px on 16px root) */
}

/* separators between all items */
.route-quick-menu > .route-menu-option,
.route-download-submenu .download-option {
    position: relative;
}
.route-quick-menu > .route-menu-option + .route-menu-option::before,
.route-quick-menu > .route-download-submenu::before,
.route-download-submenu .download-option + .download-option::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #eee;
}

/* Force separator after Download item even if submenu is collapsed */
.route-quick-menu > .route-menu-option[data-action="download"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: #eee;
}

/* Make quick menu items taller */
.route-menu-option {
    padding: 14px 16px !important;
}
.route-download-submenu .download-option {
    padding: 14px 16px !important;
    padding-left: 28px !important;
}

/* Nested submenu inside quick menu */
.route-download-submenu {
    border-top: 1px solid #f0f0f0;
}
.route-download-submenu .download-option {
    display: block;
    width: 100%;
    background: white;
    padding-left: 28px; /* slight indent */
}
.route-download-submenu .download-option + .download-option {
    border-top: 1px solid #f7f7f7;
}

/* Only show the new Menu Percorso on desktop; avoid duplications on mobile */
@media screen and (max-width: 768px) {
    .route-menu-container { display: none; }
}

/* Hide old bottom action buttons on desktop since now available via Menu Percorso */
@media screen and (min-width: 769px) {
    .download-container,
    #google-maps-links,
    #share-route,
    #share-with-community { display: none !important; }
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .action-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .button-icon {
        width: 18px;
        height: 18px;
    }
}

/* Enhanced Geocoder */
.geocoder {
    position: absolute;
    top: 10px;
    left: 26%;
    z-index: 1001;
    width: 400px; /* Increased width for better readability */
    max-width: calc(100vw - 280px); /* Ensure it doesn't overflow on smaller screens */
}

.geocoder input {
    width: 100%;
    padding: 14px 18px; /* Increased padding for better touch targets */
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    font-size: 16px;
    transition: box-shadow 0.2s ease;
    box-sizing: border-box; /* Ensure proper sizing */
}

.geocoder input:focus {
    outline: none;
    box-shadow: 0 2px 16px rgba(76, 175, 80, 0.3);
}

.geocoder-results {
    position: absolute;
    top: 100%; /* apri sotto al geocoder su desktop */
    width: 150%; /* Made even wider for better visibility */
    left: 0; /* Align to left edge of geocoder input */
    background: white;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: none;
    z-index: 1002;
    max-height: 400px;
    overflow-y: auto;
    box-sizing: border-box; /* Ensure proper sizing */
}

/* Enhanced result styling */
.geocoder-result {
    padding: 14px 18px; /* Increased padding to match input */
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    display: block; /* Changed from flex to block for better text alignment */
    text-align: left; /* Explicit left alignment */
    line-height: 1.4; /* Better line spacing */
}

.geocoder-result:last-child {
    border-bottom: none;
}

.geocoder-result:hover,
.geocoder-result.selected {
    background: #f8f9fa;
}

.geocoder-result.selected {
    background: #e8f5e8;
    border-left: 4px solid #4CAF50; /* Slightly thicker border for better visibility */
    padding-left: 14px; /* Adjust padding to account for border */
}

.geocoder-result-main {
    display: flex;
    align-items: flex-start; /* Align to top for multi-line text */
    gap: 12px; /* Increased gap */
    font-weight: 500;
    color: #333;
    margin-bottom: 4px; /* Space between main and context */
    text-align: left; /* Explicit left alignment */
}

.geocoder-result-icon {
    font-size: 18px; /* Slightly larger icons */
    min-width: 22px;
    flex-shrink: 0; /* Prevent icon from shrinking */
    line-height: 1; /* Align icon properly */
}

.geocoder-result-name {
    flex: 1;
    text-align: left; /* Explicit left alignment */
    word-wrap: break-word; /* Allow text to wrap if needed */
    white-space: normal; /* Allow multi-line text for long names */
    overflow: visible; /* Show full text */
}

.geocoder-result-context {
    font-size: 13px;
    color: #666;
    margin-left: 34px; /* Align with text, accounting for icon + gap */
    text-align: left; /* Explicit left alignment */
    word-wrap: break-word; /* Allow text to wrap */
    white-space: normal; /* Allow multi-line text */
    overflow: visible; /* Show full text */
    line-height: 1.3; /* Good spacing for context text */
}

/* Loading and error states */
.geocoder-loading,
.geocoder-error,
.geocoder-no-results {
    padding: 16px 18px; /* Match result padding */
    text-align: center;
    color: #666;
    font-style: italic;
    line-height: 1.4;
}

.geocoder-error {
    color: #f44336;
}

.geocoder-no-results {
    color: #999;
}

/* Ensure proper text rendering */
.geocoder-result * {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Special styling for "Via" results */
.geocoder-result[data-is-via="true"] {
    opacity: 0.85; /* Slightly less prominent */
    border-top: 1px solid #f0f0f0; /* Visual separator when they're at bottom */
}

.geocoder-result[data-is-via="true"]:first-child {
    border-top: none; /* Remove border if "Via" is somehow first */
}

/* Custom scrollbar for results */
.geocoder-results::-webkit-scrollbar {
    width: 6px;
}

.geocoder-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.geocoder-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.geocoder-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Floating buttons */
.floating-upload {
    position: fixed;
    bottom: 24px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    backdrop-filter: blur(8px);
    z-index: 200;
}

.floating-upload input {
    display: none;
}

.floating-upload label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 0.01em;
    line-height: 1;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.floating-upload label svg {
    width: 14px;
    height: 14px;
    stroke: var(--primary-color);
    transition: transform 0.2s ease;
}

.floating-upload label:hover {
    color: var(--primary-color);
}

.floating-upload label:hover svg {
    transform: translateY(-1px);
}

.floating-action-btn {
    border: none;
    background: rgba(76,175,80,0.08);
    color: var(--primary-color);
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(76,175,80,0.15);
    outline: none;
}

.floating-action-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.floating-action-btn:hover {
    background: rgba(76,175,80,0.18);
    box-shadow: 0 8px 18px rgba(76,175,80,0.25);
    transform: translateY(-2px);
}

.floating-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(76,175,80,0.2);
}

.floating-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76,175,80,0.35);
}

.floating-clear {
    background: rgba(220,38,38,0.12);
    color: #dc2626;
    box-shadow: 0 2px 6px rgba(220,38,38,0.18);
}

.floating-clear:hover {
    background: rgba(220,38,38,0.2);
    box-shadow: 0 8px 18px rgba(220,38,38,0.25);
}

.floating-clear svg {
    stroke: currentColor;
}

.floating-clear:focus-visible {
    box-shadow: 0 0 0 3px rgba(220,38,38,0.35);
}

body[data-shared="true"] .floating-clear,
body[data-shared="true"] .floating-upload {
    display: none !important;
}

/* Collapsible sections modernizzati */
.collapsible-container {
    margin-bottom: 16px;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.collapsible-header:hover {
    background: #f8f9fa;
}

.collapsible-header h3 {
    font-size: 0.95em;
    font-weight: 600;
    color: #1a1a1a;
}

.toggle-icon {
    color: #666;
    transition: transform 0.3s ease;
    display: inline-block;
    transform: rotate(180deg);
}

.toggle-icon.collapsed {
    transform: rotate(0deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
}

.collapsible-content.expanded {
    max-height: 500px;
}

.collapsible-inner {
    padding: 16px;
    color: #444;
    font-size: 0.9em;
    line-height: 1.5;
    overflow-y: auto;
    max-height: 500px;
}

/* Scrollbar personalizzata */
.collapsible-inner::-webkit-scrollbar {
    width: 8px;
}

.collapsible-inner::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 8px;
}

.collapsible-inner::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 8px;
    border: 2px solid #f0f0f0;
}

.collapsible-inner::-webkit-scrollbar-thumb:hover {
    background: #45a049;
}

/* Modifica lo stile del toggle sidebar */
.toggle-sidebar {
    display: none;
    position: fixed;
    bottom: 35vh;
    left: 0;
    right: 0;
    background: #f0f0f0; /* Grigio più chiaro */
    color: #666;
    border: none;
    border-radius: 4px 4px 0 0;
    padding: 4px; /* Ridotto da 8px a 4px per diminuire l'altezza */
    width: 100%;
    text-align: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15), /* Ombra superiore */
                0 0 15px rgba(0,0,0,0.1); /* Ombra esterna */
}

.toggle-sidebar:hover {
    background: #e8e8e8;
}

/* Stile per l'icona */
.toggle-sidebar svg {
    width: 16px; /* Ridotto da 20px a 16px */
    height: 16px; /* Ridotto da 20px a 16px */
    stroke: #666; /* Colore grigio più chiaro per l'icona */
    transition: transform 0.3s ease;
    transform: rotate(0deg);
}

/* Rotazione dell'icona quando la sidebar è chiusa */
.toggle-sidebar.closed svg {
    transform: rotate(180deg);
}

/* Responsive */
@media screen and (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    /* Nascondi la sidebar tradizionale su mobile */
    #sidebar {
        display: none;
    }
    
    /* Nascondi il toggle button tradizionale */
    .toggle-sidebar {
        display: none;
    }
    
    #map {
        width: 100%;
        height: 85vh !important; /* Lascia spazio per la barra mobile */
    }
    
    /* Nuova barra mobile fissa */
    .mobile-bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 15vh;
        background: #ffffff;
        border-top: 1px solid #e0e0e0;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 8px 4px;
    }
    
    .mobile-bar-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 4px 2px;
        cursor: pointer;
        transition: all 0.2s ease;
        border-radius: 6px;
        min-height: 60px;
        flex: 1;
        position: relative;
    }
    
    .mobile-bar-item:hover {
        background: rgba(76, 175, 80, 0.1);
    }
    
    .mobile-bar-item.active {
        background: rgba(76, 175, 80, 0.15);
        color: #4CAF50;
    }
    
    .mobile-bar-icon {
        width: 20px;
        height: 20px;
        margin-bottom: 2px;
        color: inherit;
    }
    
    .mobile-bar-text {
        font-size: 9px;
        text-align: center;
        line-height: 1.1;
        color: inherit;
        font-weight: 500;
        max-width: 100%;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    /* Badge per indicare stati attivi */
    .mobile-bar-badge {
        position: absolute;
        top: 2px;
        right: 8px;
        background: #4CAF50;
        color: white;
        font-size: 8px;
        padding: 1px 4px;
        border-radius: 6px;
        min-width: 12px;
        text-align: center;
    }
    /* Geocoder a sinistra senza logo su mobile */
    .geocoder {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
        width: 80vw !important;
        max-width: 80vw !important;
        transform: none !important;
        display: flex !important;
        gap: 8px !important;
        align-items: stretch !important;
        flex-wrap: nowrap !important;
    }
    
    /* Enhanced mobile geocoder styling */
    .geocoder input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0 16px; /* Larger touch targets */
        height: 44px;
        box-sizing: border-box;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        border-radius: 12px;
    }
    
    .geocoder-results {
        width: 100% !important; /* allineato al campo */
        left: 0 !important;
        max-height: 50vh; /* Limit height on mobile */
        border-radius: 12px;
        margin-top: 8px;
        box-sizing: border-box;
    }
    
    .geocoder-result {
        padding: 18px; /* Larger touch targets */
        min-height: auto; /* Remove fixed height */
        text-align: left; /* Explicit left alignment */
    }
    
    .geocoder-result-main {
        gap: 14px;
        font-size: 16px;
        margin-bottom: 6px;
        text-align: left;
    }
    
    .geocoder-result-icon {
        font-size: 20px; /* Larger icons on mobile */
        min-width: 24px;
    }
    
    .geocoder-result-name {
        font-size: 16px;
        text-align: left;
        line-height: 1.4;
    }
    
    .geocoder-result-context {
        font-size: 14px;
        margin-left: 38px; /* Align with text for larger icons */
        text-align: left;
        line-height: 1.3;
    }
    
    .geocoder-loading,
    .geocoder-error,
    .geocoder-no-results {
        padding: 20px;
        font-size: 16px;
        text-align: center; /* Keep these centered */
    }

    .floating-upload {
        display: none;
    }
    .sidebar-logo {
        display: none;
    }
    
    #sidebar h2 {
        display: none;
    }
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    display: none;
    z-index: 1000;
}

/* Info Percorsi */
.info-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    color: white;
    font-size: 12px;
    margin-left: 8px;
    cursor: help;
    transition: all 0.2s ease;
}

.info-circle:hover {
    background: #45a049;
    transform: scale(1.1);
}

.info-popup {
    display: none;
    position: absolute;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 280px;
    font-size: 0.9em;
    line-height: 1.6;
    z-index: 1000;
}

.action-btn {
    /* Mantieni gli stili esistenti */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

@media screen and (max-width: 480px) {
    #sidebar {
        height:35vh;
    }
    #map {
        height: 65vh;
    }
    .action-btn {
        font-size: 14px;
    }
}

.download-option {
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.download-option:hover {
    background: #f5f5f5;
}

.download-menu {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.confirmation-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    z-index: 10003;
    max-width: 90%;
    width: 300px;
    text-align: center;
    pointer-events: auto;
}

.confirmation-popup h3 {
    margin: 0 0 15px 0;
    color: #4CAF50;
}

.confirmation-popup p {
    margin: 0 0 20px 0;
    font-size: 14px;
    line-height: 1.4;
}

.confirmation-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    position: relative;
    z-index: 10004;
}

.confirmation-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    min-width: 100px;
    position: relative;
    z-index: 10005;
}

.confirm-btn {
    background: #4CAF50;
    color: white;
}

.cancel-btn {
    background: #f0f0f0;
    color: #333;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10002;
    pointer-events: auto;
}

/* Desktop: overlay dei POI non deve bloccare la mappa */
@media screen and (min-width: 769px) {
    .popup-overlay.poi-modal-overlay {
        background: transparent;
        pointer-events: none;
        z-index: 1500;
    }
    .popup-overlay.poi-modal-overlay .poi-modal {
        pointer-events: auto;
    }
}

/* Barra menu utente - posizionamento generale */
@media screen and (min-width: 769px) {
    .user-menu {
        position: absolute;
        top: 10px;
        right: 80px;
        z-index: 1000;
        display: flex;
        gap: 10px;
    }
}

.control-btn span {
    display: inline;
}

.control-btn:hover {
    background: #f7fafc;
    color: #2d3748;
}

/* Rimuoviamo la sottolineatura al passaggio del mouse */
.control-btn span {
    text-decoration: none;
}

.control-btn:hover span {
    text-decoration: none;
}

/* Assicuriamo che i pulsanti nel sottomenu account e il pulsante Segnala una Strada non abbiano sottolineatura */
.account-submenu .control-btn:hover span,
.report-road-btn:hover span {
    text-decoration: none !important;
}

/* Specifici stili per i link nel sottomenu account */
.account-submenu a.control-btn {
    text-decoration: none !important;
    justify-content: flex-start !important; /* Allinea il contenuto a sinistra */
    text-align: left !important; /* Allinea il testo a sinistra */
    padding-left: 15px; /* Aggiunge un po' di padding a sinistra */
}

.account-submenu a.control-btn:hover {
    text-decoration: none !important;
}

.account-submenu a.control-btn span {
    text-decoration: none !important;
    text-align: left !important; /* Assicura che anche il testo sia allineato a sinistra */
}

/* Regola generale per tutti i link nei pulsanti di controllo */
a.control-btn, 
a.control-btn:hover, 
a.control-btn:focus,
a.control-btn:visited {
    text-decoration: none !important;
}

a.control-btn span, 
a.control-btn:hover span {
    text-decoration: none !important;
}

/* Stili specifici per i pulsanti nel sottomenu account */
@media screen and (min-width: 769px) {
    .account-submenu a.control-btn {
        display: flex;
        align-items: center;
        justify-content: flex-start !important;
        text-align: left !important;
        padding: 8px 12px;
        width: 100%;
        border-radius: 4px;
        margin: 2px 0;
    }
    
    .account-submenu a.control-btn:hover {
        background-color: rgba(76, 175, 80, 0.1);
    }
    
    .account-submenu a.control-btn svg {
        margin-right: 8px;
    }
}

.control-btn svg {
    flex-shrink: 0;
}

/* Saved routes panel refresh */
.saved-routes-panel {
    position: fixed;
    top: 90px;
    left: calc(25% + 48px);
    right: 48px;
    max-height: calc(100vh - 140px);
    z-index: 1100;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(224, 224, 224, 0.9);
    box-shadow: var(--shadow-lg);
    display: none;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.12), rgba(76, 175, 80, 0.05));
    border-bottom: 1px solid rgba(224, 224, 224, 0.9);
}

.panel-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: 0.01em;
}

.close-btn {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(76, 175, 80, 0.35);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

#savedRoutesList {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 220px;
    max-height: min(55vh, 420px);
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(248, 249, 250, 0.85) 0%, rgba(255, 255, 255, 0.9) 100%);
}

#savedRoutesList::-webkit-scrollbar {
    width: 6px;
}

#savedRoutesList::-webkit-scrollbar-thumb {
    background-color: rgba(76, 175, 80, 0.35);
    border-radius: 3px;
}

.route-item {
    position: relative;
    padding: 16px 18px 16px 22px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid rgba(224, 224, 224, 0.9);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.route-item::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 4px;
    border-radius: 4px;
    background: var(--primary);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.route-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(76, 175, 80, 0.35);
}

.route-item:hover::before {
    opacity: 1;
}

.route-item:last-child {
    margin-bottom: 0;
}

.route-preview {
    flex: 0 0 190px;
    aspect-ratio: 5 / 3;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.12), rgba(76, 175, 80, 0.05));
    box-shadow: inset 0 0 0 1px rgba(76, 175, 80, 0.12);
    position: relative;
}

.route-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.route-preview__fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(44, 62, 80, 0.7);
    gap: 10px;
    padding: 20px;
    position: absolute;
    inset: 0;
    background: rgba(248, 249, 250, 0.92);
    backdrop-filter: blur(2px);
}

.route-preview__placeholder-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.route-preview__skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.08) 0%, rgba(76, 175, 80, 0.18) 50%, rgba(76, 175, 80, 0.08) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

.route-preview--loaded img {
    display: block;
}

.route-preview--loaded .route-preview__skeleton {
    display: none;
}

.route-preview--error .route-preview__skeleton {
    display: none;
}

.route-preview--error .route-preview__fallback {
    display: flex !important;
}

.route-preview--loaded .route-preview__fallback {
    display: none !important;
}

.route-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.route-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.route-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.route-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
}

.route-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.04);
        margin-bottom: 12px;
    letter-spacing: 0.01em;
    transition: var(--transition);
}

.route-meta-item svg {
        align-items: flex-start;
    width: 14px;
    height: 14px;
    color: var(--primary);
}

.route-meta-item.route-date svg {
    color: #607D8B;
}

.route-meta-item.route-distance svg {
    color: #2196F3;
}

.route-meta-item.route-duration svg {
    color: #9C27B0;
}

.route-meta-item.is-placeholder {
    background: rgba(148, 163, 184, 0.14);
    color: rgba(71, 85, 105, 0.85);
}

.route-meta-item.is-placeholder svg {
    color: rgba(71, 85, 105, 0.65);
}

.route-meta-value {
    white-space: nowrap;
}

.route-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

.route-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    background: rgba(76, 175, 80, 0.12);
    color: #256c2e;
    box-shadow: none;
}

.route-action-btn svg,
.route-action-btn i {
    pointer-events: none;
    font-size: 14px;
}

.route-action-btn.load-btn {
    border-color: rgba(76, 175, 80, 0.35);
}

.route-action-btn.gpx-btn {
    background: rgba(33, 150, 243, 0.12);
    border-color: rgba(33, 150, 243, 0.35);
    color: #0f5ca8;
}

.route-action-btn.maps-btn {
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.35);
    color: #b26a00;
}

.route-action-btn.delete-btn {
    background: rgba(255, 68, 68, 0.12);
    border-color: rgba(255, 68, 68, 0.35);
    color: #b91c1c;
}

.route-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.route-action-btn:active {
    transform: translateY(0);
}

@media screen and (max-width: 768px) {
    .user-menu {
        position: absolute;
        top: 60px;
        left: 10px;
        right: auto;
        flex-direction: column;
        gap: 5px;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    .control-btn svg {
        margin: 0;
        width: 20px;
        height: 20px;
    }

    .control-btn span {
        display: none;
    }

    /* Nascondi logout su mobile */
    .control-btn[href="logout.php"] {
        display: none;
    }

    /* Stili specifici per il pulsante "Segnala una strada" su mobile */
    .report-road-btn {
        background-color: var(--primary) !important;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
    }
    
    .report-road-btn svg {
        margin: 0;
        width: 20px;
        height: 20px;
        position: static; /* Rimuovo il posizionamento assoluto */
        transform: none; /* Rimuovo la trasformazione */
    }

    .saved-routes-panel {
        top: calc(env(safe-area-inset-top, 0px) + 8px);
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        border-radius: var(--radius-sm);
        box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
        z-index: 1500;
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px);
    }

    #savedRoutesList {
        padding: 16px;
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 100px);
    }

    .route-item {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }

    .route-preview {
        width: 100%;
        flex: none;
        margin: 0;
        aspect-ratio: 16 / 9;
    }

    .route-details {
        width: 100%;
        gap: 12px;
    }

    .route-name {
        white-space: normal;
        line-height: 1.3;
    }

    .route-actions {
        width: 100%;
        gap: 8px;
    }

    .route-action-btn {
        flex: 1 1 calc(50% - 10px);
    }

    .route-meta {
        gap: 6px;
    }

    .route-meta-item {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Pagina Login */
    /* Banner promozionale */
    .promo-banner {
        background: linear-gradient(to right, #16a34a, #166534);
        color: white;
        padding: 3rem 1rem;
    }

    .promo-content {
        max-width: 72rem;
        margin: 0 auto;
    }

    .promo-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
        align-items: center;
    }

    @media (min-width: 768px) {
        .promo-grid {
            grid-template-columns: 1fr 1fr;
        }
    }

    .promo-text {
        text-align: center;
    }

    @media (min-width: 768px) {
        .promo-text {
            text-align: left;
        }
    }

    .promo-text h2 {
        font-size: 1.875rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }

    .feature-list {
        margin: 1.5rem 0;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .feature-list p {
        display: flex;
        align-items: center;
        color: rgba(255, 255, 255, 0.9);
    }

    .feature-icon {
        width: 1.25rem;
        height: 1.25rem;
        margin-right: 0.5rem;
        fill: none;
        stroke: currentColor;
    }

    .features-button {
        display: inline-flex;
        align-items: center;
        padding: 0.75rem 1.5rem;
        background: white;
        color: #16a34a;
        border-radius: 0.5rem;
        font-weight: 600;
        transition: background-color 0.2s;
    }

    .features-button:hover {
        background-color: #f9fafb;
    }

    .button-icon {
        width: 1.25rem;
        height: 1.25rem;
        margin-left: 0.5rem;
    }

    /* Preview section */
    .preview-container {
        position: relative;
    }

    .preview-image {
        position: relative;
        overflow: hidden;
        border-radius: 0.5rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        transform: perspective(1000px) rotateY(-5deg);
        transition: transform 0.3s ease;
    }

    .preview-image:hover {
        transform: perspective(1000px) rotateY(0deg);
    }

    .preview-image img {
        width: 100%;
        border-radius: 0.5rem;
    }

    .feature-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
        border-radius: 9999px;
        background-color: rgba(255, 255, 255, 0.9);
        color: #16a34a;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        position: absolute;
        z-index: 10;
    }

    .top-left {
        top: 1rem;
        left: 1rem;
    }

    .top-right {
        top: 1rem;
        right: 1rem;
    }

    .bottom-left {
        bottom: 1rem;
        left: 1rem;
    }

    .preview-overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(22, 101, 52, 0.2), transparent);
        border-radius: 0.5rem;
        pointer-events: none;
    }

    @media (max-width: 768px) {
        .preview-image {
            transform: none;
        }
    }

    /* Stile per dispositivi mobili */
    @media screen and (max-width: 480px) {
        .poi-options {
            gap: 6px;
        }

        .poi-content {
            padding: 8px;
        }

        .poi-icon {
            width: 16px;
            height: 16px;
        }

        .poi-option span {
            font-size: 0.7em;
        }
    }

    @media screen and (max-width: 768px) {
        .waypoint-item {
            padding: 6px;
        }
        
        .location-info {
            font-size: 0.75em;
        }
        
        .remove-btn {
            min-width: 20px;
            min-height: 20px;
            padding: 4px;
        }
    }

    /* Statistiche Percorso - Stile unificato */
    .route-stats {
        background: white;
        border-radius: 12px;
        padding: 20px;
        margin: 15px 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        width: 100%;
        box-sizing: border-box;
    }

    .route-stats.stats-hidden {
        display: none !important;
    }

    .route-stats .control-label {
        display: block;
        margin-bottom: 12px;
        color: #1a1a1a;
        font-weight: 600;
        font-size: 0.95em;
    }

    .stats-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }

    .stat-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .stat-row:last-child {
        border-bottom: none;
    }

    .stat-label {
        font-size: 0.9em;
        color: #666;
        font-weight: 500;
    }

    .stat-value {
        font-size: 0.9em;
        color: #333;
        font-weight: 600;
    }

    /* Responsive per statistiche */
    @media screen and (max-width: 768px) {
        .route-stats {
            padding: 15px;
            margin: 12px 0;
        }
        
        .stat-label {
            font-size: 0.8em;
        }
        
        .stat-value {
            font-size: 0.8em;
        }
    }
}

/* Stili per il popup POI a schermo intero su mobile */
body.poi-popup-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Quando il popup è aperto, nascondi geocoder e user-menu su mobile */
body.poi-popup-open .geocoder,
body.poi-popup-open .user-menu,
body.poi-popup-open .toggle-sidebar {
    display: none !important;
}

.mobile-fullscreen-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10000 !important; /* Aumentato per essere sopra a tutto */
}

.mobile-fullscreen-popup .mapboxgl-popup-content {
    height: 100% !important;
    touch-action: pan-x pan-y !important;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Impedisce lo zoom nei popup dei POI su mobile */
.poi-popup,
.poi-popup-mobile,
.mapboxgl-popup,
.mapboxgl-popup-content {
    touch-action: pan-x pan-y !important;
}

/* Impedisce lo zoom su tutti gli elementi all'interno dei popup */
.poi-popup *,
.poi-popup-mobile *,
.mapboxgl-popup-content * {
    touch-action: pan-x pan-y !important;
}

/* Impedisce lo zoom su immagini nei popup */
.popup-image-container img,
.carousel-slide img {
    touch-action: pan-x pan-y !important;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Stile per il pulsante "Segnala una strada" */
.report-road-btn {
    background-color: var(--primary) !important;
    color: white !important;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.report-road-btn:hover {
    background-color: var(--primary-hover) !important;
}

.report-road-btn svg {
    stroke: white;
}

.report-road-btn span {
    text-decoration: none;
}

/* Regole specifiche per mobile */
@media screen and (max-width: 768px) {
    .report-road-btn {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
    }
    
    .report-road-btn svg {
        margin: 0;
        width: 20px;
        height: 20px;
        position: static; /* Rimuovo il posizionamento assoluto */
        transform: none; /* Rimuovo la trasformazione */
    }
}

/* Pagina Login */
/* Banner promozionale */
.promo-banner {
    background: linear-gradient(to right, #16a34a, #166534);
    color: white;
    padding: 3rem 1rem;
}

.promo-content {
    max-width: 72rem;
    margin: 0 auto;
}

.promo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 768px) {
    .promo-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.promo-text {
    text-align: center;
}

@media (min-width: 768px) {
    .promo-text {
        text-align: left;
    }
}

.promo-text h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.feature-list {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feature-list p {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
}

.feature-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    fill: none;
    stroke: currentColor;
}

.features-button {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: white;
    color: #16a34a;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.features-button:hover {
    background-color: #f9fafb;
}

.button-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.5rem;
}

/* Preview section */
.preview-container {
    position: relative;
}

.preview-image {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: perspective(1000px) rotateY(0deg);
}

.preview-image img {
    width: 100%;
    border-radius: 0.5rem;
}

.feature-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #16a34a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: absolute;
    z-index: 10;
}

.top-left {
    top: 1rem;
    left: 1rem;
}

.top-right {
    top: 1rem;
    right: 1rem;
}

.bottom-left {
    bottom: 1rem;
    left: 1rem;
}

.preview-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(22, 101, 52, 0.2), transparent);
    border-radius: 0.5rem;
    pointer-events: none;
}

@media (max-width: 768px) {
    .preview-image {
        transform: none;
    }
}

/* Stile per dispositivi mobili */
@media screen and (max-width: 480px) {
    .poi-options {
        gap: 6px;
    }

    .poi-content {
        padding: 8px;
    }

    .poi-icon {
        width: 16px;
        height: 16px;
    }

    .poi-option span {
        font-size: 0.7em;
    }
}

@media screen and (max-width: 768px) {
    .waypoint-item {
        padding: 6px;
    }
    
    .location-info {
        font-size: 0.75em;
    }
    
    .remove-btn {
        min-width: 20px;
        min-height: 20px;
        padding: 4px;
    }
}

/* Statistiche Percorso - Stile unificato */
.route-stats {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    width: 100%;
    box-sizing: border-box;
}

.route-stats.stats-hidden {
    display: none !important;
}

.route-stats .control-label {
    display: block;
    margin-bottom: 12px;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.95em;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.stat-value {
    font-size: 0.9em;
    color: #333;
    font-weight: 600;
}

/* Responsive per statistiche */
@media screen and (max-width: 768px) {
    .route-stats {
        padding: 15px;
        margin: 12px 0;
    }
    
    .stat-label {
        font-size: 0.8em;
    }
    
    .stat-value {
        font-size: 0.8em;
    }
}

/* Menu Hamburger Mobile */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2000;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary);
    stroke-width: 2;
    transition: transform 0.3s ease;
}

.mobile-menu-toggle.active svg {
    transform: rotate(90deg);
}

.mobile-fullscreen-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1999;
    flex-direction: column;
    overflow-y: auto;
    padding: 60px 20px 20px;
}

.mobile-fullscreen-menu.active {
    display: flex;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.mobile-menu-header img {
    height: 40px;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
}

.mobile-menu-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-menu-item:hover, 
.mobile-menu-item:active {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.mobile-menu-item svg {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    stroke: var(--primary);
}

.mobile-menu-item.highlight {
    background: var(--primary);
    color: white;
}

.mobile-menu-item.highlight svg {
    stroke: white;
}

.mobile-menu-section {
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Nascondi il menu mobile su desktop */
@media screen and (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .mobile-fullscreen-menu {
        display: none !important;
    }
}

/* Mostra il menu mobile su dispositivi mobili */
@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        height: 44px; /* Stessa altezza dell'input del geocoder */
        border-radius: 4px;
        width: 44px; /* Quadrato perfetto */
    }
    
    /* Nascondi il menu utente originale su mobile */
    .user-menu {
        display: none !important;
    }
    
    /* Geocoder allineato a sinistra con larghezza massima 80% */
    .geocoder {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
        width: 80vw !important;
        max-width: 80vw !important;
        transform: none !important;
        display: flex !important;
        gap: 8px !important;
        align-items: stretch !important;
        flex-wrap: nowrap !important;
        z-index: 1001;
    }
    
    .geocoder input {
        height: 44px; /* Altezza fissa per allinearsi con il menu hamburger */
        border: 1px solid #ddd;
        padding-left: 15px;
    }
}

/* Quando il menu mobile è aperto, blocca lo scroll della pagina */
body.menu-open {
    overflow: hidden;
}

/* Stili responsive per i pulsanti POI su dispositivi mobili */
@media screen and (max-width: 768px) {
    .poi-options {
        gap: 8px;
        margin-top: 15px;
        margin-bottom: 5px;
    }
    
    .poi-button {
        padding: 10px 8px;
        min-height: 80px;
        justify-content: center;
    }
    
    .poi-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 8px;
    }
    
    .poi-button span {
        font-size: 14px;
        font-weight: 500;
        color: #333;
    }
    
    .mobile-route-options {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .mobile-route-button {
        display: flex;
        align-items: center;
        padding: 15px;
        border: 2px solid #e0e0e0;
        border-radius: 12px;
        background: white;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-route-button.active {
        border-color: #4CAF50;
        background: rgba(76, 175, 80, 0.1);
    }
    
    .mobile-route-button .poi-icon {
        width: 24px;
        height: 24px;
        margin-right: 12px;
    }
    
    .mobile-route-button span {
        font-size: 16px;
        font-weight: 500;
        color: #333;
    }
    
    .mobile-download-options {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .mobile-download-button {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px;
        background: #4CAF50;
        color: white;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        font-size: 16px;
        font-weight: 500;
        transition: all 0.2s ease;
    }
    
    .mobile-download-button:hover {
        background: #45a049;
        transform: translateY(-1px);
    }
    
    .mobile-download-button svg {
        width: 20px;
        height: 20px;
    }
    
    /* Waypoints mobile */
    .mobile-waypoints-list {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    
    .mobile-waypoint-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-bottom: 10px;
    }
    
    .mobile-waypoint-info {
        flex: 1;
        margin-right: 10px;
    }
    
    .mobile-waypoint-info .location-info {
        font-size: 13px;
        color: #666;
        margin-top: 4px;
    }
    
    /* Altri modal */
    .mobile-other-options {
        display: flex;
        flex-direction: column;
        gap:  12px;
    }
    
    .mobile-other-button {
        display: flex;
        align-items: center;
        padding: 15px;
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
        color: #333;
    }
    
    .mobile-other-button:hover {
        background: #f5f5f5;
        transform: translateY(-1px);
    }
    
    .mobile-other-button svg {
        width: 20px;
        height: 20px;
        margin-right: 12px;
        color: #666;
    }
    
    .mobile-other-button span {
        font-size: 16px;
        font-weight: 500;
    }
}

/* Modal mobile full-screen */
.mobile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.mobile-modal.active {
    display: flex;
}

.mobile-modal-header {
    background: #4CAF50;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.mobile-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.mobile-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-modal-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Stili specifici per i diversi modal */
.mobile-poi-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.mobile-poi-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.mobile-poi-button.active {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.mobile-poi-button .poi-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
}

.mobile-poi-button span {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.mobile-route-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-route-button {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-route-button.active {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.mobile-route-button .poi-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
}

.mobile-route-button span {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.mobile-download-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-download-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-download-button:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.mobile-download-button svg {
    width: 20px;
    height: 20px;
}

/* Waypoints mobile */
.mobile-waypoints-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.mobile-waypoint-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
}

.mobile-waypoint-info {
    flex: 1;
    margin-right: 10px;
}

.mobile-waypoint-info .location-info {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}