/* Map Wrapper */
.sfhr-neighborhood-map-wrapper {
    border-radius: 8px;
    overflow: hidden;
}

/* Flex Layout: sidebar + map side by side */
.sfhr-map-layout {
    display: flex;
    flex-direction: row;
}

/* Neighborhood Map Container */
.sfhr-neighborhood-map-container {
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.sfhr-nb-map-canvas {
    width: 100%;
    height: 100%;
}

/* Overlay Toggle Panel (Sidebar) */
.sfhr-overlay-panel {
    background: #fff;
    border-right: 1px solid #eee;
    font-size: 13px;
    line-height: 1.4;
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sfhr-overlay-panel-header {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.sfhr-city-toggle {
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #2c3e50;
    background: #f0f4f8;
    border: 1px solid #d0d8e0;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.sfhr-city-toggle:hover {
    background: #2c3e50;
    color: #fff;
}

.sfhr-overlay-panel-body {
    padding: 6px 12px 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Overlay Item (wrapper for toggle + description) */
.sfhr-overlay-item {
    border-bottom: 1px solid #f5f5f5;
}

.sfhr-overlay-item:last-child {
    border-bottom: none;
}

/* Overlay Toggle Items */
.sfhr-overlay-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 0;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.sfhr-overlay-toggle input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.sfhr-overlay-label {
    color: #333;
    font-size: 13px;
    flex: 1;
    min-width: 0;
}

/* Info Icon Button */
.sfhr-overlay-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #f0f4f8;
    color: #888;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.sfhr-overlay-info:hover {
    background: #e0e6ec;
    color: #555;
}

/* Overlay Description (hidden by default) */
.sfhr-overlay-desc {
    display: none;
    font-size: 11px;
    color: #888;
    margin: 0 0 4px 22px;
    padding-bottom: 4px;
}

.sfhr-overlay-desc.sfhr-overlay-desc-visible {
    display: block;
}

/* Loading / Active / Error states */
.sfhr-overlay-item.sfhr-overlay-loading {
    opacity: 0.5;
    pointer-events: none;
}

.sfhr-overlay-item.sfhr-overlay-active .sfhr-overlay-label {
    font-weight: 600;
    color: #2c3e50;
}

.sfhr-overlay-item.sfhr-overlay-error .sfhr-overlay-label {
    color: #e74c3c;
}

/* Legend Container */
.sfhr-legend-container {
    display: none;
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1;
    padding: 10px 14px;
    font-size: 12px;
    max-width: 260px;
}

.sfhr-legend-item {
    margin-bottom: 8px;
}

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

.sfhr-legend-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
    font-size: 12px;
}

/* Gradient Legend */
.sfhr-legend-gradient {
    height: 10px;
    border-radius: 3px;
    margin-bottom: 3px;
}

.sfhr-legend-labels {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 11px;
}

/* Categorical Legend */
.sfhr-legend-categories,
.sfhr-legend-steps {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sfhr-legend-cat-item,
.sfhr-legend-step-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #555;
    font-size: 11px;
}

.sfhr-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Mobile Responsive: sidebar collapses above map */
@media (max-width: 768px) {
    .sfhr-map-layout {
        flex-direction: column;
        height: auto !important;
    }

    .sfhr-overlay-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
    }

    /* Collapsed by default — body hidden until toggle */
    .sfhr-overlay-panel-body {
        max-height: 0;
        overflow: hidden;
        padding: 0 12px;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .sfhr-overlay-panel.sfhr-panel-open .sfhr-overlay-panel-body {
        max-height: 300px;
        overflow-y: auto;
        padding: 6px 12px 10px;
    }

    .sfhr-overlay-panel-header {
        cursor: pointer;
    }

    /* Expand/collapse chevron */
    .sfhr-overlay-panel-header::after {
        content: '\25BC';
        font-size: 10px;
        color: #94a3b8;
        transition: transform 0.3s ease;
    }

    .sfhr-panel-open .sfhr-overlay-panel-header::after {
        transform: rotate(180deg);
    }

    .sfhr-neighborhood-map-container {
        height: 60vh;
        min-height: 320px;
    }

    .sfhr-city-toggle {
        font-size: 11px;
        padding: 4px 10px;
    }

    .sfhr-legend-container {
        left: 0;
        right: 0;
        max-width: none;
        margin: 0 10px;
    }
}
