/* Education & Care "Search on map" — sidebar tile + full-screen map modal */

/* ── Sidebar tile (illustrated mini-map) ─────────────────────────────────── */
.ec-map-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    width: 100%;
    height: 112px;
    padding: 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-16);
    overflow: hidden;
    cursor: pointer;
    background:
        radial-gradient(circle at 88% 18%, #7cc8f2 0 20%, transparent 21%),
        radial-gradient(ellipse 34% 40% at 10% 88%, #8fdc8a 0 100%, transparent 101%),
        linear-gradient(28deg, transparent 47%, #ffbf3c 47% 51%, transparent 51%),
        linear-gradient(-62deg, transparent 58%, #ffe58a 58% 61%, transparent 61%),
        repeating-linear-gradient(0deg, transparent 0 25px, #fff 25px 28px),
        repeating-linear-gradient(90deg, transparent 0 33px, #fff 33px 36px),
        #e6ecdf;
    transition: border-color 0.15s, box-shadow 0.2s;
}

@media (hover: hover) {

.ec-map-tile:hover {
    border-color: var(--action);
    box-shadow: var(--shadow-m);
}
}

.ec-map-tile:focus-visible {
    outline: 3px solid rgba(var(--action-rgb), 0.35);
    outline-offset: 2px;
}

.ec-map-tile-pin {
    font-size: 2rem;
    color: var(--action);
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.25));
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) {

.ec-map-tile:hover .ec-map-tile-pin {
    transform: translateY(-5px);
}
}

.ec-map-tile-label {
    padding: 3px 12px;
    border-radius: var(--radius-max);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-strong);
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: var(--shadow-s);
}

/* ── Modal shell (Agoda's map: 16px inset, 50px top strip, filters | list | map) ── */
body.ec-map-open {
    overflow: hidden;
}

.ec-map-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    padding: var(--space-16);
    background: rgba(13, 17, 24, 0.85);
}

.ec-map-modal[hidden] {
    display: none;
}

.ec-map-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--background);
}

/* Close sits on the map's top-right corner, level with the search pill (no empty top strip) */
.ec-map-close {
    position: absolute;
    top: 26px;
    right: 10px;
    z-index: 1000;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--background);
    color: var(--action);
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(4, 7, 10, 0.24);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ec-map-close:focus-visible {
    outline: 3px solid rgba(var(--action-rgb), 0.35);
    outline-offset: 1px;
}

@media (hover: hover) {

.ec-map-close:hover {
    background: var(--action);
    color: var(--text-inverted);
}
}

.ec-map-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* Thin always-visible scrollbars on the two scrolling columns */
.ec-map-filters,
.ec-map-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(94, 107, 130, 0.55) var(--background-subtle);
}

.ec-map-filters::-webkit-scrollbar,
.ec-map-list::-webkit-scrollbar {
    width: 6px;
}

.ec-map-filters::-webkit-scrollbar-track,
.ec-map-list::-webkit-scrollbar-track {
    background: var(--background-subtle);
}

.ec-map-filters::-webkit-scrollbar-thumb,
.ec-map-list::-webkit-scrollbar-thumb {
    background: rgba(94, 107, 130, 0.55);
}

/* ── Filter column ───────────────────────────────────────────────────────── */
.ec-map-filters {
    flex: 0 0 263px;
    overflow-y: auto;
    padding: var(--space-16);
}

.ec-map-shell.is-filters-hidden .ec-map-filters {
    display: none;
}

.ec-map-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-8);
    height: 36px;
    padding: 0 var(--space-16);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-max);
    background: var(--background);
    color: var(--action);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.ec-map-filter-toggle i {
    font-size: 1rem;
}

.ec-map-filter-toggle:focus-visible {
    outline: 3px solid rgba(var(--action-rgb), 0.35);
    outline-offset: 1px;
}

@media (hover: hover) {

.ec-map-filter-toggle:hover {
    border-color: var(--action);
}
}

.ec-map-filter-toggle--show {
    display: none;
    margin-bottom: var(--space-12);
    border-color: var(--action);
    background: var(--action);
    color: var(--text-inverted);
}

.ec-map-shell.is-filters-hidden .ec-map-filter-toggle--show {
    display: inline-flex;
}

.ec-map-filters-body {
    margin-top: var(--space-16);
}

/* The listing's #filterForm inside the map: Agoda's flat rows. Two IDs beat directory.css's #filterForm cards */
#ecMapFilters .ec-sidebar-search,
#ecMapFilters .ec-map-tile {
    display: none;
}

