/* ── Filters panel ───────────────────────────────── */
.filters-panel {
    position: absolute;
    right: var(--space-md);
    bottom: calc(120px + var(--map-footer-h) + var(--map-route-panel-h));
    /* Limita anche il top così su mobile non sborda oltre la topbar */
    top: 80px;
    z-index: 600;
    width: 320px;
    max-width: calc(100vw - var(--space-lg));
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: filtersSlide 0.2s ease;
}
.filters-panel.hidden { display: none; }
@keyframes filtersSlide {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    background: var(--color-surface);
}
.filters-title {
    font-size: var(--font-size-md);
    font-weight: 700;
    margin: 0;
}
.filters-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--color-text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}
.filters-close:hover { background: var(--color-bg); }

.filters-actions {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    background: var(--color-surface);
}
.filters-action-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    cursor: pointer;
    font-family: var(--font-sans);
}
.filters-action-btn:hover { background: var(--color-surface); }

.filters-body {
    overflow-y: auto;
    padding: var(--space-sm) 0;
    flex: 1;
}

.filters-group {
    padding: var(--space-xs) var(--space-md);
}
.filters-group-title {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    font-weight: 700;
    margin: var(--space-sm) 0 var(--space-xs);
}

.filters-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 0;
    cursor: pointer;
    user-select: none;
}
.filters-item-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}
.filters-item-label {
    flex: 1;
    font-size: var(--font-size-sm);
}

/* Toggle switch */
.filters-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}
.filters-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.filters-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    transition: 0.2s;
    border-radius: 20px;
}
.filters-toggle-slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.2s;
    border-radius: 50%;
}
.filters-toggle input:checked + .filters-toggle-slider {
    background: var(--color-primary);
}
.filters-toggle input:checked + .filters-toggle-slider::before {
    transform: translateX(16px);
}
