/* --- ОСНОВНЫЕ НАСТРОЙКИ --- */
body {
    background-color: #F9F9F9;
    overflow-y: auto;
    height: auto;
    display: block;
}

.navbar{
    width: 94.8% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.single-property-page {
    /* Точно такая же ширина, как у хедера и футера */
    width: 94.8%; 
    
    /* УБИРАЕМ ОГРАНИЧЕНИЕ (было 1400px), чтобы контент растянулся */
    max-width: none; 
    
    margin: 0 auto;
    padding-top: 100px; 
}

/* --- CSS GRID LAYOUT (МАГИЯ МАКЕТА) --- */
.property-grid {
    display: grid;
    /* Три колонки: миниатюры, фото, инфо */
    grid-template-columns: 175px 1fr 565px;
    
    /* Строки: авто (статус), остаток (инфо), авто (описание) */
    grid-template-rows: auto 1fr auto;
    
    /* РАССТАНОВКА ДЛЯ ПК */
    grid-template-areas:
        "thumbs main status"   /* Статус справа сверху */
        "thumbs main info"     /* Инфо под статусом */
        "desc   desc contact"; /* Низ страницы */
    
    gap: 10px 25px; 
    margin-bottom: 60px;
}

.grid-area-status {
    grid-area: status;
    padding-left: 5px; /* Чтобы было ровно с заголовком */
    display: flex;
    align-items: flex-end; /* Прижимаем к низу ячейки (ближе к заголовку) */
    gap: 8px;
}

/* --- 1. МИНИАТЮРЫ (Слева) --- */
.grid-area-thumbs {
    grid-area: thumbs;
    /* Убедимся, что колонка имеет высоту, равную главному фото */
    height: 525px;
    overflow: hidden;
}

.thumbs-stack {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* ВАЖНО: Картинки идут сверху вниз, а не растягиваются */
    height: 100%;
    gap: 12px; /* Отступ между картинками */
    
    /* Включаем вертикальный скролл */
    overflow-y: auto; 
    overflow-x: hidden;
    
    /* Добавляем немного отступа справа для скроллбара */
    padding-right: 5px; 
    
    /* Для плавной прокрутки на iOS */
    -webkit-overflow-scrolling: touch; 
}

.thumbs-stack::-webkit-scrollbar {
    width: 4px;
}
.thumbs-stack::-webkit-scrollbar-track {
    background: transparent;
}
.thumbs-stack::-webkit-scrollbar-thumb {
    background-color: #D5CFC9; /* Цвет ползунка под твой дизайн */
    border-radius: 4px;
}
.thumbs-stack::-webkit-scrollbar-thumb:hover {
    background-color: var(--orange);
}

.v-thumb {
    width: 100%;
    height: 110px; 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    cursor: pointer;
    
    transition: border-color 0.2s, opacity 0.2s; 
    border: 2px solid transparent;
    opacity: 0.6;
    
    /* САМОЕ ВАЖНОЕ: Запрещаем картинке сжиматься, чтобы скролл работал */
    flex-shrink: 0; 
}

.v-thumb:hover {
    opacity: 0.8;
}

@keyframes softFade {
    /* Ставим 0.4, чтобы картинка сильнее "притухала" перед сменой */
    0% { opacity: 0.4; } 
    100% { opacity: 1; }
}

/* Активная миниатюра (которая сейчас на главном экране) */
.v-thumb.active {
    border-color: var(--orange);
    opacity: 1; /* Выбранная - полностью видимая */
}

/* Кнопка "Еще фото" (внизу стопки) */
.more-photos-btn {
    width: 100%;
    height: 40px; 
    background-color: #EEE8E3;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brown);
    cursor: pointer;
    transition: 0.2s;
    
    /* Тоже запрещаем сжиматься */
    flex-shrink: 0; 
    min-height: 40px;
}

.more-photos-btn:hover {
    background-color: #e0dcd6;
}

.more-photos-btn i {
    font-size: 14px;
}


/* --- 2. ГЛАВНОЕ ФОТО (Центр) --- */
.grid-area-main {
    grid-area: main;
}

.main-image-container {
    width: 100%;
    height: 525px; /* Фиксированная высота главного фото */
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}

.main-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    /* Убрали transition: background-image... так как он не работает плавно */
}

