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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #f5f6fa;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.menu-btn,
.location-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
}

.menu-btn:active,
.location-btn:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.95);
}

/* Mappa */
#map {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 350px;
    height: calc(100vh - 60px);
    background: white;
    z-index: 900;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 20px;
    color: #2c3e50;
}

.close-sidebar {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #7f8c8d;
}

/* Filtri */
.filter-section {
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tabs::-webkit-scrollbar {
    height: 4px;
}

.filter-tabs::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.filter-tab i {
    font-size: 14px;
}

/* Lista Postazioni */
.postazioni-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.postazione-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.postazione-card:active {
    transform: scale(0.98);
}

.postazione-card.active {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.postazione-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.postazione-nome {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
    flex: 1;
}

.postazione-tipo {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 4px;
}

.postazione-tipo i {
    font-size: 12px;
}

.postazione-info {
    color: #7f8c8d;
    font-size: 13px;
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.postazione-distance {
    color: #3498db;
    font-weight: 600;
    font-size: 13px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.postazione-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.btn-navigate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-navigate:active {
    transform: scale(0.95);
}

.btn-details {
    background: #f0f0f0;
    color: #2c3e50;
}

.btn-details:active {
    transform: scale(0.95);
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.15);
    z-index: 1100;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 12px auto 8px;
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

.sheet-header {
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}

.sheet-title {
    font-size: 22px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.sheet-tipo {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.sheet-body {
    padding: 20px 0;
}

.sheet-info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.sheet-info-row i {
    width: 20px;
    color: #667eea;
    font-size: 16px;
    margin-top: 2px;
}

.sheet-actions {
    padding: 15px 0;
    border-top: 1px solid #f0f0f0;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 850;
    display: none;
}

.overlay.active {
    display: block;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.loading i {
    font-size: 32px;
    margin-bottom: 10px;
}

.initial-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    color: #667eea;
}

.loading-content i {
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-content p {
    font-size: 16px;
    color: #7f8c8d;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* User Location Marker */
.user-location-marker {
    width: 20px;
    height: 20px;
    background: #3498db;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3), 0 2px 8px rgba(0,0,0,0.3);
    animation: pulse-location 2s ease-in-out infinite;
}

@keyframes pulse-location {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3), 0 2px 8px rgba(0,0,0,0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(52, 152, 219, 0.1), 0 2px 8px rgba(0,0,0,0.3);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .close-sidebar {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (min-width: 769px) {
    #map {
        left: 350px;
    }
    
    .menu-btn {
        display: none;
    }
    
    .bottom-sheet {
        left: 350px;
    }
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 200px;
}

.popup-content {
    padding: 15px;
}

.popup-title {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.popup-tipo {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.popup-info {
    font-size: 13px;
    color: #7f8c8d;
    margin: 4px 0;
}

.popup-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}