/* =========================================================
   Карта туристических объектов (OpenStreetMap + Leaflet)
   ========================================================= */

.gmap {
    --gmap-dark: #1E1E35;
    --gmap-muted: #6B6B86;
    --gmap-accent: #F2B540;
    --gmap-line: #E7E7EE;
    --gmap-soft: #F6F6F9;
    --gmap-shadow: 0 6px 20px rgba(30, 30, 53, .14);

    position: relative;
    background: #fff;
    border-radius: 32px;
    padding: 20px;
    box-shadow: 0 24px 60px rgba(30, 30, 53, .10);
    color: var(--gmap-dark);
    font-family: inherit;
}

.gmap *,
.gmap *::before,
.gmap *::after {
    box-sizing: border-box;
}

.gmap button {
    font-family: inherit;
}

/* ---------- Фильтры по категориям ---------- */

.gmap__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 2px 2px 18px;
}

.gmap__filters::-webkit-scrollbar {
    display: none;
}

.gmap-chip {
    --c: var(--gmap-dark);
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 8px 0 14px;
    border: 1px solid var(--gmap-line);
    border-radius: 999px;
    background: #fff;
    color: var(--gmap-dark);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s, transform .2s;
}

.gmap-chip:hover {
    border-color: var(--c);
    box-shadow: 0 4px 14px rgba(30, 30, 53, .08);
}

.gmap-chip:active {
    transform: scale(.97);
}

.gmap-chip:focus-visible {
    outline: 3px solid rgba(242, 181, 64, .5);
    outline-offset: 2px;
}

.gmap-chip__icon {
    width: 22px;
    height: 22px;
    margin-left: -4px;
    transition: filter .2s;
}

.gmap-chip__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c);
}

.gmap-chip__dot--all {
    background: conic-gradient(#FF6161 0 25%, #00A911 0 50%, #1F2DA9 0 75%, #F2B540 0);
}

.gmap-chip__count {
    min-width: 28px;
    padding: 6px 8px;
    border-radius: 999px;
    background: var(--gmap-soft);
    color: var(--gmap-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    transition: background-color .2s, color .2s;
}

.gmap-chip.is-active {
    background: var(--c);
    border-color: var(--c);
    color: #fff;
    box-shadow: 0 6px 16px rgba(30, 30, 53, .16);
}

.gmap-chip.is-active .gmap-chip__icon {
    filter: brightness(0) invert(1);
}

.gmap-chip.is-active .gmap-chip__dot {
    box-shadow: 0 0 0 2px #fff;
}

.gmap-chip.is-active .gmap-chip__count {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

/* ---------- Основная область ---------- */

.gmap__body {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 20px;
    height: 660px;
}

/* ---------- Боковая панель ---------- */

.gmap__sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.gmap-search {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 16px;
    border: 1px solid var(--gmap-line);
    border-radius: 16px;
    background: var(--gmap-soft);
    color: var(--gmap-muted);
    cursor: text;
    transition: border-color .2s, background-color .2s, box-shadow .2s;
}

.gmap-search:focus-within {
    border-color: var(--gmap-accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(242, 181, 64, .18);
}

.gmap-search svg {
    flex: none;
}

.gmap-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--gmap-dark);
    font: inherit;
    font-size: 16px;
    outline: none;
}

.gmap-search input::placeholder {
    color: #9A9AB0;
}

.gmap__found {
    margin: 14px 4px 8px;
    color: var(--gmap-muted);
    font-size: 14px;
}

.gmap__found strong {
    color: var(--gmap-dark);
}

.gmap-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0 6px 0 0;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #D5D5E0 transparent;
}

.gmap-list::-webkit-scrollbar {
    width: 6px;
}

.gmap-list::-webkit-scrollbar-thumb {
    background: #D5D5E0;
    border-radius: 6px;
}

.gmap-list li + li {
    margin-top: 2px;
}

.gmap-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 18px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color .2s, border-color .2s;
}

.gmap-item:hover {
    background: var(--gmap-soft);
}

.gmap-item:focus-visible {
    outline: 3px solid rgba(242, 181, 64, .5);
    outline-offset: -1px;
}

.gmap-item.is-active {
    background: #FFF7E6;
    border-color: rgba(242, 181, 64, .65);
}