#ecMapFilters #filterForm > .mb-2,
#ecMapFilters #filterForm > .mb-3 {
    margin: 0 !important;
}

#ecMapFilters #filterForm > .mb-2 + .mb-2,
#ecMapFilters #filterForm > .ec-your-filters + .mb-2 {
    margin-top: var(--space-16) !important;
    padding-top: var(--space-16);
    border-top: 1px solid var(--border-subtle);
}

#ecMapFilters .ec-your-filters {
    padding-bottom: 0;
    border-bottom: 0;
}

#ecMapFilters .ec-filter-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
}

#ecMapFilters .ec-filter-section-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-strong);
}

#ecMapFilters .ec-filter-clear-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--action);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

#ecMapFilters #filterForm .form-check.ec-filter-check {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    min-height: 32px;
    margin: 0;
    padding: 0;
}

#ecMapFilters #filterForm .form-check.ec-filter-check .form-check-input {
    float: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 2px solid rgba(13, 17, 24, 0.64);
    border-radius: 2px;
    background-color: var(--background);
    box-shadow: none;
    cursor: pointer;
}

#ecMapFilters #filterForm .form-check.ec-filter-check .form-check-input:checked {
    border-color: var(--action);
    background-color: var(--action);
}

#ecMapFilters #filterForm .form-check.ec-filter-check .form-check-input:focus-visible {
    box-shadow: 0 0 0 3px rgba(var(--action-rgb), 0.3);
}

#ecMapFilters #filterForm .form-check.ec-filter-check .form-check-label,
#ecMapFilters #filterForm .form-check.ec-filter-check .form-check-input:checked + .form-check-label {
    display: block;
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--text-default);
    font-size: var(--fs-sm);
    font-weight: 400;
    line-height: 1.3;
    transform: none;
    cursor: pointer;
}

@media (hover: hover) {

#ecMapFilters #filterForm .form-check.ec-filter-check .form-check-label:hover {
    color: var(--action);
}
}

/* ── List column ─────────────────────────────────────────────────────────── */
.ec-map-list-pane {
    flex: 0 1 750px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ec-map-list-head {
    padding: 10px 15px 0;
}

.ec-map-count {
    margin: 0 0 var(--space-4);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-strong);
}

.ec-map-hint {
    margin: 0;
    font-size: var(--fs-xs);
    color: var(--text-subtle);
}

/* Sort by: outlined button with the label notched into its border, and its own option list */
.ec-map-sort {
    position: relative;
    margin-top: var(--space-16);
}

.ec-map-sort-label {
    position: absolute;
    top: 0;
    left: 9px;
    z-index: 1;
    padding: 0 4px;
    transform: translateY(-50%);
    background: var(--background);
    color: var(--text-subtle);
    font-size: var(--fs-xs);
    line-height: 1;
    pointer-events: none;
}

.ec-map-sort-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-8);
    width: 100%;
    height: 44px;
    padding: 0 var(--space-16) 0 13px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-8);
    background: var(--background);
    color: var(--text-strong);
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ec-map-sort-btn i {
    color: var(--text-subtle);
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.ec-map-sort-btn[aria-expanded="true"] {
    border-color: var(--focus-border);
}

.ec-map-sort-btn[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.ec-map-sort-btn:focus-visible {
    border-color: var(--focus-border);
    outline: 3px solid rgba(var(--action-rgb), 0.25);
    outline-offset: 0;
}

@media (hover: hover) {

.ec-map-sort-btn:hover {
    border-color: var(--action);
}
}

.ec-map-sort-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 6px 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-8);
    background: var(--background);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.13);
    list-style: none;
}

.ec-map-sort-menu[hidden] {
    display: none;
}

/* Same as the listing's sort menu: hover tint, active option in the action colour with a bar + check */
.ec-map-sort-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-left: 3px solid transparent;
    color: var(--text-default);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.1s;
}

.ec-map-sort-opt i {
    visibility: hidden;
    color: var(--action);
    font-size: var(--fs-xs);
}

.ec-map-sort-opt.is-active {
    border-left-color: var(--brand);
    color: var(--action);
    font-weight: 600;
}

.ec-map-sort-opt.is-active i {
    visibility: visible;
}

.ec-map-sort-opt:focus {
    outline: none;
    background: var(--action-hover-wash);
}

@media (hover: hover) {

.ec-map-sort-opt:hover {
    background: var(--action-hover-wash);
}
}

