/* ===========================
   MAP SECTION - SIDEBAR LAYOUT (Stile Mineo)
   =========================== */

.map-layout {
    display: flex;
    gap: 1.5rem;
    min-height: 500px;
    height: 500px;
}

/* Sidebar */
.map-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: #fafaf8;
    border: 1px solid #e0d8d0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.map-sidebar-header {
    background: linear-gradient(135deg,
            rgba(130, 50, 40, 0.1) 0%,
            rgba(192, 140, 59, 0.08) 100%);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e0d8d0;
}

.map-sidebar-header h4 {
    font-family: 'TeX Gyre Termes', serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
}

.map-sidebar-header i {
    color: #823228;
}

.map-sidebar-content {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

/* Filters/Routes list */
.filters-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filters-list .filter-item {
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #555;
    border: 1px solid transparent;
}

.filters-list .filter-item:hover {
    background: #fff;
    color: #823228;
    border-color: #e0d8d0;
}

.filters-list .filter-item.active {
    background: linear-gradient(135deg,
            rgba(130, 50, 40, 0.12) 0%,
            rgba(192, 140, 59, 0.08) 100%);
    color: #823228;
    font-weight: 600;
    border-color: rgba(130, 50, 40, 0.3);
}

.filters-list .filter-item i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    transition: transform 0.2s ease;
}

.filters-list .filter-item:hover i {
    transform: scale(1.15);
}

.filters-list .filter-item-reset {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e0d8d0;
}

/* Map main area */
.map-main {
    flex: 1;
    min-width: 0;
}

.map-main .map-container {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
}

.map-container {
    height: 500px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Marker numerati personalizzati - Stile goccia */
.custom-marker {
    background: transparent;
    border: none;
}

.numbered-marker {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    transition: transform 0.2s ease;
}

.marker-pin:hover {
    transform: rotate(-45deg) scale(1.15);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.marker-number {
    transform: rotate(45deg);
    color: white;
    font-weight: 400;
    font-size: 12px;
    text-align: center;
    line-height: 1;
    z-index: 10;
}

/* Popup personalizzati */
.route-popup {
    border-radius: 8px;
    overflow: hidden;
}

.route-popup-header {
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.route-popup-body {
    padding: 15px;
}

.route-popup-body h6 {
    margin-bottom: 8px;
    color: #333;
}

.route-icon {
    font-size: 1.2rem;
}

/* Pannello informazioni percorso */
.route-info-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    max-width: 350px;
    z-index: 1000;
    display: none;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.route-info-content {
    padding-left: 15px;
}

.route-steps ol {
    padding-left: 20px;
    margin-bottom: 0;
}

.route-steps li {
    margin-bottom: 5px;
}

/* Controlli mappa */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.map-control-btn {
    background: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-control-btn:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 991px) {
    .map-layout {
        flex-direction: column;
        height: auto;
    }

    .map-sidebar {
        width: 100%;
        max-height: none;
        height: auto;
    }

    .map-sidebar-content {
        max-height: 200px;
        overflow-y: auto;
    }

    .filters-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filters-list .filter-item {
        flex: 1 1 auto;
        min-width: 140px;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 768px) {

    .map-main .map-container,
    .map-container {
        height: 400px;
    }

    .route-info-panel {
        max-width: 280px;
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

@media (max-width: 576px) {
    .filters-list .filter-item {
        min-width: 100%;
        text-align: left;
        justify-content: flex-start;
    }

    .map-main .map-container,
    .map-container {
        height: 350px;
    }
}

/* Legenda */
.route-legend {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    border: 2px solid #e0e0e0;
}

.route-legend h6 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #666;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.legend-line {
    width: 30px;
    height: 3px;
    border-radius: 2px;
}

/* Animazione caricamento */
.loading-map {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2000;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

    100% {
        transform: rotate(360deg);
    }
}