.gmap-item__img {
    flex: none;
    width: 72px;
    height: 72px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--gmap-soft);
}

.gmap-item__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}

.gmap-item__img img.is-icon {
    object-fit: contain;
    padding: 14px;
}

.gmap-item:hover .gmap-item__img img {
    transform: scale(1.06);
}

.gmap-item__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.gmap-item__cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    line-height: 1.3;
    text-transform: uppercase;
}

.gmap-item__cat::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c);
}

.gmap-item__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--gmap-dark);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.gmap-item__addr {
    overflow: hidden;
    color: var(--gmap-muted);
    font-size: 13px;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gmap-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 24px;
    color: var(--gmap-muted);
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
}

.gmap-empty[hidden] {
    display: none;
}

.gmap-empty svg {
    color: #C9C9D6;
}

/* ---------- Карта ---------- */

.gmap__map-wrap {
    position: relative;
    min-height: 0;
    border-radius: 24px;
    overflow: hidden;
    isolation: isolate;
    background: #E8EDF0;
}

.gmap__map {
    width: 100%;
    height: 100%;
    background: #E8EDF0;
    font-family: inherit;
}

.gmap-tiles-osm {
    filter: saturate(.78) brightness(1.03);
}

.gmap__loader {
    position: absolute;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(232, 237, 240, .85);
    transition: opacity .4s, visibility .4s;
}

.gmap__loader span {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(30, 30, 53, .12);
    border-top-color: var(--gmap-accent);
    border-radius: 50%;
    animation: gmap-spin .8s linear infinite;
}

.gmap__loader.is-hidden {
    opacity: 0;
    visibility: hidden;
}

@keyframes gmap-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Маркеры ---------- */

.gmap-pin-wrap {
    background: none;
    border: 0;
}

.gmap-pin-wrap.is-hover {
    z-index: 10000 !important;
}

.gmap-pin {
    width: 40px;
    height: 40px;
    transform-origin: 50% 100%;
    filter: drop-shadow(0 4px 5px rgba(30, 30, 53, .35));
    transition: transform .2s cubic-bezier(.34, 1.56, .64, 1);
}

.gmap-pin img {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
}

.gmap-pin-wrap:hover .gmap-pin,
.gmap-pin-wrap.is-hover .gmap-pin {
    transform: scale(1.3);
}

.gmap-pin__fallback {
    display: block;
    width: 28px;
    height: 28px;
    margin: 2px auto 0;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--c);
    transform: rotate(-45deg);
}

/* ---------- Кластеры (кольцо из цветов категорий) ---------- */

.gmap-cluster-wrap {
    background: none;
    border: 0;
}

.gmap-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(30, 30, 53, .3);
    transition: transform .2s;
}

.gmap-cluster span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    border-radius: 50%;
    background: #fff;
    color: var(--gmap-dark, #1E1E35);
    font-size: 14px;
    font-weight: 800;
}

.gmap-cluster-wrap:hover .gmap-cluster {
    transform: scale(1.1);
}

/* ---------- Карточка объекта (popup) ---------- */

.gmap-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(30, 30, 53, .25);
}

.gmap-popup .leaflet-popup-content {
    margin: 0;
    font-family: "Nunito Sans", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.gmap-popup .leaflet-popup-tip {
    box-shadow: 0 8px 20px rgba(30, 30, 53, .2);
}

.gmap-popup a.leaflet-popup-close-button {
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 4px 12px rgba(30, 30, 53, .2);
    color: #1E1E35;
    font: 400 22px/1 sans-serif;
    transition: transform .2s;
}

.gmap-popup a.leaflet-popup-close-button:hover {
    color: #1E1E35;
    transform: rotate(90deg);
}

.gmap-card {
    width: 300px;
    max-width: 100%;
}

.gmap-card__media {
    display: block;
    height: 170px;
    overflow: hidden;
    background: #F0F0F4;
}

.gmap-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s;
}

.gmap-card__media:hover img {
    transform: scale(1.05);
}

.gmap-card__body {
    padding: 16px 18px 18px;
}

.gmap-card__cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.gmap-card__cat::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c);
}

.gmap-popup a.gmap-card__title {
    display: block;
    margin: 6px 0 8px;
    color: #1E1E35;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
    text-decoration: none;
    transition: color .2s;
}