.ec-map-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 14px 15px 15px;
    overflow-y: auto;
}

.ec-map-empty {
    margin: var(--space-48) var(--space-16);
    text-align: center;
    color: var(--text-subtle);
    font-size: var(--fs-sm);
}

.ec-map-empty i {
    display: block;
    margin-bottom: var(--space-8);
    font-size: 1.6rem;
}

/* ── Card: image | details | score (Agoda's 1/3 · 5/12 · 1/4) ───────────────── */
.ec-map-card {
    display: grid;
    flex-shrink: 0;
    grid-template-columns: 33.3% 1fr 25%;
    min-height: 168px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-8);
    overflow: hidden;
    background: var(--background);
    color: var(--text-default);
    text-decoration: none;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Hover / marker hover: 2px action border + lift; the detail page's own centre: border only */
.ec-map-card.is-active {
    border-color: var(--action);
    box-shadow: 0 0 0 1px var(--action), 0 4px 10px rgba(4, 7, 10, 0.24);
    color: var(--text-default);
}

.ec-map-card.is-current {
    border-color: var(--action);
    box-shadow: 0 0 0 1px var(--action);
}

@media (hover: hover) {

.ec-map-card:hover {
    border-color: var(--action);
    box-shadow: 0 0 0 1px var(--action), 0 4px 10px rgba(4, 7, 10, 0.24);
    color: var(--text-default);
}

.ec-map-card:hover .ec-map-card-name {
    text-decoration: underline;
}
}

.ec-map-card:focus-visible {
    outline: 3px solid rgba(var(--action-rgb), 0.35);
    outline-offset: 1px;
}

.ec-map-thumb {
    display: block;
    min-height: 100%;
    background: var(--background-subtle);
}

.ec-map-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ec-map-thumb-empty {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--text-disabled);
    font-size: 1.8rem;
}

.ec-map-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: var(--space-12) var(--space-16);
    border-right: 1px solid var(--border-subtle);
}

.ec-map-card-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-strong);
}

.ec-map-card-area {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--action);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-map-card-area i {
    margin-right: 4px;
}

.ec-map-card-cost {
    margin-top: auto;
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text-strong);
}

.ec-map-card-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding: var(--space-12) var(--space-12) var(--space-12) var(--space-8);
    text-align: right;
}

.ec-map-score-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ec-map-score {
    padding: 2px 4px;
    border-radius: 4px 4px 4px 0;
    background: var(--action);
    color: var(--text-inverted);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.1;
}

.ec-map-score-label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--action);
}

.ec-map-reviews {
    font-size: var(--fs-sm);
    color: var(--text-subtle);
}

.ec-map-gem {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--action);
}

/* ── Map column ──────────────────────────────────────────────────────────── */
.ec-map-canvas-wrap {
    position: relative;
    flex: 1 1 0;
    min-width: 280px;
    min-height: 0;
}

.ec-map-canvas {
    width: 100%;
    height: 100%;
    background: #e6ecdf;
}

/* OSM tiles are muted; boost colour on the tiles only (pins/cards untouched) */
.ec-map-canvas .leaflet-tile-pane {
    filter: saturate(1.7) contrast(1.05) brightness(1.03);
}

/* Agoda's zoom: two separate 44px buttons, bottom-right (ID beats leaflet.css, which loads later) */
#ecMapCanvas .leaflet-bar {
    margin: 0 10px 30px 0;
    border: 0;
    box-shadow: none;
}

#ecMapCanvas .leaflet-bar a {
    width: 44px;
    height: 46px;
    margin-top: 2px;
    border: 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-subtle);
    font-size: 18px;
    font-weight: 700;
    line-height: 46px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15);
}

/* Search on map: white shell around a tinted pill */
.ec-map-search {
    position: absolute;
    top: 22px;
    right: 66px; /* clear of the close button */
    z-index: 1000;
    width: min(308px, calc(100% - 76px));
    padding: 4px;
    border-radius: 24px;
    background: var(--background);
    box-shadow: 0 4px 10px rgba(4, 7, 10, 0.24);
}

.ec-map-search-field {
    position: relative;
    border-radius: 22px;
    background: var(--action-hover-wash);
}

.ec-map-search-field:focus-within {
    box-shadow: inset 0 0 0 2px var(--focus-border);
}

.ec-map-search-icon {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: var(--text-strong);
    pointer-events: none;
}

.ec-map-search-input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    border: 0;
    background: transparent;
    color: var(--text-default);
    font-size: 1rem;
    outline: none;
}

