/*
 * ==============================================
 * СТИЛИ ДЛЯ СТРАНИЦЫ УЧАСТКА (plot.php)
 * ==============================================
 */

/* "Хлебные крошки" (навигация) */
.breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}
.breadcrumbs a {
    color: var(--color-primary);
    text-decoration: none;
}
.breadcrumbs a:hover {
    text-decoration: underline;
}

.plot-header-title {
    font-size: 2.25rem; /* 36px */
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 2rem;
    line-height: 1.2;
}

/* Сетка Галерея + Детали */
.plot-layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem; /* 40px */
    overflow: hidden; /* <<< ИСПРАВЛЕНИЕ: Предотвращает "выталкивание" контента */
}

/* Галерея */
.gallery-container {
    width: 100%;
    min-width: 0; /* Исправляет баг с переполнением в grid-контейнере (УЖЕ БЫЛО) */
}

.gallery-main-image {
    width: 100%;
    height: auto;
    border-radius: 0.75rem; /* 12px */
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    overflow: hidden;
    position: relative; /* Для позиционирования лоадера */
    min-height: 150px; /* Чтоб не коллапсировал */
    background-color: var(--color-border); /* Фон во время загрузки */
}
.gallery-main-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
}
.gallery-main-image:hover img {
    transform: scale(1.05);
}

/* Лоадер */
.gallery-main-image img.loading {
    opacity: 0;
}
.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--color-text-muted);
    z-index: 10;
    display: none; /* Скрыт по умолчанию */
    font-family: sans-serif; /* Для иконки ⌛ */
}
.image-loader.loading {
    display: block;
}

/* Заголовки в секциях (Галерея, Карта, Описание) */
.plot-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.gallery-thumbnails {
    margin-top: 1rem;
    display: flex;
    overflow-x: auto;
    padding-bottom: 0.5rem; /* Место для скроллбара */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;  
}

.thumbnail-item {
    border-radius: 0.5rem; /* 8px */
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s ease;
    flex: 0 0 90px; /* Фиксированная ширина 90px */
    margin-right: 0.75rem; /* 12px / замена gap */
    height: 70px;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-item:hover,
.thumbnail-item.active {
    border-color: var(--color-primary);
}

/* Лайтбокс (Модальное окно) */
.lightbox {
    display: none; /* Скрыт по умолчанию */
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.lightbox.visible {
    display: flex; /* Показать при активации */
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 9999px;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 1001;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-close {
    top: -1rem;
    right: -1rem;
}
@media (max-width: 767px) {
    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
    }
}


.lightbox-prev {
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}
.lightbox-next {
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Детали Участка (Описание, Статистика, Карта) */
.plot-description {
    line-height: 1.7;
    font-size: 1.125rem;
    color: var(--color-text-muted);
}
.plot-description p {
    margin-bottom: 1rem;
}

.stats-card {
    background-color: var(--color-card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem; /* 24px */
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.stats-card-title {
    font-size: 1.25rem; /* 20px */
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 1rem;
    gap: 1rem; /* Добавим gap на случай, если текст соприкоснется */
}
.stat-item + .stat-item {
    border-top: 1px solid var(--color-border);
}

.stat-item-label {
    font-weight: 500;
    color: var(--color-text-muted);
    flex-shrink: 0; /* Не дает метке сжиматься */
}

.stat-item-value {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-primary);
    text-align: right;
    word-break: break-all; /* <<< ИСПРАВЛЕНИЕ: Перенос длинных слов (статус, цифры) */
}

/* Статусы */
.stat-item-value.status-available {
    color: var(--color-primary); /* Зеленый (Teal) */
}

.stat-item-value.status-sold {
    color: var(--color-text-muted); /* Серый */
    text-decoration: line-through;
}

.stat-item-value.status-reserved {
    color: #f59e0b; /* Янтарный/Желтый (пример) */
}

.map-card {
     border-radius: 0.75rem;
     box-shadow: var(--shadow-lg);
     overflow: hidden;
     border: 1px solid var(--color-border);
}
.map-card img {
    width: 100%;
    height: auto;
}

/*
 * ==============================================
 * СТИЛИ КОНТАКТОВ (на странице участка)
 * ==============================================
 */
.contact-card-stacked {
    background-color: var(--color-card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.contact-card-stacked .contact-card-image {
    width: 80px;
    height: 80px;
    border-radius: 9999px;
    margin: 0;
    object-fit: cover;
    border: 3px solid var(--color-border);
    flex-shrink: 0;
}
.contact-card-stacked .contact-card-content {
    flex-grow: 1;
    min-width: 0; /* <<< ИСПРАВЛЕНИЕ: Позволяет этому блоку сжиматься (важно для flex) */
}
.contact-card-stacked .contact-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}
.contact-card-stacked .contact-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 0.5rem;
}
.contact-card-stacked .contact-links {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.contact-card-stacked .contact-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    font-size: 1rem;
    word-break: break-all; /* <<< ИСПРАВЛЕНИЕ: Перенос длинных email/телефонов */
}
.contact-card-stacked .contact-link:hover {
    color: var(--color-primary);
}
.contact-card-stacked .contact-link svg {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
    flex-shrink: 0; /* Иконка не должна сжиматься */
}
.contact-card-stacked .contact-link:hover svg {
    color: var(--color-primary);
}


/*
 * ==============================================
 * АДАПТИВНОСТЬ (Media Queries)
 * ==============================================
 */

/* Планшеты (md) */
@media (min-width: 768px) {
    .plot-header-title {
        font-size: 3rem; /* 48px */
    }
    
    .gallery-thumbnails {
        /* Отмена скролла на десктопе */
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        overflow-x: visible;
        padding-bottom: 0;
        gap: 1rem;
    }
    
    .thumbnail-item {
        flex: none; /* Сброс flex */
        margin-right: 0;
        height: 100px;
    }
}

/* Ноутбуки (lg) */
@media (min-width: 1024px) {
    .plot-layout-grid {
        /* Двух-колоночный макет: 60% галерея, 40% детали */
        grid-template-columns: 3fr 2fr;
    }
    .gallery-main-image img { 
        max-height: 600px;
    }
}