.gmap-popup a.gmap-card__title:hover {
    color: #C98A12;
}

.gmap-card__addr {
    display: flex;
    gap: 6px;
    color: #6B6B86;
    font-size: 13px;
    line-height: 1.4;
}

.gmap-card__addr svg {
    flex: none;
    margin-top: 2px;
}

.gmap-popup p.gmap-card__text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 10px 0 0;
    color: #4A4A63;
    font-size: 14px;
    line-height: 1.5;
}

.gmap-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.gmap-popup a.gmap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s, color .2s, border-color .2s;
}

.gmap-popup a.gmap-btn--primary {
    flex: 1;
    background: #1E1E35;
    color: #fff;
}

.gmap-popup a.gmap-btn--primary:hover {
    background: #F2B540;
    color: #1E1E35;
}

.gmap-popup a.gmap-btn--ghost {
    border: 1px solid #E1E1EA;
    color: #1E1E35;
}

.gmap-popup a.gmap-btn--ghost:hover {
    border-color: #1E1E35;
}

/* ---------- Элементы управления картой ---------- */

.gmap .leaflet-touch .leaflet-bar,
.gmap .leaflet-bar {
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--gmap-shadow);
}

.gmap .leaflet-bar a,
.gmap .leaflet-touch .leaflet-bar a {
    width: 40px;
    height: 40px;
    line-height: 40px;
    color: var(--gmap-dark);
    font-size: 20px;
    font-weight: 400;
}

.gmap .leaflet-bar a:hover {
    background: var(--gmap-accent);
}

.gmap .leaflet-top.leaflet-right {
    top: 6px;
    right: 6px;
}

.gmap-tools {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.gmap-tool {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--gmap-shadow);
    color: var(--gmap-dark);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}

.gmap-tool:hover {
    background: var(--gmap-accent);
}

.gmap-tool.is-on {
    background: var(--gmap-dark);
    color: #fff;
}

.gmap-tool--icon {
    justify-content: center;
    width: 40px;
    padding: 0;
}

.gmap .leaflet-control-attribution {
    padding: 2px 8px;
    border-top-left-radius: 10px;
    background: rgba(255, 255, 255, .8);
    font-size: 11px;
}

.gmap .leaflet-control-attribution a {
    color: var(--gmap-muted);
}

.gmap .leaflet-gesture-handling-touch-warning::after,
.gmap .leaflet-gesture-handling-scroll-warning::after {
    font-family: inherit;
    font-size: 18px;
    padding: 0 24px;
}

/* ---------- Полноэкранный режим ---------- */

html.gmap-lock,
html.gmap-lock body {
    overflow: hidden;
}

.gmap.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-radius: 0;
}

.gmap.is-fullscreen .gmap__body {
    flex: 1;
    height: auto;
    min-height: 0;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1360px) {
    .gmap__body {
        grid-template-columns: 330px minmax(0, 1fr);
        height: 620px;
    }
}

@media (max-width: 991px) {
    .gmap {
        padding: 14px;
        border-radius: 24px;
    }

    .gmap__filters {
        gap: 8px;
        padding: 2px 0 14px;
    }

    .gmap-chip {
        height: 40px;
        font-size: 14px;
    }

    .gmap__body {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        height: auto;
    }

    .gmap__sidebar {
        order: 2;
    }

    .gmap__map-wrap {
        height: 62vh;
        min-height: 380px;
        max-height: 560px;
        border-radius: 18px;
    }

    .gmap-list {
        max-height: 420px;
    }

    .gmap-tool span {
        display: none;
    }

    .gmap-tool {
        justify-content: center;
        width: 40px;
        padding: 0;
    }

    .gmap.is-fullscreen .gmap__sidebar {
        display: none;
    }

    .gmap.is-fullscreen .gmap__map-wrap {
        height: auto;
        max-height: none;
        min-height: 0;
    }
}

@media (max-width: 767px) {
    .gmap__filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: 0 -14px;
        padding: 2px 14px 14px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .gmap-item__img {
        width: 60px;
        height: 60px;
    }

    .gmap-card {
        width: 260px;
    }

    .gmap-card__media {
        height: 140px;
    }
}
