/* Mappa Section */
.map-section {
    position: relative;
    height: 500px;
    margin: 0;
    background: var(--color-bg-secondary);
}

.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Controlli mappa */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    color: var(--color-text-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.map-control-btn:hover {
    background: var(--color-bg-secondary);
    transform: scale(1.05);
}

/* Search box sulla mappa */
.map-search-box {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    gap: 8px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 4px;
}

.map-search-input {
    width: 250px;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    background: transparent;
    color: var(--color-text-primary);
}

.map-search-input:focus {
    outline: none;
}

.map-search-btn {
    padding: 8px 12px;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.map-search-btn:hover {
    background: var(--color-primary-dark);
}

/* Sidebar transiti */
.transits-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--color-bg-primary);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.transits-sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.sidebar-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.sidebar-close:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.stop-info {
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.stop-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stop-code {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.stop-coords {
    font-size: 12px;
    color: var(--color-text-muted);
}

.transits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transit-item {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--color-primary);
}

.transit-item:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-sm);
}

.transit-time {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.transit-route {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.transit-headsign {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.transit-agency {
    font-size: 11px;
    color: var(--color-text-muted);
}

.loading-spinner {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-secondary);
}

/* Overlay per mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.open {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .transits-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .map-search-box {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
    }
    
    .map-search-input {
        width: 100%;
    }
    
    .map-section {
        height: 400px;
    }
}

/* Custom marker popup */
.custom-popup .popup-stop-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.custom-popup .popup-stop-code {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.custom-popup .popup-view-transits {
    font-size: 12px;
    color: var(--color-primary);
    text-decoration: none;
    display: inline-block;
    margin-top: 4px;
    cursor: pointer;
}

.custom-popup .popup-view-transits:hover {
    text-decoration: underline;
}