.main-image.fade-active {
    /* Увеличили время с 0.3s до 0.5s для большей плавности */
    animation: softFade 0.3s ease-in-out; 
}

/* Стрелки навигации */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--brown);
    transition: 0.2s;
}

.nav-arrow:hover { background-color: rgba(255, 255, 255, 0.8); }
.nav-arrow.prev { left: 15px; }
.nav-arrow.next { right: 15px; }


/* --- 3. ИНФОРМАЦИЯ (Справа сверху - БЕЗ ФОНА) --- */
.grid-area-info {
    grid-area: info;
    padding: 0 0 0 10px; 
}

.status-tag {
    display: inline-block;
    background-color: #EEE8E3;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: #666;
}

.active-business-tag {
    background-color: #FF931C !important;
    color: #fff !important;
    font-weight: 600;
}

.prop-title {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: var(--brown);
    margin-bottom: 25px;
    line-height: 1.2;
}

/* --- МИНИ-ИНФОРМАЦИЯ (Площадь и Локация под заголовком) --- */
.prop-mini-info {
    margin-bottom: 30px; /* Отступ до цены */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Расстояние между строкой площади и адресом */
}

.mini-info-row {
    display: flex;
    align-items: center;
    gap: 12px; /* Расстояние от иконки до текста */
    font-size: 17px;
    color: #4A4A4A; /* Темно-серый/коричневатый цвет текста */
    line-height: 1.2;
}

.mini-info-row i {
    color: #8D7B70; /* Цвет иконок (чуть светлее текста, как на макете) */
    font-size: 16px;
    width: 16px; /* Фиксированная ширина для выравнивания, если иконки разные */
    text-align: center;
}

/* Корректируем отступы у соседних элементов */
.prop-price {
    margin-top: 10px; /* Уменьшаем отступ сверху, так как там теперь инфо */
    margin-bottom: 25px;
}

.prop-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--orange);
    margin-bottom: 25px;
    margin-top: 12px;
}

.specs-list {
    list-style: none;
    padding: 0;
    margin-top: 20px; /* Отступ от цены */
}

.specs-title {
    display: none;
}

.specs-wrapper {
    margin-top: 20px;
    background: transparent;
    padding: 0;
}

.specs-list li {
    font-size: 15px;
    margin-bottom: 12px; /* Чуть больше отступ между строками */
    color: #333;
    display: flex;
    align-items: baseline; /* Выравнивание по базовой линии текста */
}

.specs-list li span:first-child {
    color: #999; /* Серый цвет для названия характеристики */
    width: 160px; /* Фиксированная ширина левой колонки */
    flex-shrink: 0;
    font-weight: 400;
}


/* --- 4. ОПИСАНИЕ (Снизу слева - БЕЖЕВЫЙ ФОН) --- */
.grid-area-desc {
    grid-area: desc;
    background-color: #EEE8E3;
    border-radius: 16px;
    padding: 30px;
    /* Растягиваем на всю высоту ряда */
    height: 100%; 
}

.grid-area-desc h3 {
    font-size: 24px;
    color: var(--brown);
    margin-bottom: 15px;
}

.desc-content {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    white-space: pre-line;
    
    /* ДОБАВИТЬ ЭТУ СТРОЧКУ: */
    max-width: 900px; /* Ограничиваем ширину текста, чтобы он не был слишком длинным */
}


/* --- 5. КОНТАКТЫ (Снизу справа - БЕЖЕВЫЙ ФОН) --- */
.grid-area-contact {
    grid-area: contact;
    background-color: #EEE8E3;
    border-radius: 16px;
    padding: 30px;
    height: fit-content;
    align-self: start;
}

.grid-area-contact h3 {
    color: var(--orange);
    font-size: 18px;
    margin-bottom: 20px;
}

