/* ==========================================================================
   VikSale — Модалка «Город или регион»
   Путь: /css/geo-modal.css
   Поддерживает тёмную и светлую темы (body.light-theme).
   Базовая обвязка .modal / .modal-d — из /css/modals.css.
   ========================================================================== */

/* Диалог шире стандартного: 520px + скролл */
.geo-modal__dialog {
    max-width: 520px;
    padding: 28px 24px 24px;
}

.geo-modal__title {
    text-align: left !important;
    font-size: 24px !important;
    margin-bottom: 18px !important;
    font-weight: 800;
    letter-spacing: -0.01em;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    color: var(--text-primary, #fff);
}

.geo-modal__close {
    top: 16px;
    right: 16px;
}

/* ---------- Поле поиска ---------- */
.geo-modal__search {
    position: relative;
    margin-bottom: 12px;
}

.geo-modal__input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(0, 243, 255, 0.10);
    border-radius: 12px;
    color: var(--text-primary, #fff);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.geo-modal__input:focus {
    border-color: rgba(0, 243, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.geo-modal__input::placeholder {
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.geo-modal__clear {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 0;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
}

.geo-modal__clear:hover {
    background: rgba(255, 0, 255, 0.08);
    color: var(--neon-pink, #f0f);
}

/* ---------- Дропдаун ---------- */
.geo-modal__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-secondary, #1c1c2e);
    border: 1px solid rgba(0, 243, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    z-index: 20;
    padding: 6px;
}

.geo-modal__item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary, #fff);
    transition: background .15s, color .15s;
    user-select: none;
}

.geo-modal__item:hover,
.geo-modal__item.is-active {
    background: rgba(0, 243, 255, 0.10);
    color: var(--neon-cyan, #0ff);
}

.geo-modal__loading,
.geo-modal__empty,
.geo-modal__error {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted, rgba(255,255,255,0.5));
}

.geo-modal__error { color: #ff6b6b; }

/* ---------- Чекбокс ---------- */
.geo-modal__check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 18px;
    font-size: 14px;
    color: var(--text-secondary, #ddd);
    cursor: pointer;
    user-select: none;
}

.geo-modal__check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(0, 243, 255, 0.30);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: border-color .2s, background .2s;
}

.geo-modal__check input[type="checkbox"]:hover {
    border-color: rgba(0, 243, 255, 0.55);
}

.geo-modal__check input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #6C63FF, #bf00ff);
    border-color: transparent;
}

/* ==== GEO-CHECKBOX-FIX 2026-10-08: галочка и бордер в обеих темах ==== */

/* Тёмная тема (по умолчанию): светлая галочка, видимый голубой бордер */
.geo-modal__check input[type="checkbox"] {
    border-color: rgba(0, 243, 255, 0.45);
    background: rgba(255, 255, 255, 0.06);
}
.geo-modal__check input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #6C63FF, #bf00ff);
    border-color: transparent;
}
.geo-modal__check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Светлая тема: чёрная галочка, заметный бордер, непрозрачный белый фон */
body.light-theme .geo-modal__check input[type="checkbox"] {
    background: #ffffff;
    border-color: rgba(17, 24, 39, 0.45);
}
body.light-theme .geo-modal__check input[type="checkbox"]:hover {
    border-color: rgba(17, 24, 39, 0.7);
}
body.light-theme .geo-modal__check input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #6C63FF, #bf00ff);
    border-color: transparent;
}
body.light-theme .geo-modal__check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #111111;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ---------- Табы ---------- */
.geo-modal__tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
    padding-bottom: 0;
}

.geo-modal__tab {
    background: transparent;
    border: 0;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    position: relative;
    transition: color .2s;
    margin-bottom: -1px;
}

.geo-modal__tab:hover {
    color: var(--text-primary, #fff);
}

.geo-modal__tab.is-active {
    color: var(--text-primary, #fff);
}

.geo-modal__tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: linear-gradient(90deg, #6C63FF, #bf00ff);
    border-radius: 3px 3px 0 0;
}

/* ---------- Панели ---------- */
.geo-modal__panel {
    display: none;
    animation: geoFadeIn .2s ease;
}

.geo-modal__panel.is-active {
    display: block;
}

@keyframes geoFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.geo-modal__hint {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-muted, rgba(255,255,255,0.5));
    line-height: 1.4;
}

/* ---------- Кнопки ---------- */
.geo-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.geo-modal__btn-reset,
.geo-modal__btn-apply {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid transparent;
    transition: filter .15s, background .15s, color .15s;
}

.geo-modal__btn-reset {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text-secondary, #ccc);
}

.geo-modal__btn-reset:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #fff);
}

