/* Стили для списков карточек (новости, блог, категории) */

/* Секция списка */
.news-list {
    padding: 60px 0;
    background-color: var(--bg-light);
    min-height: 60vh;
}

.latest-news {
    background-color: var(--bg-light);
}

/* Сетка карточек */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Карточка новости/статьи */
.news-card {
    background-color: var(--bg-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin: 15px;
    padding: 30px;
    animation: fadeIn 0.6s ease-out both;
}

.news-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.news-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 150px;
    margin-bottom: 20px;
    border-radius: 12px;
}

.news-image img,
.news-image picture,
.news-image picture img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.news-card:hover .news-image img {
    transform: scale(1.1);
}

/* Стили для изображений в карточках услуг */
.news-card-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 150px;
    margin-bottom: 20px;
    border-radius: 12px;
}

.news-card-image picture,
.news-card-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.news-card:hover .news-card-image img {
    transform: scale(1.05);
}

/* Стили для изображений с классом card-image */
.card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    border-radius: 12px;
    transition: transform 0.5s ease;
}

.news-content {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Для карточек в слайдере - убеждаемся, что контент растягивается */
.news-slider-track .news-card .news-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Позволяет flex-элементам сжиматься */
}

.news-date {
    display: inline-block;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 15px;
    font-weight: 500;
}

.news-card h3 {
    font-size: 22px;
    margin-bottom: 25px;
    padding-bottom: 18px;
    line-height: 1.4;
    position: relative;
    border-bottom: 2px solid var(--border-color);
}

.news-card h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    border-radius: 1px;
}

.news-card h3 a {
    text-decoration: none;
    color: var(--text-dark);
    transition: color 0.3s;
    font-weight: 700;
}

.news-card h3 a:hover {
    color: var(--primary-color);
}

.news-content p,
.news-card p {
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 20px;
    margin-top: 15px;
    flex: 1;
}

/* Для карточек в слайдере - ограничиваем высоту текста */
.news-slider-track .news-card .news-content p {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Ограничиваем до 4 строк */
    line-clamp: 4; /* Стандартное свойство для совместимости */
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

/* Для news-card-summary в слайдере - ограничиваем высоту текста */
.news-slider-track .news-card .news-card-summary {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Ограничиваем до 4 строк */
    line-clamp: 4; /* Стандартное свойство для совместимости */
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

/* Стили для summary в карточках */
.news-card-summary {
    margin-top: 15px;
    margin-bottom: 20px;
    flex: 1;
    color: var(--text-light);
    line-height: 1.7;
}

/* Стили для заголовков внутри summary */
.news-card-summary h2,
.news-card-summary h3,
.news-card-summary h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 0;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    line-height: 1.4;
}

.news-card-summary h2::after,
.news-card-summary h3::after,
.news-card-summary h4::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    border-radius: 1px;
}

/* Стили для параграфов внутри summary */
.news-card-summary p {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--text-light);
}

.news-card time {
    display: block;
    margin-top: 5px;
    margin-bottom: 15px;
}

.news-card .btn-link {
    display: inline-block;
    font-weight: 600;
    margin-top: auto;
}

/* Стили для контента в section-description (страница недвижимости) */
.section-description img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
}

/* Большие изображения в ссылках (фото объектов недвижимости) */
.section-description a img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Стили для изображений в ссылках внутри таблиц (страница documents) - переопределяет общее правило */
.section-description table a img,
.section-description table td a img {
    max-width: 50px !important;
    max-height: 50px !important;
    width: auto !important;
    height: auto !important;
    display: inline-block !important;
    vertical-align: middle;
    margin: 0 5px !important;
    border-radius: 4px;
    box-shadow: none;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.section-description table a:hover img {
    transform: scale(1.05);
}

.section-description a:hover img {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Разделители между объявлениями недвижимости */
.section-description > p:not(:first-child) {
    position: relative;
    padding-top: 50px;
    margin-top: 50px;
    border-top: 2px solid var(--border-color);
}

.section-description > p:not(:first-child)::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
}

/* Убираем верхний отступ у изображения после разделителя */
.section-description > p:not(:first-child) a img {
    margin-top: 0;
}

/* Первое изображение на странице */
.section-description > p:first-child a img {
    margin-top: 20px;
}

/* Отступы для заголовков внутри объявления */
.section-description h1,
.section-description h3 {
    margin-top: 20px;
}

/* Маленькие иконки-маркеры (только конкретные) */
.section-description img[src*="24-247373"] {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    display: inline-block !important;
    vertical-align: middle;
    margin: 0 4px !important;
    object-fit: contain;
}

/* Стили для заголовков и текста на странице недвижимости */
.section-description h1,
.section-description h2,
.section-description h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.section-description h1 {
    font-size: 32px;
    font-weight: 700;
}

.section-description h3 {
    font-size: 24px;
    font-weight: 600;
}

.section-description p {
    margin-bottom: 15px;
    line-height: 1.6;
}

/* ============================================
   СЛАЙДЕР НОВОСТЕЙ
   ============================================ */

.news-slider-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 40px;
    padding: 0 50px;
}

.news-slider {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.news-slider-track {
    display: flex;
    align-items: stretch; /* Выравнивание карточек по высоте */
    transition: transform 0.5s ease;
    will-change: transform;
}

/* Карточки в слайдере - мобильные (2 карточки) */
.news-slider-track .news-card {
    flex: 0 0 50%;
    width: 50%;
    min-width: 50%;
    margin: 0 10px;
    box-sizing: border-box;
    height: auto; /* Автоматическая высота, но выравнивается через align-items: stretch */
    display: flex;
    flex-direction: column;
}

/* Планшеты (3 карточки) */
@media (min-width: 768px) {
    .news-slider-track .news-card {
        flex: 0 0 33.333%;
        width: 33.333%;
        min-width: 33.333%;
        display: flex;
        flex-direction: column;
    }
}

/* Десктопы (3 карточки) */
@media (min-width: 1024px) {
    .news-slider-track .news-card {
        flex: 0 0 33.333%;
        width: 33.333%;
        min-width: 33.333%;
        display: flex;
        flex-direction: column;
    }
}

/* Кнопки навигации слайдера */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--bg-white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.slider-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.slider-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.slider-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-prev {
    left: 0;
}

.slider-next {
    right: 0;
}

/* Индикаторы слайдера */
.slider-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.slider-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.slider-indicator:hover {
    background-color: rgba(0, 0, 0, 0.4);
    transform: scale(1.2);
}

.slider-indicator.active {
    background-color: var(--primary-color);
    width: 30px;
    border-radius: 5px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .news-list {
        padding: 40px 0;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .news-card {
        margin: 0;
    }

    .news-content {
        padding: 20px;
    }

    .news-slider-wrapper {
        padding: 0 40px;
    }

    .slider-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .slider-prev {
        left: 5px;
    }

    .slider-next {
        right: 5px;
    }
}

