/* Страница новостей в стиле истории изменений */
.news-page {
    min-height: 100vh;
    padding: calc(var(--header-height) + 2rem) 0 4rem;
    background: linear-gradient(132deg, #000000, #1C1C1C, #131313, #282828);
    position: relative;
}

.news-page-header {
    margin-bottom: 3rem;
    text-align: center;
}

.news-page-title {
    font-family: 'Druk Wide', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.news-search-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.news-search-input {
    flex: 1;
    min-width: 300px;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: var(--white);
    font-size: 1rem;
    transition: all 0.3s var(--ease);
}

.news-search-input:focus {
    outline: none;
    border-color: var(--yellow);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 180, 0, 0.1);
}

.news-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.news-sort-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s var(--ease);
    font-size: 0.95rem;
}

.news-sort-btn:hover {
    background: rgba(255, 180, 0, 0.1);
    border-color: var(--yellow);
    color: var(--yellow);
}

/* Визуализация изменений */
.changes-visualization {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
    overflow-x: auto;
}

.changes-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.legend-square {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Цвета для типов новостей */
.legend-added, .type-added {
    background: #2ecc71; /* Зеленый */
    box-shadow: 0 0 5px rgba(46, 204, 113, 0.3);
}

.legend-fixed, .type-fixed {
    background: #e74c3c; /* Красный */
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.3);
}

.legend-changed, .type-changed {
    background: #3498db; /* Синий */
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.type-default {
    background: #4a4a4a; /* Темно-серый */
    opacity: 0.5;
}

.changes-grid-container {
    max-width: 100%;
}

.changes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0.5rem;
    justify-content: flex-start;
}

/* Колонка новости (содержит 3 квадратика) */
.news-column {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 3px;
    border-radius: 4px;
    background: transparent;
}

.change-square {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
}

.change-square:hover {
    transform: scale(1.4);
    z-index: 10;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.8);
}

/* Стили для кастомного тултипа */
.custom-tooltip {
    position: fixed;
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    display: none;
    white-space: normal;
    max-width: 300px;
    backdrop-filter: blur(8px);
    font-weight: 500;
}

.tooltip-title {
    color: #4fc3f7;
    font-weight: 700;
    margin-right: 5px;
}

.tooltip-date {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}


/* Временная шкала новостей */
.news-timeline {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

.news-timeline::before {
    content: '';
    position: absolute;
    left: 100px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--yellow), transparent);
    opacity: 0.3;
}

.news-timeline-item {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    position: relative;
    padding-left: 0; /* Убрали лишний отступ */
    transition: background-color 0.5s ease;
    border-radius: 12px;
}

/* --- НОВАЯ АНИМАЦИЯ ТОЧЕК И ЛИНИЙ --- */