.geo-modal__btn-apply {
    background: linear-gradient(135deg, #6C63FF, #bf00ff);
    color: #fff;
    border: 0;
}

.geo-modal__btn-apply:hover {
    filter: brightness(1.1);
}

/* ==========================================================================
   Светлая тема
   ========================================================================== */
body.light-theme .geo-modal__title {
    color: #111827;
}

body.light-theme .geo-modal__input {
    background: #ffffff;
    border-color: rgba(17, 24, 39, 0.14);
    color: #111827;
}

body.light-theme .geo-modal__input:focus {
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

body.light-theme .geo-modal__dropdown {
    background: #ffffff;
    border-color: rgba(17, 24, 39, 0.10);
    box-shadow: 0 20px 40px rgba(55, 45, 105, 0.18);
}

body.light-theme .geo-modal__item {
    color: #111827;
}

body.light-theme .geo-modal__item:hover,
body.light-theme .geo-modal__item.is-active {
    background: rgba(124, 58, 237, 0.10);
    color: #5b21b6;
}

body.light-theme .geo-modal__check {
    color: #374151;
}

body.light-theme .geo-modal__tabs {
    border-bottom-color: rgba(17, 24, 39, 0.10);
}

body.light-theme .geo-modal__tab {
    color: #6b7280;
}

body.light-theme .geo-modal__tab.is-active {
    color: #111827;
}

body.light-theme .geo-modal__hint {
    color: #6b7280;
}

body.light-theme .geo-modal__actions {
    border-top-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .geo-modal__btn-reset {
    border-color: rgba(17, 24, 39, 0.18);
    color: #374151;
}

body.light-theme .geo-modal__btn-reset:hover {
    background: rgba(17, 24, 39, 0.04);
    color: #111827;
}

/* ==========================================================================
   Адаптив
   ========================================================================== */
@media (max-width: 600px) {
    .geo-modal__dialog {
        max-width: 100%;
        padding: 24px 18px 20px;
    }
    .geo-modal__title {
        font-size: 20px !important;
    }
    .geo-modal__actions {
        flex-direction: column-reverse;
    }
    .geo-modal__btn-reset,
    .geo-modal__btn-apply {
        width: 100%;
    }
}

/* ==========================================================================
   GEO-MODAL-SCROLL 2026-10-08
   Диалог тянется по контенту, но не выходит за экран.
   Если контент больше — внутренний скролл у диалога.
   ========================================================================== */
.geo-modal .geo-modal__dialog {
    /* Перебиваем max-height: 85vh из modals.css */
    max-height: calc(100vh - 32px) !important;
    max-height: calc(100dvh - 32px) !important; /* мобильные браузеры с адресной строкой */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* Плавный скролл на iOS */
    -webkit-overflow-scrolling: touch;
    /* Не даём контенту «упираться» в скруглённые углы */
    box-sizing: border-box;
}

/* На узких экранах даём больше места */
@media (max-width: 600px) {
    .geo-modal .geo-modal__dialog {
        max-height: calc(100vh - 24px) !important;
        max-height: calc(100dvh - 24px) !important;
    }
}

/* Тонкий скроллбар в тёмной теме, чтобы не портил вид */
.geo-modal .geo-modal__dialog::-webkit-scrollbar {
    width: 8px;
}
.geo-modal .geo-modal__dialog::-webkit-scrollbar-track {
    background: transparent;
}
.geo-modal .geo-modal__dialog::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.geo-modal .geo-modal__dialog::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}
body.light-theme .geo-modal .geo-modal__dialog::-webkit-scrollbar-thumb {
    background: rgba(17, 24, 39, 0.18);
}
body.light-theme .geo-modal .geo-modal__dialog::-webkit-scrollbar-thumb:hover {
    background: rgba(17, 24, 39, 0.30);
}

/* ==========================================================================
   GEO-MODAL-DROPDOWN-STATIC 2026-10-08
   Дропдаун — в потоке, чтобы диалог мог растягиваться под него.
   При длинном списке растягивается до 60vh, дальше — скролл внутри.
   ========================================================================== */
.geo-modal .geo-modal__search {
    /* Держим поле как обычный блочный родитель — не absolute-якорь */
    position: relative;
}

.geo-modal .geo-modal__dropdown {
    /* Убираем абсолютное позиционирование (перебиваем раннее правило) */
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    /* Отступ сверху чтобы визуально не слипалось с инпутом */
    margin-top: 6px;
    /* Раньше было 260px — даём больше, но не больше половины экрана */
    max-height: min(60vh, 420px);
    overflow-y: auto;
    /* Скругление и границы уже заданы выше — оставляем */
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

/* Тонкий скроллбар внутри выпадашки */
.geo-modal .geo-modal__dropdown::-webkit-scrollbar { width: 8px; }
.geo-modal .geo-modal__dropdown::-webkit-scrollbar-track { background: transparent; }
.geo-modal .geo-modal__dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
body.light-theme .geo-modal .geo-modal__dropdown::-webkit-scrollbar-thumb {
    background: rgba(17, 24, 39, 0.18);
}

/* ==========================================================================
   GEO-MODAL-FIELD-WRAP 2026-10-08
   Обёртка для input + кнопка очистки.
   Держит крестик привязанным к полю, даже когда появляется дропдаун.
   ========================================================================== */
.geo-modal .geo-modal__field {
    position: relative;
    display: block;
}

/* Крестик теперь позиционируется относительно .geo-modal__field — то есть по центру инпута */
.geo-modal .geo-modal__field .geo-modal__clear {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

/* Сам .geo-modal__search остаётся вертикальным контейнером (инпут + дропдаун) */
.geo-modal .geo-modal__search {
    position: relative; /* не absolute — дропдаун лежит в потоке ниже */
}

/* ==========================================================================
   GEO-MODAL-BUTTONS 2026-10-08
   Кнопки в футере модалки «Город или регион».
   - Белый текст в тёмной теме (перебиваем возможные конфликты от .neon-btn)
   - Полностью скруглённые углы (pill)
   ========================================================================== */
.geo-modal .geo-modal__actions .neon-btn,
.geo-modal .geo-modal__btn-reset,
.geo-modal .geo-modal__btn-apply {
    border-radius: 999px !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    padding: 11px 22px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    /* Если .neon-btn унаследовал градиентный фон — оставляем его как есть, текст всё равно белый */
}

/* Кнопка «Показать объявления» — градиент, белый текст */
.geo-modal .geo-modal__btn-apply {
    background: linear-gradient(135deg, #6C63FF, #bf00ff) !important;
    background-image: linear-gradient(135deg, #6C63FF, #bf00ff) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border: 0 !important;
}

.geo-modal .geo-modal__btn-apply:hover {
    filter: brightness(1.1);
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Кнопка «Сбросить» — прозрачная с бордером, белый текст в тёмной теме */
.geo-modal .geo-modal__btn-reset {
    background: transparent !important;
    background-image: none !important;
    border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.geo-modal .geo-modal__btn-reset:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Светлая тема — «Сбросить» с тёмным текстом (на белом фоне) */
body.light-theme .geo-modal .geo-modal__btn-reset {
    background: transparent !important;
    background-image: none !important;
    border: 1.5px solid rgba(17, 24, 39, 0.35) !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
}
body.light-theme .geo-modal .geo-modal__btn-reset:hover {
    background: rgba(17, 24, 39, 0.05) !important;
    border-color: rgba(17, 24, 39, 0.6) !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
}

/* Светлая тема — «Показать» оставляем с градиентом и белым текстом */
body.light-theme .geo-modal .geo-modal__btn-apply {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* На узких экранах pill-скругление сохраняем */
@media (max-width: 600px) {
    .geo-modal .geo-modal__btn-reset,
    .geo-modal .geo-modal__btn-apply {
        border-radius: 999px !important;
    }
}

/* ==========================================================================
   GEO-MODAL-CLEAR-ICON 2026-10-08
   Крестик очистки поля и иконка закрытия модалки — читаемые в обеих темах.
   Перебиваем унаследованный var(--text-secondary) через !important.
   ========================================================================== */

/* Крестик очистки — тёмная тема: белый, при наведении — слегка серый (GEO-HOVER-SWAP 2026-10-08) */
.geo-modal .geo-modal__clear {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}
.geo-modal .geo-modal__clear:hover {
    color: rgba(255, 255, 255, 0.55) !important;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.55) !important;
}
.geo-modal .geo-modal__clear .icon,
.geo-modal .geo-modal__clear svg,
.geo-modal .geo-modal__clear svg use {
    fill: currentColor !important;
    color: inherit !important;
    stroke: currentColor !important;
}

/* Крестик закрытия модалки — тёмная тема: белый, при наведении — слегка серый (GEO-HOVER-SWAP 2026-10-08) */
.geo-modal .geo-modal__close {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}
.geo-modal .geo-modal__close:hover {
    color: rgba(255, 255, 255, 0.55) !important;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.55) !important;
}
.geo-modal .geo-modal__close .icon,
.geo-modal .geo-modal__close svg,
.geo-modal .geo-modal__close svg use {
    fill: currentColor !important;
    color: inherit !important;
    stroke: currentColor !important;
}

/* ---------- Светлая тема: крестики — тёмные ---------- */
body.light-theme .geo-modal .geo-modal__clear {
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
}
body.light-theme .geo-modal .geo-modal__clear:hover {
    color: var(--neon-pink, #f0f) !important;
    -webkit-text-fill-color: var(--neon-pink, #f0f) !important;
}
body.light-theme .geo-modal .geo-modal__close {
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
}
body.light-theme .geo-modal .geo-modal__close:hover {
    color: var(--neon-pink, #f0f) !important;
    -webkit-text-fill-color: var(--neon-pink, #f0f) !important;
}

/* ==========================================================================
   GEO-APPLY-BTN-THEME 2026-10-08
   Кнопка «Показать объявления» (#geoApplyBtn / .geo-modal__btn-apply):
     - Светлая тема: белый фон, тёмный текст, при hover текст тоже тёмный
     - Тёмная тема:  градиентный фон, светлый текст, при hover тоже светлый
   Перебивает все предыдущие правила .neon-btn и .neon-solid.
   ========================================================================== */

/* ---------- СВЕТЛАЯ ТЕМА ---------- */
body.light-theme .geo-modal #geoApplyBtn,
body.light-theme .geo-modal .geo-modal__btn-apply,
body.light-theme .geo-modal .geo-modal__actions .neon-btn.neon-solid {
    background: #ffffff !important;
    background-image: none !important;
    background-color: #ffffff !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
    border: 1.5px solid rgba(17, 24, 39, 0.28) !important;
    box-shadow: 0 2px 6px rgba(17, 24, 39, 0.06) !important;
    text-shadow: none !important;
}
body.light-theme .geo-modal #geoApplyBtn:hover,
body.light-theme .geo-modal #geoApplyBtn:focus,
body.light-theme .geo-modal .geo-modal__btn-apply:hover,
body.light-theme .geo-modal .geo-modal__btn-apply:focus,
body.light-theme .geo-modal .geo-modal__actions .neon-btn.neon-solid:hover {
    background: #f3f4f6 !important;
    background-image: none !important;
    background-color: #f3f4f6 !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
    border-color: rgba(17, 24, 39, 0.45) !important;
    box-shadow: 0 4px 10px rgba(17, 24, 39, 0.10) !important;
}
body.light-theme .geo-modal #geoApplyBtn svg,
body.light-theme .geo-modal #geoApplyBtn .icon,
body.light-theme .geo-modal .geo-modal__btn-apply svg,
body.light-theme .geo-modal .geo-modal__btn-apply .icon {
    color: #111827 !important;
    fill: #111827 !important;
    stroke: #111827 !important;
}

/* ---------- ТЁМНАЯ ТЕМА ---------- */
body:not(.light-theme) .geo-modal #geoApplyBtn,
body:not(.light-theme) .geo-modal .geo-modal__btn-apply,
body:not(.light-theme) .geo-modal .geo-modal__actions .neon-btn.neon-solid {
    background: linear-gradient(135deg, #6C63FF, #bf00ff) !important;
    background-image: linear-gradient(135deg, #6C63FF, #bf00ff) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border: 0 !important;
    box-shadow: 0 4px 14px rgba(108, 99, 255, 0.35) !important;
    text-shadow: none !important;
}
body:not(.light-theme) .geo-modal #geoApplyBtn:hover,
body:not(.light-theme) .geo-modal #geoApplyBtn:focus,
body:not(.light-theme) .geo-modal .geo-modal__btn-apply:hover,
body:not(.light-theme) .geo-modal .geo-modal__btn-apply:focus,
body:not(.light-theme) .geo-modal .geo-modal__actions .neon-btn.neon-solid:hover {
    background: linear-gradient(135deg, #7a72ff, #cc1aff) !important;
    background-image: linear-gradient(135deg, #7a72ff, #cc1aff) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.55) !important;
}
body:not(.light-theme) .geo-modal #geoApplyBtn svg,
body:not(.light-theme) .geo-modal #geoApplyBtn .icon,
body:not(.light-theme) .geo-modal .geo-modal__btn-apply svg,
body:not(.light-theme) .geo-modal .geo-modal__btn-apply .icon {
    color: #ffffff !important;
    fill: #ffffff !important;
    stroke: #ffffff !important;
}