.ec-map-search-input::placeholder {
    color: var(--text-subtle);
}

.ec-map-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 12px;
    background: var(--background);
    box-shadow: var(--shadow-panel);
}

.ec-map-suggest[hidden] {
    display: none;
}

.ec-map-suggest-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-8);
    font-size: 0.86rem;
    color: var(--text-default);
    cursor: pointer;
}

.ec-map-suggest-opt i {
    width: 16px;
    text-align: center;
    color: var(--action);
}

.ec-map-suggest-opt small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-subtle);
}

.ec-map-suggest-opt.is-active {
    background: var(--action-hover-wash);
}

@media (hover: hover) {

.ec-map-suggest-opt:hover {
    background: var(--action-hover-wash);
}
}

.ec-map-suggest-none {
    padding: 10px;
    font-size: 0.84rem;
    color: var(--text-subtle);
}

/* ── Markers: score pills with a tail ────────────────────────────────────── */
.ec-map-pin-wrap {
    background: none;
    border: 0;
}

.ec-map-pin {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, calc(-100% - 9px));
    padding: 2px 8px;
    border-radius: 25px;
    background: var(--background);
    color: var(--action);
    font-size: 14px;
    font-weight: 700;
    line-height: 18px;
    white-space: nowrap;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.15);
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.ec-map-pin::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom: 0;
    border-top-color: var(--background);
    transition: border-top-color 0.12s;
}

.ec-map-pin-wrap.is-active .ec-map-pin,
.ec-map-pin-wrap.is-current .ec-map-pin {
    background: var(--action);
    color: var(--text-inverted);
    box-shadow: 0 0 0 2px var(--background), 0 2px 7px rgba(0, 0, 0, 0.25);
}

.ec-map-pin-wrap.is-active .ec-map-pin::after,
.ec-map-pin-wrap.is-current .ec-map-pin::after {
    border-top-color: var(--action);
}

/* Marker tooltip: thumbnail + name + score, left of the pin */
.leaflet-tooltip.ec-map-tip {
    display: flex;
    width: 240px;
    height: 68px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    overflow: hidden;
    background: var(--background);
    color: var(--text-default);
    white-space: normal;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.leaflet-tooltip.ec-map-tip::before {
    display: none;
}

.ec-map-tip-thumb {
    flex: 0 0 68px;
    background: var(--background-subtle);
}

.ec-map-tip-thumb img {
    display: block;
    width: 68px;
    height: 68px;
    object-fit: cover;
}

.ec-map-tip-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    padding: 0 10px;
}

.ec-map-tip-name {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    color: var(--text-strong);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-map-tip-score {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-subtle);
}

.ec-map-tip-score b {
    color: var(--text-strong);
}

.ec-map-tip-score .ec-map-score {
    font-size: 11px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
/* Agoda drops the filter column below ~1100px */
@media (max-width: 1099.98px) {
    .ec-map-filters,
    .ec-map-shell.is-filters-hidden .ec-map-filter-toggle--show {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .ec-map-modal {
        padding: 0;
    }

    .ec-map-body {
        flex-direction: column;
    }

    .ec-map-canvas-wrap {
        flex: 1 1 58%;
        min-width: 0;
    }

    .ec-map-list-pane {
        order: 2;
        flex: 1 1 42%;
        min-height: 0;
        border-top: 1px solid var(--border-subtle);
    }

    .ec-map-list-head {
        display: flex;
        align-items: baseline;
        gap: var(--space-12);
        padding: var(--space-8) var(--space-16) 0;
    }

    .ec-map-hint,
    .ec-map-sort {
        display: none;
    }

    .ec-map-list {
        padding: var(--space-12) var(--space-16) var(--space-16);
    }
}

/* Phones: image | details, the score under the details */
@media (max-width: 575.98px) {
    .ec-map-card {
        grid-template-columns: 112px 1fr;
        grid-template-rows: 1fr auto;
        min-height: 0;
    }

    .ec-map-thumb {
        grid-row: 1 / 3;
    }

    .ec-map-card-body {
        padding: var(--space-8) var(--space-12) 0;
        border-right: 0;
    }

    .ec-map-card-name {
        font-size: 0.95rem;
    }

    .ec-map-card-score {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        padding: var(--space-4) var(--space-12) var(--space-8);
        text-align: left;
    }

    .leaflet-tooltip.ec-map-tip {
        width: 200px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ec-map-tile-pin,
    .ec-map-pin,
    .ec-map-card {
        transition: none;
    }
}
