.map-overlay-widget {
    display: grid;
    gap: 0.65rem;
}

.map-overlay-widget > .sentieri_map_wrapper,
.map-overlay-widget > .eremi_map_wrapper {
    position: relative;
}

.map-overlay-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.map-overlay-controls[hidden] {
    display: none;
}

.map-overlay-type-control {
    position: relative;
    display: inline-flex;
}

.map-overlay-type-control__btn svg,
.map-overlay-reset-btn svg,
.map-overlay-layers-btn svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.map-overlay-reset-btn,
.map-overlay-layers-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    padding-inline: 0.45rem;
}

.map-overlay-layers-btn svg {
    fill: currentColor;
    stroke: none;
}

.map-overlay-type-control__menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 10;
    display: grid;
    gap: 0.2rem;
    min-width: 8.5rem;
    padding: 0.35rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.map-overlay-type-control__menu[hidden] {
    display: none;
}

.map-overlay-type-control__option {
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: #2a241c;
    padding: 0.35rem 0.55rem;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.map-overlay-type-control__option.is-active,
.map-overlay-type-control__option:hover {
    background: #fff8f2;
    color: #9c4b16;
}

.map-overlay-legend-dropdown {
    position: relative;
    display: inline-flex;
}

.map-overlay-legend-dropdown__panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 11;
    display: grid;
    gap: 0.2rem;
    min-width: 9.5rem;
    max-width: 13rem;
    padding: 0.28rem;
    border-radius: 0.45rem;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.map-overlay-legend-dropdown__panel[hidden] {
    display: none;
}

.map-overlay-legend__group {
    display: grid;
    gap: 0.12rem;
}

.map-overlay-legend__group + .map-overlay-legend__group {
    margin-top: 0.12rem;
    padding-top: 0.12rem;
    border-top: 1px solid rgba(139, 90, 43, 0.14);
}

.map-overlay-legend__group-title {
    padding: 0.05rem 0.3rem 0;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #7a6558;
    line-height: 1.2;
}

.map-overlay-legend__layer {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    width: 100%;
    min-height: 1.55rem;
    padding: 0.16rem 0.32rem;
    border: 1.5px solid transparent;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    text-align: left;
    box-shadow: none;
}

.map-overlay-legend__layer.is-pressed {
    border-color: #8b5a2b;
    box-shadow: inset 0 0 0 1px rgba(139, 90, 43, 0.25);
}

.map-overlay-legend__layer:not(.is-pressed) {
    opacity: 0.45;
}

.map-overlay-legend__icon {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
    object-fit: contain;
}

.map-overlay-legend__icon--fallback {
    width: 16px;
    height: 16px;
}

.map-overlay-legend__label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #2a241c;
    line-height: 1.15;
}

.map-overlay-difficulty-legend[hidden] {
    display: none !important;
}

.map-overlay-difficulty-legend:not([hidden]) {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 7;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    max-width: calc(100% - 24px);
    padding: 8px 12px;
    border: 1px solid rgba(139, 90, 43, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    font-size: 0.74rem;
    line-height: 1.2;
    pointer-events: none;
}

.map-overlay-difficulty-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.map-overlay-difficulty-legend__swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.map-overlay-difficulty-legend__label {
    color: #2a241c;
}

.map-overlay-pin {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.map-overlay-pin__icon {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.map-overlay-pin__icon--fallback {
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.map-overlay-pin__label {
    color: rgb(130, 80, 36);
    font-weight: 700;
    font-size: 0.66rem;
    background: rgba(255, 255, 255, 0.84);
    padding: 1px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    line-height: 1.25;
}
