:root {
    --bg-dark: #0f172a;
    --bg-input: #1e293b;
    --accent-yellow: #facc15;
    --border-gray: #334155;
}

body {
    background-color: var(--bg-dark);
    color: white;
    font-family: 'Inter', sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
}

/* СИСТЕМА СТОРІНОК (SPA) */
.page {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow-y: auto; /* Дозволяємо внутрішній скрол */
    -webkit-overflow-scrolling: touch;
}

.page.active {
    display: flex !important;
}

/* Утиліта для примусового приховування */
.hidden {
    display: none !important;
}

/* СТОРІНКА ДЕТАЛЕЙ (OVERLAY) */
#details-page {
    position: fixed; /* Щоб була поверх всього */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background-color: var(--bg-dark);
}

/* СЛАЙДЕР ФОТО В ДЕТАЛЯХ */
#details-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    background-color: black;
    width: 100%;
    height: 100%;
}

/* Націлюємось на прямих нащадків (дистанція між слайдами) */
#details-slider > * {
    min-width: 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    flex-shrink: 0;
}

#details-slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#details-slider::-webkit-scrollbar {
    display: none;
}

/* ТВОЇ СТИЛІ ЕЛЕМЕНТІВ */
.custom-input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    outline: none;
    width: 100%;
    font-size: 14px;
}
.custom-input:focus { border-color: var(--accent-yellow); }

.chip {
    background-color: transparent;
    border: 1px solid var(--accent-yellow);
    color: white;
    padding: 10px 4px;
    border-radius: 10px;
    font-size: 13px;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}
.chip.selected { background-color: var(--accent-yellow); color: black; font-weight: 800; }

.checkbox-container { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.checkbox-box {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-gray);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
input:checked + .checkbox-box { background-color: var(--accent-yellow); border-color: var(--accent-yellow); }
.nav-btn.active { color: var(--accent-yellow); }

/* КАРТКА ОБ'ЄКТА (ТВІЙ ДИЗАЙН) */
.flat-card {
    background-color: var(--bg-input);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-gray);
    transition: transform 0.1s;
}
.flat-card:active { transform: scale(0.97); }

.flat-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background-color: #0f172a;
}

.flat-card-content { padding: 10px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }

.flat-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    height: 34px; /* Це якраз висота 2-х рядків */
    color: white;
    overflow: hidden;
    display: block;
    margin-bottom: 4px;
}

.flat-card-address { font-size: 11px; color: #94a3b8; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.flat-card-price { font-size: 15px; font-weight: 800; color: var(--accent-yellow); }

.flat-card-rooms { font-size: 10px; background: #334155; padding: 2px 6px; border-radius: 4px; width: fit-content; margin-bottom: 5px; }

/* СТИЛІ КАРТИ */
#map { background: #0f172a; }

.leaflet-popup-content-wrapper {
    background: #1e293b !important;
    color: white !important;
    border-radius: 12px !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid #334155;
}
.leaflet-popup-content { margin: 0 !important; width: 180px !important; }
.leaflet-popup-tip { background: #1e293b !important; }

.map-popup-img { width: 100%; height: 90px; object-fit: cover; }
.map-popup-info { padding: 8px; }
.map-popup-price { color: #facc15; font-weight: 800; font-size: 14px; margin-bottom: 2px; }
.map-popup-title { font-size: 11px; color: #cbd5e1; line-height: 1.2; height: 26px; overflow: hidden; }
.map-popup-btn {
    display: block; width: 100%; background: #facc15;
    color: black; text-align: center; padding: 6px;
    border-radius: 6px; margin-top: 8px; font-weight: 800;
    font-size: 10px; text-transform: uppercase; text-decoration: none;
}

/* Приховуємо скролбар для всього додатка (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    display: none;
}

/* Приховуємо скролбар для Firefox */
* {
    scrollbar-width: none;
}

/* Приховуємо скролбар для Internet Explorer та старого Edge */
* {
    -ms-overflow-style: none;
}

/* Додатково для контейнерів сторінок та слайдера */
.page, main, #details-page, #details-slider {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;     /* Firefox */
}

.page::-webkit-scrollbar,
main::-webkit-scrollbar,
#details-page::-webkit-scrollbar,
#details-slider::-webkit-scrollbar {
    display: none;             /* Chrome, Safari and Opera */
}

/* Анімація для плавного зникнення фото попереднього об'єкта */
#details-slider img {
    transition: opacity 0.3s ease-in-out;
}

/* Стан завантаження (спіннер) */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Плавна поява сторінки деталей */
#details-page.active {
    display: flex !important;
    animation: fadeIn 0.2s ease-out;
}

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

/* Ефект завантаження (Skeleton) */
.skeleton {
    background-color: #1e293b;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.03) 20%,
        rgba(255, 255, 255, 0.05) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* Плавна поява картинки */
.flat-card-img {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.flat-card-img.loaded {
    opacity: 1;
}

/* Контейнер для картинки, щоб він не схлопувався */
.img-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #1e293b;
    overflow: hidden;
}

/* Анімація Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.radar-container {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

/* Кола радара */
.radar-circle {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: var(--accent-yellow);
    border-radius: 50%;
    opacity: 0.2;
    animation: radar-pulse 3s infinite ease-out;
}

.radar-circle:nth-child(2) { animation-delay: 1s; }
.radar-circle:nth-child(3) { animation-delay: 2s; }

@keyframes radar-pulse {
    0% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(3); opacity: 0; }
}

/* Іконка будинку */
.house-float {
    z-index: 2;
    color: var(--accent-yellow);
    filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.4));
    animation: house-float 4s infinite ease-in-out;
}

