/**
 * OFRF Regional Selector Map styles.
 */

.ofrf-regional-selector {
    margin: 32px 0;
    font-family: 'Montserrat', sans-serif;
}

.ofrf-regional-selector__label,
.ofrf-regional-selector__country-label {
    font-family: 'Montserrat', sans-serif;
}

.ofrf-regional-selector__title {
    margin: 0 0 20px;
    text-align: center;
}

.ofrf-regional-selector__frame {
    position: relative;
}

.ofrf-regional-selector__map {
    width: 100%;
    overflow: hidden;
    background: #ffffff;
}

.ofrf-regional-selector__loading,
.ofrf-regional-selector__error {
    margin: 0;
    padding: 24px;
    text-align: center;
    color: #4b4b4b;
    font-weight: 600;
}

.ofrf-regional-selector__error {
    color: #8b2f2f;
}

.ofrf-regional-selector__legend {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.ofrf-regional-selector__legend-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: #fff;
    color: #222;
    font-weight: 600;
    text-decoration: none;
    transition: box-shadow 0.2s ease;
}

.ofrf-regional-selector__legend-item:hover,
.ofrf-regional-selector__legend-item:focus {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    color: #111;
}

.ofrf-regional-selector__legend-image {
    display: block;
    position: relative;
    width: 100%;
    padding-top: 60%;
    overflow: hidden;
    background: #f0f0f0;
}

.ofrf-regional-selector__legend-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: var(--ofrf-region-color, #5c8f47);
    opacity: 0.35;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.ofrf-regional-selector__legend-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.5) brightness(1.05);
    transition: transform 0.4s ease, filter 0.4s ease;
}

.ofrf-regional-selector__legend-item:hover .ofrf-regional-selector__legend-image::after {
    opacity: 0.1;
}

.ofrf-regional-selector__legend-item:hover .ofrf-regional-selector__legend-image img {
    transform: scale(1.04);
    filter: saturate(1) brightness(1);
}

.ofrf-regional-selector__legend-bar {
    display: block;
    height: 4px;
    background: var(--ofrf-region-color, #5c8f47);
}

.ofrf-regional-selector__legend-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    line-height: 1.3;
}

.ofrf-regional-selector__legend-swatch {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 999px;
    background: var(--ofrf-region-color, #5c8f47);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.ofrf-regional-selector__legend-item:not(.has-image) {
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
}

.ofrf-regional-selector__legend-item:not(.has-image) .ofrf-regional-selector__legend-bar {
    display: none;
}

.ofrf-regional-selector__legend-item:not(.has-image) .ofrf-regional-selector__legend-label {
    padding: 0;
}

.ofrf-regional-selector__card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ofrf-regional-selector__card:hover,
.ofrf-regional-selector__card:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    color: #111;
}

.ofrf-regional-selector__card-swatch {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border-radius: 999px;
    background: var(--ofrf-region-color, #5c8f47);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.ofrf-regional-selector__cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.ofrf-regional-selector__card {
    min-height: 72px;
}

.ofrf-regional-selector__card-label {
    line-height: 1.3;
}

.ofrf-regional-selector__map .leaflet-control-attribution {
    display: none;
}

.ofrf-regional-selector__map .leaflet-control-zoom {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.ofrf-regional-selector__label-marker {
    background: transparent;
    border: none;
    overflow: visible !important;
}

.ofrf-regional-selector__label-marker--country {
    z-index: 200;
}

.ofrf-regional-selector__label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.7);
    color: #1d1d1d;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
    transform: translate(-50%, -50%);
}

.ofrf-regional-selector__country-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: rgba(34, 34, 34, 0.78);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ofrf-regional-selector__label::before {
    content: "";
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 999px;
    background: var(--ofrf-region-color, #5c8f47);
    flex: 0 0 10px;
}

.ofrf-regional-selector__label.is-active {
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.24);
    transform: translate(-50%, -50%) translateY(-1px);
}

@media (max-width: 900px) {
    .ofrf-regional-selector__legend {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ofrf-regional-selector__cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ofrf-regional-selector__label {
        min-width: 0;
        white-space: normal;
    }
}

@media (max-width: 640px) {
    .ofrf-regional-selector {
        margin: 24px 0;
    }

    .ofrf-regional-selector__map {
        height: 420px !important;
    }

    .ofrf-regional-selector__legend,
    .ofrf-regional-selector__cards {
        grid-template-columns: 1fr;
    }

    .ofrf-regional-selector__label {
        min-width: 0;
        padding: 6px 10px;
        font-size: 11px;
        white-space: nowrap;
    }

    .ofrf-regional-selector__label::before {
        width: 8px;
        height: 8px;
        margin-right: 6px;
        flex-basis: 8px;
    }

    .ofrf-regional-selector__country-label {
        padding: 5px 10px;
        font-size: 12px;
    }
}