/* Цветовые переменные для типов */
.item-type-added { --color-dynamic: #2ecc71; --color-dynamic-glow: rgba(46, 204, 113, 0.5); }
.item-type-fixed { --color-dynamic: #e74c3c; --color-dynamic-glow: rgba(231, 76, 60, 0.5); }
.item-type-changed { --color-dynamic: #3498db; --color-dynamic-glow: rgba(52, 152, 219, 0.5); }
.item-type-default { --color-dynamic: #7f8c8d; --color-dynamic-glow: rgba(127, 140, 141, 0.5); }

/* Точка на таймлайне (::after) */
.news-timeline-item::after {
    content: '';
    position: absolute;
    left: 94px; /* 100px (линия) - 6px (половина ширины точки) */
    top: 2.8rem;  /* Опустили ниже (примерно центр заголовка) */
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
    transition: all 0.3s var(--ease);
}

/* Линия от точки к карточке (::before) */
.news-timeline-item::before {
    content: '';
    position: absolute;
    left: 100px; 
    top: calc(2.8rem + 5px); /* Центр точки */
    width: 0; 
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
    transition: width 0.3s var(--ease), background-color 0.3s var(--ease);
}

/* Эффекты при наведении на ВСЮ новость (карточку или дату) */
.news-timeline-item:hover::after {
    transform: scale(1.3);
    border-color: var(--color-dynamic);
    background: var(--color-dynamic);
    box-shadow: 0 0 15px var(--color-dynamic-glow);
}

.news-timeline-item:hover::before {
    width: 2rem; /* Точно дотягивается до карточки (равно gap) */
    background: var(--color-dynamic);
}

/* --- КОНЕЦ АНИМАЦИИ --- */

.news-timeline-item.highlight-news {
    background: rgba(255, 193, 7, 0.1);
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.1);
}

.timeline-date {
    flex-shrink: 0;
    width: 100px;
    text-align: right;
    padding-top: 2.3rem; /* Выравниваем дату по вертикали с точкой */
    padding-right: 2rem; /* Сдвигаем дату левее от линии */
}

.date-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
}

.date-full {
    color: var(--yellow);
    font-weight: 600;
    font-size: 0.9rem;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.news-update-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}

/* Цветная полоска слева */
.news-update-card.card-type-added::before { background: #2ecc71; }
.news-update-card.card-type-fixed::before { background: #e74c3c; }
.news-update-card.card-type-changed::before { background: #3498db; }
.news-update-card.card-type-default::before { background: #7f8c8d; }

.news-update-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transform: scaleY(0.5); /* По умолчанию сжата */
    transform-origin: center;
    transition: transform 0.3s var(--ease);
    transition-delay: 0.1s; 
}

.news-update-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
    /* УБРАЛИ transform: translateX(5px), чтобы не рвать линию */
    transform: none; 
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Важно: Активируем полоску при наведении на РОДИТЕЛЯ (.news-timeline-item) */
.news-timeline-item:hover .news-update-card::before {
    transform: scaleY(1);
}

.update-title {
    font-family: 'Druk Wide', sans-serif;
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: 1rem;
    line-height: 1.3;
    position: relative;
    padding-left: 1.5rem;
}

.update-title::before {
    content: '#';
    position: absolute;
    left: 0;
    color: var(--yellow);
    font-size: 1.2rem;
}

.update-description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.update-images-preview {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.preview-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.1);
    border-color: var(--yellow);
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-image-more {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: rgba(255, 180, 0, 0.1);
    border: 1px solid var(--yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--yellow);
    font-weight: 600;
    font-size: 0.9rem;
}

.read-more-btn {
    background: transparent;
    border: 2px solid var(--yellow);
    color: var(--yellow);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.read-more-btn:hover {
    background: var(--yellow);
    color: var(--black);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(255, 180, 0, 0.3);
}

/* Стили для кнопки btn-outline (внешняя ссылка) */
.btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    text-decoration: none;
    font-size: 0.95rem;
    gap: 0.5rem;
}

.btn-outline {
    background: transparent !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important; /* Более яркая рамка */
    color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.btn-outline:hover {
    border-color: var(--yellow) !important;
    color: var(--yellow) !important;
    background: rgba(255, 180, 0, 0.1) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Модальные окна */
.news-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s var(--ease);
}

.news-modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    margin: 2% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    border: 1px solid rgba(255, 193, 7, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s var(--ease);
}

.news-modal-header {
    background: linear-gradient(135deg, var(--yellow), #ff8c00);
    padding: 1.5rem 2rem;
    position: relative;
}

/* Стили заголовков модалок по типам */
.news-modal-header.header-type-added { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.news-modal-header.header-type-fixed { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.news-modal-header.header-type-changed { background: linear-gradient(135deg, #3498db, #2980b9); }
.news-modal-header.header-type-default { background: linear-gradient(135deg, #95a5a6, #7f8c8d); }


.news-modal-header h3 {
    color: var(--black);
    font-family: 'Druk Wide', sans-serif;
    font-size: 1.4rem;
    margin: 0;
    padding-right: 3rem;
    line-height: 1.3;
}

.news-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: var(--black);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease);
    font-size: 1.2rem;
}

.news-modal-close:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: rotate(90deg);
}

.news-modal-body {
    padding: 2rem;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

.news-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.news-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.news-meta-item i {
    color: var(--yellow);
    width: 16px;
}

.news-full-content {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    font-size: 1rem;
    margin-bottom: 2rem;
}

.news-external-link {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    text-align: center;
}

.no-news {
    text-align: center;
    padding: 4rem 2rem;
    color: rgba(255, 255, 255, 0.5);
}

.no-news i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.no-news h3 {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
    font-family: 'Druk Wide', sans-serif;
}

/* Карусель изображений */
.news-images-carousel {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.carousel-container {
    position: relative;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s var(--ease);
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    display: none;
}

.carousel-slide.active {
    display: block;
    animation: fadeIn 0.5s var(--ease);
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.02);
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease);
    backdrop-filter: blur(10px);
    z-index: 10;
    font-size: 1.2rem;
}

.carousel-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 1rem;
}

.carousel-next {
    right: 1rem;
}

.carousel-indicators {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s var(--ease);
}

.indicator.active {
    background: var(--yellow);
    transform: scale(1.2);
}

.carousel-counter {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Адаптивность */
@media (max-width: 768px) {
    .news-page {
        padding: calc(var(--header-height) + 1rem) 0 2rem;
    }

    .news-page-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .news-search-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .news-search-input {
        min-width: 100%;
    }

    .changes-visualization {
        padding: 1.5rem;
    }

    .changes-legend {
        gap: 1rem;
    }

    .news-timeline::before {
        left: 60px;
    }

    /* Адаптация точки и линии для мобильных */
    .news-timeline-item::after {
        left: 54px; /* 60 - 6 */
    }
    
    .news-timeline-item::before {
        left: 60px;
        width: 0;
    }
    
    .news-timeline-item:hover::before {
        width: 1rem; /* Короче линия на мобильных */
    }

    .news-timeline-item {
        gap: 1rem;
        padding-left: 0;
    }

    .timeline-date {
        width: 60px;
        padding-top: 2.2rem;
        padding-right: 15px; /* Меньший отступ на мобильных */
    }

    .date-time {
        font-size: 0.75rem;
    }

    .date-full {
        font-size: 0.8rem;
    }

    .news-update-card {
        padding: 1.5rem;
    }

    .update-title {
        font-size: 1.2rem;
        padding-left: 1.2rem;
    }

    .update-description {
        font-size: 0.95rem;
    }

    .preview-image {
        width: 60px;
        height: 60px;
    }

    .preview-image-more {
        width: 60px;
        height: 60px;
        font-size: 0.8rem;
    }

    .news-modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 85vh;
    }

    .news-modal-body {
        padding: 1.5rem;
        max-height: calc(85vh - 150px);
    }

    .carousel-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .news-page-title {
        font-size: 1.5rem;
    }

    .news-timeline::before {
        display: none;
    }
    
    /* Скрываем точки и линии на совсем маленьких экранах */
    .news-timeline-item::before,
    .news-timeline-item::after {
        display: none;
    }

    .news-timeline-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .timeline-date {
        width: 100%;
        text-align: left;
        padding-top: 0;
        padding-right: 0;
    }

    .update-title {
        font-size: 1.1rem;
    }

    .carousel-container {
        height: 250px;
    }

    .carousel-nav {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
}