/* Карта доставки (плагін shop/deliverymap) */
.deliverymap { margin: 20px 0 28px; font: inherit; color: inherit; }
.deliverymap .dm-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.deliverymap .dm-summary { margin: 0; font-weight: 600; line-height: 1.4; }
.deliverymap .dm-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.deliverymap .dm-search { position: relative; flex: 1 1 260px; }
.deliverymap .dm-input {
    width: 100%; box-sizing: border-box; height: 42px; padding: 0 14px; font: inherit; font-size: 15px;
    border: 1px solid #d5dbe5; border-radius: 10px; background: #fff; color: inherit; outline: none;
}
.deliverymap .dm-input:focus { border-color: #4a7cf0; box-shadow: 0 0 0 3px rgba(74, 124, 240, .15); }
.deliverymap .dm-suggest {
    position: absolute; z-index: 1001; left: 0; right: 0; top: 46px; margin: 0; padding: 4px; list-style: none;
    background: #fff; border: 1px solid #e3e8ef; border-radius: 10px; box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
    max-height: 320px; overflow: auto;
}
.deliverymap .dm-suggest li {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: baseline;
    padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; line-height: 1.35;
}
.deliverymap .dm-suggest li:hover, .deliverymap .dm-suggest li:focus { background: #f2f5fa; outline: none; }
.deliverymap .dm-suggest small { color: #6b7280; }
.deliverymap .dm-suggest span { color: #6b7280; font-size: 12px; white-space: nowrap; }
.deliverymap .dm-suggest .dm-empty { color: #6b7280; cursor: default; }
.deliverymap .dm-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.deliverymap .dm-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; font: inherit; font-size: 13px; line-height: 1.2;
    border: 1px solid #d5dbe5; border-radius: 999px; background: #fff; color: #6b7280; cursor: pointer;
}
.deliverymap .dm-chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; opacity: .35; }
.deliverymap .dm-chip span { color: #9aa3b2; font-size: 12px; }
.deliverymap .dm-chip.is-on { color: inherit; border-color: #b8c3d4; background: #f7f9fc; }
.deliverymap .dm-chip.is-on i { opacity: 1; }
.deliverymap .dm-map-wrap { position: relative; }
.deliverymap .dm-map {
    height: 520px; border-radius: 14px; overflow: hidden; border: 1px solid #e3e8ef; background: #eef2f6; z-index: 0;
}
.deliverymap .leaflet-container { font-family: inherit; }
/* «Показати мене на мапі» — на карті, праворуч угорі */
.deliverymap .dm-locate {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px;
    font: inherit; font-size: 13px; font-weight: 600; line-height: 1; color: #1f2a44; background: #fff;
    border: 0; border-radius: 999px; box-shadow: 0 1px 5px rgba(15, 23, 42, .28); cursor: pointer;
}
.deliverymap .dm-locate svg { color: #2563eb; flex: none; }
.deliverymap .dm-locate:hover { background: #f5f7fb; }
.deliverymap .dm-locate[disabled] { cursor: progress; }
.deliverymap .dm-locate.is-busy svg { animation: dm-spin 1s linear infinite; }
@keyframes dm-spin { to { transform: rotate(360deg); } }
.deliverymap .dm-toast {
    position: absolute; z-index: 600; top: 58px; left: 50%; transform: translateX(-50%);
    width: max-content; max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 12px;
    background: rgba(17, 24, 39, .85); color: #fff; font-size: 13px; line-height: 1.35; text-align: center;
    pointer-events: none;
}
/* світлі шви між плитками: Leaflet 1.9 змішує плитки plus-lighter, і стики висвітлюються;
   звичайне змішування + перекриття на пів пікселя (дробний масштаб zoomSnap 0.5 інакше дає щілини) */
.deliverymap .leaflet-tile-container img.leaflet-tile {
    mix-blend-mode: normal; width: 256.5px !important; height: 256.5px !important;
}
.deliverymap .dm-note {
    position: absolute; z-index: 500; left: 50%; bottom: 14px; transform: translateX(-50%);
    padding: 6px 12px; border-radius: 999px; background: rgba(17, 24, 39, .78); color: #fff; font-size: 13px;
    pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.deliverymap.dm-touch-locked .dm-map::after {
    content: attr(data-hint); position: absolute; z-index: 500; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: max-content; max-width: calc(100% - 96px); padding: 8px 14px; border-radius: 12px;
    background: rgba(17, 24, 39, .72); color: #fff; font-size: 13px; text-align: center; pointer-events: none;
}
.deliverymap.dm-failed .dm-map { display: flex; align-items: center; justify-content: center; }

/* бульбашки огляду і кластери */
.dm-bubble {
    display: flex !important; align-items: center; justify-content: center; border-radius: 50%;
    background: rgba(37, 99, 235, .88); color: #fff; font: 600 12px/1 system-ui, sans-serif;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .22); cursor: pointer;
}
.dm-bubble span { pointer-events: none; }
/* пункти */
.dm-dot { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); box-sizing: border-box; }
.dm-dot-np { background: #da291c; }
.dm-dot-up { background: #e8a900; }
.dm-dot-meest { background: #0061af; }
.dm-dot-pickup { background: #12a150; border-width: 3px; }
/* підказка пункту */
.dm-pop { font-size: 13px; line-height: 1.45; min-width: 180px; }
.dm-pop-h { display: flex; align-items: center; gap: 6px; color: #6b7280; font-size: 12px; margin-bottom: 3px; }
.dm-pop-h i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dm-pop b { display: block; font-size: 14px; }
.dm-pop-x { color: #6b7280; font-size: 12px; margin-top: 2px; }

/* темна тема сайту: клас html.rd-dark (ridmi і warbooks, перемикач у меню; системну тему сайт не бере) */
html.rd-dark .deliverymap .dm-input { background: #232C3B; border-color: rgba(255, 255, 255, .1); color: #E7ECF4; }
html.rd-dark .deliverymap .dm-input::placeholder { color: #8590A6; }
html.rd-dark .deliverymap .dm-input:focus { border-color: #738EC8; box-shadow: 0 0 0 3px rgba(115, 142, 200, .25); }
html.rd-dark .deliverymap .dm-suggest { background: #1B2330; border-color: rgba(255, 255, 255, .08); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
html.rd-dark .deliverymap .dm-suggest li { color: #E7ECF4; }
html.rd-dark .deliverymap .dm-suggest li:hover, html.rd-dark .deliverymap .dm-suggest li:focus { background: #232C3B; }
html.rd-dark .deliverymap .dm-suggest small, html.rd-dark .deliverymap .dm-suggest span,
html.rd-dark .deliverymap .dm-suggest .dm-empty { color: #97A1B2; }
html.rd-dark .deliverymap .dm-chip { background: transparent; border-color: rgba(255, 255, 255, .12); color: #8590A6; }
html.rd-dark .deliverymap .dm-chip.is-on { background: #232C3B; border-color: rgba(255, 255, 255, .18); color: #E7ECF4; }
html.rd-dark .deliverymap .dm-chip span { color: #8590A6; }
html.rd-dark .deliverymap .dm-map { background: #12171F; border-color: rgba(255, 255, 255, .08); }
/* світлі плитки OSM → темні (лише основа; мітки й пункти не чіпаємо) */
html.rd-dark .deliverymap .leaflet-tile-pane { filter: brightness(.6) invert(1) contrast(3) hue-rotate(200deg) saturate(.3) brightness(.7); }
html.rd-dark .deliverymap .leaflet-bar { border-color: rgba(255, 255, 255, .12); }
html.rd-dark .deliverymap .leaflet-bar a { background: #1B2330; color: #E7ECF4; border-bottom-color: rgba(255, 255, 255, .1); }
html.rd-dark .deliverymap .leaflet-bar a:hover { background: #232C3B; }
html.rd-dark .deliverymap .leaflet-container .leaflet-control-attribution { background: rgba(18, 23, 31, .8); color: #97A1B2; }
html.rd-dark .deliverymap .leaflet-container .leaflet-control-attribution a { color: #8FB0E8; }
html.rd-dark .deliverymap .leaflet-popup-content-wrapper,
html.rd-dark .deliverymap .leaflet-popup-tip { background: #1B2330; color: #E7ECF4; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
html.rd-dark .deliverymap .leaflet-container a.leaflet-popup-close-button { color: #97A1B2; }
html.rd-dark .deliverymap .dm-pop-h, html.rd-dark .deliverymap .dm-pop-x { color: #97A1B2; }
html.rd-dark .deliverymap .leaflet-tooltip { background: #1B2330; color: #E7ECF4; border-color: #1B2330; }
html.rd-dark .deliverymap .leaflet-tooltip-top::before { border-top-color: #1B2330; }
html.rd-dark .deliverymap .dm-locate { background: #1B2330; color: #E7ECF4; box-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
html.rd-dark .deliverymap .dm-locate svg { color: #8FB0E8; }
html.rd-dark .deliverymap .dm-locate:hover { background: #232C3B; }

@media (max-width: 640px) {
    /* на телефоні карта — на всю ширину екрана (поля сторінки й картки забирали ~40 px з кожного боку) */
    .deliverymap .dm-map-wrap { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
    .deliverymap .dm-map { height: 440px; border-radius: 0; border-left: 0; border-right: 0; }
    /* фільтри — один рядок, що гортається вбік, теж до країв екрана */
    .deliverymap .dm-filters {
        flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
        margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); padding: 0 calc(50vw - 50%) 2px;
    }
    .deliverymap .dm-filters::-webkit-scrollbar { display: none; }
    .deliverymap .dm-chip { flex: none; white-space: nowrap; }
    .deliverymap .dm-note { width: max-content; white-space: normal; text-align: center; border-radius: 12px; font-size: 12px; }
}