@keyframes house-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.empty-title {
    font-size: 20px;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
    text-align: center;
}

.empty-subtitle {
    font-size: 14px;
    color: #94a3b8;
    text-align: center;
    max-width: 250px;
    line-height: 1.5;
}

/* Стиль як у "У вас ще немає запитів..." (Заголовок) */
.text-style-large {
    font-size: 20px !important;
    font-weight: 800 !important;
    text-transform: none !important; /* Прибирає Caps Lock */
    letter-spacing: normal !important; /* Прибирає розрідженість букв */
}

/* Стиль як у "Натисніть кнопку нижче..." (Підзаголовок) */
.text-style-small {
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: #94a3b8; /* Сірий колір як у підзаголовка */
}

/* Приховуємо іконку, коли чекбокс не вибраний */
.checkbox-box i,
.checkbox-box svg {
    display: none !important;
}

/* Показуємо лапку чорного кольору на жовтому фоні, коли вибрано */
#pets:checked + .checkbox-box {
    background-color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

#pets:checked + .checkbox-box i,
#pets:checked + .checkbox-box svg {
    display: block !important;
    color: black !important; /* Лапка буде чорною */
}

#eoselia:checked + .checkbox-box {
    background-color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

#eoselia:checked + .checkbox-box i,
#eoselia:checked + .checkbox-box svg {
    display: block !important;
    color: black !important;
}

/* Оновлена картка запиту без капслоку */
.request-card {
    background: linear-gradient(145deg, #1e293b, #161e2e);
    border-radius: 24px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(34, 197, 94, 0.1); /* Світло-зелений фон */
    color: #4ade80; /* Зелений текст */
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
}

.param-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.param-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.param-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    /* Жодного uppercase */
}

.param-value {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}

/* Контейнер для скролу районів */
.district-scroll-area {
    max-height: 45px; /* Висота приблизно на 2-3 рядки */
    overflow-y: auto;
    padding-right: 5px;
    scrollbar-width: none; /* Приховуємо стандартний скролбар */
    -ms-overflow-style: none;
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.district-scroll-area::-webkit-scrollbar {
    display: none;
}

.district-item-text {
    display: block;
    font-size: 13px;
    line-height: 1.2;
    margin-bottom: 2px;
    color: #f1f5f9;
}

/* Корекція для плитки Району, щоб вона виглядала збалансовано */
.param-item.district-box {
    justify-content: flex-start;
}

#results-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-dark);
    padding-top: 5px;   /* Зменш це значення, щоб підняти текст вище */
    padding-bottom: 15px;
}
/* СТИЛІ ДЛЯ КЛАСТЕРІВ НА КАРТІ */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background-color: rgba(250, 204, 21, 0.4) !important;
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
    background-color: rgba(250, 204, 21, 0.95) !important;
    color: black !important;
    font-weight: 900 !important;
    font-family: 'Inter', sans-serif;
    border: 1px solid #0f172a;
}
.metro-tooltip {
    background: #1e3a8a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.metro-tooltip::before {
    display: none;
}

@keyframes ping {
    75%, 100% { transform: scale(2); opacity: 0; }
}