.contact-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.contact-row img {
    width: 22px;
    margin-top: 6px;
    border-radius: 2px;
}

.contact-details {
    display: flex;
    flex-direction: column;
}

.phone {
    font-weight: 700;
    font-size: 16px;
    color: var(--brown);
    text-decoration: underline;
    margin-bottom: 2px;
}

.sub {
    font-size: 13px;
    color: #888;
}

.email-block {
    margin-top: 10px;
}

.email-link {
    font-weight: 700;
    color: var(--brown);
    text-decoration: underline;
    display: block;
    margin-bottom: 2px;
}

/* --- ПОХОЖИЕ ОБЪЕКТЫ --- */
.similar-objects-section {
    padding-bottom: 60px;
}

.similar-objects-section h2 {
    font-size: 20px;
    color: var(--brown);
    margin-bottom: 20px;
    font-weight: 700;
}

.similar-grid {
    display: flex;
    gap: 20px;
}

.stub-card {
    width: calc(33.33% - 14px);
    height: 300px;
    background-color: #EEE8E3;
    border-radius: 16px;
}

/* Стилизация иконки почты */
.email-icon i {
    font-size: 22px;       /* Размер иконки */
    color: #5E4A3C;        /* Коричневый цвет (как у текста) */
    margin-top: 2px;       /* Небольшая коррекция по высоте */
    display: block;
}

/* Убираем лишние отступы у ссылки, если они есть */
.email-link {
    font-size: 16px;
    font-weight: 700;
    color: #5E4A3C;
    text-decoration: underline;
    line-height: 1.2;
}

.main-info-wrapper {
    display: contents; /* Игнорируем обертку на ПК, чтобы сетка работала как раньше */
}

.mobile-dots-container {
    display: none;
}


.lightbox {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    z-index: 20000; /* Самый верхний слой */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Темный фон */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Кнопка закрытия */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 20001;
}

.lightbox-close:hover {
    color: var(--orange);
}

/* Стрелки внутри лайтбокса */
.lightbox .lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    font-size: 20px;
    transition: 0.3s;
    z-index: 20001;
}

.lightbox .lightbox-arrow:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.lightbox .prev { left: 20px; }
.lightbox .next { right: 20px; }


footer {
    width: 94.8%;           /* Ширина как у Navbar и App Container */
    
    margin-top: 15px;
    margin-bottom: 15px;
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 0;
    z-index: 10;
}

/* Видеоплеер в главном окне */
.main-video-player {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Заполняет блок, как картинка */
    border-radius: 16px;
    background-color: #000;
}

/* Миниатюра видео (в списке слева) */
.video-thumb {
    /* Убираем сплошной серый фон, теперь там будет картинка */
    /* background-color: #333; <--- УДАЛЕНО */
    position: relative;
    overflow: hidden; /* Чтобы оверлей не вылезал */
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Затемнение */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.video-thumb:hover .video-overlay {
    background-color: rgba(0, 0, 0, 0.2); /* При наведении чуть светлее */
}

.video-thumb i {
    font-size: 24px; /* Чуть аккуратнее размер */
    color: white;
    opacity: 1; /* Полная яркость */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); /* Тень для контраста */
}

/* Видео внутри Лайтбокса (на весь экран) */
.lightbox-video {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    outline: none;
}

@keyframes fadeIn {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 1100px) {
    .property-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "main main"
            "thumbs info"
            "desc desc"
            "contact contact";
    }
    
    .thumbs-stack {
        flex-direction: row; /* Горизонтальные миниатюры на планшете */
        overflow-x: auto;
    }
    .v-thumb {
        width: 100px;
        height: 80px;
        flex-shrink: 0;
    }
}

