/*
 * saxliko.ge location picker (assets/js/search-modal.js). Every class starts with .sxm (the
 * dialog) or .sxp (the trigger in the search form), so nothing leaks into the page.
 * Phones: full screen. Tablets / desktop: a centered window.
 */

/* `hidden` must win over the display rules below (loading text, search clear, found list...) */
.sxm [hidden], .sxp-host [hidden] { display: none !important; }

/* ---------- Trigger (homepage) + open button (results filter bar) ---------- */
.sxp-trigger { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 2px 0; border: 0; background: none; color: var(--c-ink, #0E1A2B); font: inherit; font-size: 1rem; font-weight: 600; text-align: left; cursor: pointer; }
.sxp-trigger__text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sxp-trigger__text.is-empty { color: var(--c-placeholder, #94A3B8); font-weight: 500; }
.sxp-trigger svg { flex: none; width: 18px; height: 18px; color: var(--c-muted, #66768D); }
.sxp-host { position: relative; }
.sxp-open { position: absolute; right: 8px; bottom: 6px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: var(--c-primary-soft, #EAF0FF); color: var(--c-primary, #1F5EFF); cursor: pointer; }
.sxp-open:hover { background: #DCE6FF; }
.sxp-open svg { width: 18px; height: 18px; }
.sxp-host .finput { padding-right: 48px; }

/* ---------- Dialog ---------- */
.sxm { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: #fff; color: #2B3A4F; font-family: "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", sans-serif; }
.sxm::backdrop { background: rgba(14, 26, 43, .55); backdrop-filter: blur(3px); }
.sxm[open] { display: flex; animation: sxm-up .24s cubic-bezier(.2, .7, .2, 1); }
.sxm__panel { display: flex; flex-direction: column; width: 100%; min-height: 0; }
@keyframes sxm-up { from { opacity: .4; transform: translateY(24px); } }
@media (min-width: 720px) {
  .sxm { width: min(100% - 48px, 760px); height: min(86vh, 760px); margin: auto; border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(14, 26, 43, .5); overflow: hidden; }
  .sxm[open] { animation-name: sxm-in; }
  @keyframes sxm-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
}

.sxm__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; }
.sxm__head h2 { margin: 0; font-size: 1.15rem; color: #0E1A2B; }
.sxm__x { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #F5F7FA; color: #0E1A2B; cursor: pointer; }
.sxm__x svg { width: 18px; height: 18px; }

/* Cities: one swipeable row of chips */
.sxm__cities { display: flex; gap: 6px; padding: 6px 16px 10px; overflow-x: auto; scrollbar-width: none; }
.sxm__cities::-webkit-scrollbar { display: none; }
.sxm__city { flex: none; min-height: 36px; padding: 0 14px; border: 1px solid #E2E8F0; border-radius: 999px; background: #fff; color: #2B3A4F; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sxm__city:hover { border-color: #B9C8F5; }
.sxm__city[aria-pressed="true"] { border-color: #0E1A2B; background: #0E1A2B; color: #fff; }
.sxm__city--more { color: #1F5EFF; }

/* Search */
.sxm__search { position: relative; margin: 0 16px 10px; }
.sxm__search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: #66768D; pointer-events: none; }
.sxm__search input { width: 100%; min-height: 46px; padding: 10px 40px 10px 42px; border: 1px solid #E2E8F0; border-radius: 14px; background: #F5F7FA; color: #0E1A2B; font: inherit; font-size: 1rem; }
.sxm__search input:focus { outline: none; border-color: #1F5EFF; background: #fff; box-shadow: 0 0 0 4px rgba(31, 94, 255, .14); }
.sxm__search input::-webkit-search-cancel-button { display: none; }
.sxm__qclear { position: absolute; right: 6px; top: 50%; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; color: #66768D; transform: translateY(-50%); cursor: pointer; }

/* Tabs */
.sxm__tabs { display: flex; gap: 4px; margin: 0 16px; padding: 4px; border-radius: 14px; background: #F5F7FA; }
.sxm__tab { flex: 1; min-height: 40px; padding: 0 6px; border: 0; border-radius: 10px; background: none; color: #66768D; font: inherit; font-size: .9rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
@media (max-width: 420px) { .sxm__tab { font-size: .8rem; } }
.sxm__tab[aria-selected="true"] { background: #fff; color: #1F5EFF; box-shadow: 0 1px 3px rgba(14, 26, 43, .12); }
.sxm__tab b { margin-left: 4px; padding: 0 7px; border-radius: 999px; background: #1F5EFF; color: #fff; font-size: .72rem; }
.sxm__tab b:empty { display: none; }

/* Body (scrolls) */
.sxm__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 16px; }
.sxm__all { display: flex; align-items: center; margin-bottom: 10px; padding: 10px 12px; border-radius: 14px; background: #F4F7FF; }
.sxm__group { padding: 10px 0; border-top: 1px solid #EEF2F6; }
.sxm__group:first-of-type { border-top: 0; }
.sxm__ghead { display: flex; align-items: center; gap: 8px; }
.sxm__ghead .sxm__opt { flex: 1; font-weight: 700; color: #0E1A2B; }
.sxm__count { font-size: .76rem; color: #94A3B8; }
.sxm__toggle { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; color: #66768D; cursor: pointer; }
.sxm__toggle svg { width: 18px; height: 18px; transition: transform .2s; }
.sxm__toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.sxm__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; padding: 6px 0 0 30px; }
.sxm__grid[hidden] { display: none; }
.sxm__grid--flat { padding-left: 0; }
@media (min-width: 720px) { .sxm__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* One checkbox row */
.sxm__opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; min-width: 0; padding: 4px 6px; border-radius: 10px; font-size: .92rem; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sxm__opt:hover { background: #F5F7FA; }
.sxm__opt input { position: absolute; opacity: 0; pointer-events: none; }
.sxm__box { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid #CBD5E1; border-radius: 7px; background: #fff; transition: background-color .12s, border-color .12s; }
.sxm__box::after { content: ""; width: 6px; height: 11px; margin-top: -2px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform .12s; }
.sxm__opt input:checked + .sxm__box { border-color: #1F5EFF; background: #1F5EFF; }
.sxm__opt input:checked + .sxm__box::after { transform: rotate(45deg) scale(1); }
.sxm__opt input:indeterminate + .sxm__box { border-color: #1F5EFF; background: #1F5EFF; }
.sxm__opt input:indeterminate + .sxm__box::after { width: 10px; height: 0; margin: 0; border-width: 0 0 2.5px; transform: none; }
.sxm__opt input:focus-visible + .sxm__box { outline: 2px solid #1F5EFF; outline-offset: 2px; }
.sxm__opt.is-implied { color: #66768D; }
.sxm__name { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.sxm__name mark { background: #FFF1C2; color: inherit; border-radius: 3px; }
.sxm__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.sxm__line { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; font-size: .82rem; font-weight: 700; color: #0E1A2B; }

/* Search results outside the current city + streets */
.sxm__found { display: grid; gap: 4px; margin-bottom: 12px; }
.sxm__found h3 { margin: 6px 0 2px; font-size: .74rem; font-weight: 700; color: #94A3B8; letter-spacing: .02em; }
.sxm__jump { display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 10px; background: #F5F7FA; color: #0E1A2B; font: inherit; font-size: .92rem; font-weight: 600; text-align: left; cursor: pointer; }
.sxm__jump:hover { background: #EAF0FF; }
.sxm__jump small { font-weight: 500; color: #66768D; }
.sxm__cityrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 720px) { .sxm__cityrow { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sxm__empty { margin: 24px 0; color: #66768D; text-align: center; }

/* Chips + footer */
.sxm__chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 92px; overflow-y: auto; padding: 10px 16px 0; border-top: 1px solid #EEF2F6; }
.sxm__chips:empty { display: none; }
.sxm__chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 32px; padding: 0 4px 0 12px; border-radius: 999px; background: #EAF0FF; color: #1849D6; font-size: .84rem; font-weight: 700; }
.sxm__chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sxm__chip button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.sxm__chip button:hover { background: rgba(31, 94, 255, .14); }
.sxm__chip button svg { width: 14px; height: 14px; }
.sxm__foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.sxm__reset { min-height: 48px; padding: 0 14px; border: 0; background: none; color: #66768D; font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sxm__apply { flex: 1; min-height: 52px; border: 0; border-radius: 14px; background: #1F5EFF; color: #fff; font: inherit; font-size: 1rem; font-weight: 800; cursor: pointer; box-shadow: 0 8px 20px -6px rgba(31, 94, 255, .55); }
.sxm__apply:hover { background: #1849D6; }
.sxm__note { margin: 0 16px; font-size: .8rem; color: #B54708; }
.sxm__note:empty { display: none; }
.sxm__loading { display: grid; place-items: center; gap: 10px; min-height: 200px; color: #66768D; }
.sxm__loading::before { content: ""; width: 30px; height: 30px; border: 3px solid #E2E8F0; border-top-color: #1F5EFF; border-radius: 50%; animation: sxm-spin .8s linear infinite; }
@keyframes sxm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sxm[open], .sxm__box::after, .sxm__toggle svg { animation: none; transition: none; } }