@media (max-width: 1024px) {

    html, body {
        width: 100%;
        overflow-x: hidden !important; /* Обрезаем всё, что торчит сбоку */
        position: relative;
    }

    .main-image-container {
        height: 250px !important; /* Уменьшаем высоту главного фото на мобильном */
        margin-bottom: 0 !important;
    }

    .property-grid {
        grid-template-columns: 1fr;
        gap: 8px !important; 
        grid-template-rows: auto;
        
        /* МЕНЯЕМ ПОРЯДОК ЗДЕСЬ */
        grid-template-areas:
            "status"
            "main"
            "thumbs"
            "info"
            "desc"     /* 5. Сначала Описание */
            "contact"; /* 6. Потом Контакты */
            
        margin-bottom: 30px !important;
    }

    .grid-area-status {
        padding-left: 0 !important;
        margin-bottom: 5px !important;
        justify-content: flex-start;
    }

    .grid-area-thumbs {
        height: auto !important; /* Сбрасываем фиксированную высоту 500px */
        margin-top: -5px !important; /* Чуть подтягиваем вверх */
        margin-bottom: 10px !important;
    }

    .grid-area-info {
        padding: 0 !important;
    }

    .main-image-container {
        height: 300px;
    }
    
    .similar-grid {
        flex-direction: column;
    }
    .stub-card {
        width: 100%;
    }

    .navbar {
        top: 12px !important;
        width: 93.8% !important;
        height: 50px !important;
        padding: 0 20px !important;
        border-radius: 16px !important;
        background-color: #5E4A3C !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    }

    .navbar.scrolled {
        top: 12px !important;
        width: 93.8% !important;
        height: 50px !important;
        padding: 0 20px !important;
    }

    .mobile.menu {
        top: 50px;
        left: 0;
        background-color: #5E4A3C !important;
        border: none;
        backdrop-filter: none;
    }

    .lang-dropdown {
        background-color: rgba(94, 74, 60, 0.95) !important;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        top: 37px;
        right: -20px;
    }

    .navbar .logo {
        top: 12%;
    }


    .navbar .logo img {
        height: 36px;
    }

    .navbar .lang-dropdown {
        background-color: rgba(94, 74, 60, 0.95) !important;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        
        /* ИЗМЕНЕНИЯ ЗДЕСЬ */
        top: 37px;        /* Подняли выше (было 42px) */
        right: -20px;     /* Сдвинули левее (было -30px или авто) */
        
        /* Опционально: можно сделать меню чуть уже, если оно слишком широкое */
        width: 160px; 
    }

    .grid-area-desc {
        padding: 24px 20px;
    }

    .grid-area-desc h3{
        font-size: 20px;
    }

    .grid-area-contact{
        padding: 24px 20px;
    }


    .specs-wrapper {
        background-color: #EEE8E3; /* Бежевый фон */
        border-radius: 16px;       /* Скругленные углы */
        padding: 24px 20px;        /* Внутренние отступы */
        margin-top: 25px;
        width: 100%;
        box-sizing: border-box;    /* Чтобы padding не ломал ширину */
    }

    /* Показываем и стилизуем заголовок */
    .specs-title {
        display: block !important;
        font-family: var(--font-heading, sans-serif);
        font-size: 20px;
        font-weight: 700;
        color: #5E4A3C;            /* Коричневый цвет (как у заголовка Описание) */
        margin-top: 0;
        margin-bottom: 20px;       /* Отступ до списка */
    }

    /* Корректируем сам список внутри блока */
    .specs-wrapper .specs-list {
        margin-top: 0 !important;  /* Убираем лишний отступ сверху */
    }
    
    /* Корректируем элементы списка для мобильных */
    .specs-wrapper .specs-list li {
        display: flex !important;
        align-items: flex-start !important; /* Выравниваем по верху, если текст перенесется */
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        
        /* ВАЖНО: Разрешаем перенос текста, чтобы он не ломал ширину */
        white-space: normal !important; 
        
        font-size: 14px !important;
        margin-bottom: 10px !important;
        line-height: 1.4; /* Чуть больше воздуха для многострочного текста */
    }

    /* Делаем так, чтобы название (слева) и значение (справа) 
       выглядели аккуратно на узком экране */
    .specs-wrapper .specs-list li span:first-child {
        /* Было 130px, ставим 155px — этого хватит для длинных слов */
        width: 155px !important;
        min-width: 155px !important;       /* Жестко фиксируем ширину */
        
        flex-shrink: 0 !important;         /* Запрещаем сжиматься */
        white-space: nowrap !important;    /* Текст всегда в одну строку */
        margin-right: 10px !important;     /* Отступ от значения */
    }

    .main-info-wrapper {
        display: flex !important;       /* Включаем Flexbox */
        flex-direction: column;         /* Элементы друг под другом */
        
        background-color: #EEE8E3;      /* Бежевый фон */
        border-radius: 16px;            /* Скругление */
        padding: 20px;                  /* Внутренний отступ */
        margin-bottom: 15px;            /* Отступ до характеристик */
        width: 100%;
        box-sizing: border-box;
    }

    .main-info-wrapper .prop-price {
        order: 1; 
        margin-top: 0 !important;
        margin-bottom: 10px !important;
        font-size: 24px !important;     /* Чуть компактнее чем на ПК */
    }

    /* 2. Название (посередине) */
    .main-info-wrapper .prop-title {
        order: 2;
        margin-bottom: 15px !important;
        font-size: 18px !important;     /* Размер как на макете */
        color: #5E4A3C;                 /* Темно-коричневый */
    }

    /* 3. Квадратура и локация (снизу) */
    .main-info-wrapper .prop-mini-info {
        order: 3;
        margin-bottom: 0 !important;    /* Убираем нижний отступ */
        gap: 8px !important;            /* Расстояние между строчками */
    }
    
    /* Стили для иконок и текста внутри мини-инфо */
    .main-info-wrapper .mini-info-row {
        font-size: 14px !important;
        color: #4A4A4A;
    }
    
    .main-info-wrapper .mini-info-row i {
        font-size: 12px !important;
        width: 20px;
        text-align: center;
    }

    .nav-arrow, 
    .grid-area-thumbs {
        display: none !important;
    }

    /* Настраиваем контейнер для свайпа */
    .main-image-container {
        width: 100%;
        height: 250px !important;
        position: relative;
        touch-action: pan-y;
        
        /* ВАЖНО: Разрешаем точкам быть СНАРУЖИ контейнера */
        overflow: visible !important; 
        
        /* Добавляем отступ снизу, чтобы точки не налезли на текст "Продажа" */
        margin-bottom: 30px !important;
    }

    /* Само фото (поддержка свайпов через JS) */
    .main-image {
        border-radius: 16px;
        /* Остальные стили те же */
        width: 100%;
        height: 100%;
        background-size: cover;
        background-position: center;
        transition: transform 0.3s ease;
    }

    /* Контейнер для точек (внизу фото) */
    .mobile-dots-container {
        display: flex;
        justify-content: center;
        gap: 8px;
        position: absolute;
        
        /* Спускаем точки ПОД фотографию */
        bottom: -20px !important; 
        left: 50%;
        transform: translateX(-50%);
        z-index: 10;
        
        /* Убираем темный фон, так как они теперь на белом */
        background: transparent !important;
        padding: 0;
    }

    /* Сами точки */
    .dot {
        width: 8px;
        height: 8px;
        background-color: #D9D9D9 !important; /* Светло-серый цвет */
        border-radius: 50%;
        transition: all 0.3s;
    }

    /* Активная точка */
    .dot.active {
        background-color: var(--orange) !important; /* Оранжевый цвет бренда */
        transform: scale(1.2);
    }



    .lightbox-close {
        top: 10px;
        right: 20px;
    }
    .lightbox .lightbox-arrow {
        width: 40px;
        height: 40px;
    }



    .grid-area-contact .phone,
    .grid-area-contact a[href^="tel"],
    .grid-area-contact span[data-link] {
        color: var(--brown) !important; /* Принудительно коричневый */
        text-decoration: underline !important;
        text-decoration-color: var(--brown) !important; /* Цвет подчеркивания */
        -webkit-text-fill-color: var(--brown) !important; /* Специально для Safari */
    }
}
