.news-highlight-module {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

/* Grid Layout */
.news-grid {
    grid-template-columns: repeat(3, 1fr);
}

.news-grid.grid-desktop-2 {
    grid-template-columns: repeat(2, 1fr);
}

.news-grid.grid-desktop-3 {
    grid-template-columns: repeat(3, 1fr);
}

.news-grid.grid-desktop-4 {
    grid-template-columns: repeat(4, 1fr);
}

.news-grid.grid-tablet-1 {
    grid-template-columns: 1fr;
}

.news-grid.grid-tablet-2 {
    grid-template-columns: repeat(3, 1fr);
}

.news-grid.grid-tablet-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* First Article Styles - 2/3 width */
.news-grid .news-item:first-child {
    grid-column: span 2;
    min-height: 400px;
}

.news-grid.grid-desktop-2 .news-item:first-child {
    grid-column: span 2;
}

.news-grid.grid-desktop-3 .news-item:first-child {
    grid-column: span 2;
}

.news-grid.grid-desktop-4 .news-item:first-child {
    grid-column: span 3;
}

/* List Layout */
.news-list {
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.news-list .news-item {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    min-height: 200px;
}

.news-list .news-bg-image {
    flex: 0 0 40%;
    position: relative !important;
}

/* Masonry Layout */
.news-masonry {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.news-masonry .news-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 400px;
}

/* News Item Styles */
.news-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    min-height: 300px;
}

.news-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* First Article Enhanced Styles */
.news-item:first-child .news-content {
    padding: 3rem;
    justify-content: flex-end;
}

.news-item:first-child .news-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.news-item:first-child .news-intro {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.news-item:first-child .readmore-link {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Background Image Styles */
.news-item.with-bg-image {
    color: #fff;
}

.news-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.5s ease;
    z-index: 1;
    width: 100% !important;
    height: 100% !important;
}

.news-item:hover .news-bg-image {
    transform: scale(1.05);
}

.news-bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        rgba(0,0,0,0.7) 0%,
        rgba(0,0,0,0.5) 50%,
        rgba(0,0,0,0.3) 100%
    );
    z-index: 2;
    transition: background 0.3s ease;
    width: 100% !important;
    height: 100% !important;
}

.news-item:hover .news-bg-overlay {
    background: linear-gradient(
        45deg,
        rgba(0,0,0,0.8) 0%,
        rgba(0,0,0,0.6) 50%,
        rgba(0,0,0,0.4) 100%
    );
}

.news-content {
    position: relative;
    z-index: 3;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.news-list .news-content {
    justify-content: center;
}

.news-date {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.news-title {
    margin: 0 0 1.2rem 0;
    font-size: 1.3rem;
    line-height: 1.3;
    font-weight: 600;
}

.news-title a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.news-title a:hover {
    color: #4dabf7;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.news-intro {
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.news-readmore {
    margin-top: auto;
}

.readmore-link {
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.readmore-link:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateX(5px);
    color: #fff;
}

.readmore-arrow {
    margin-left: 0.8rem;
    transition: transform 0.3s ease;
}

.readmore-link:hover .readmore-arrow {
    transform: translateX(5px);
}

/* Fallback for items without images */
.news-item:not(.with-bg-image) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.news-item:not(.with-bg-image) .news-date {
    color: rgba(255,255,255,0.8);
}

.news-item:not(.with-bg-image) .news-intro {
    color: rgba(255,255,255,0.9);
}

.news-no-items {
    text-align: center;
    padding: 3rem;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Image Size Variations */
.news-image-small {
    min-height: 250px;
}

.news-image-medium {
    min-height: 300px;
}

.news-image-large {
    min-height: 350px;
}

.news-item:first-child.news-image-small {
    min-height: 350px;
}

.news-item:first-child.news-image-medium {
    min-height: 400px;
}

.news-item:first-child.news-image-large {
    min-height: 450px;
}

/* List Layout Specific Styles */
.news-list .news-item {
    min-height: 200px;
}

.news-list .with-bg-image .news-bg-image {
    width: 40% !important;
    right: auto;
}

.news-list .with-bg-image .news-bg-overlay {
    width: 40% !important;
    right: auto;
    background: linear-gradient(
        90deg,
        rgba(0,0,0,0.7) 0%,
        rgba(0,0,0,0.4) 100%
    );
}

.news-list .with-bg-image .news-content {
    width: 60%;
    margin-left: auto;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .news-grid.grid-desktop-3,
    .news-grid.grid-desktop-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .news-grid .news-item:first-child {
        grid-column: span 2;
    }
    
    .news-grid.grid-desktop-4 .news-item:first-child {
        grid-column: span 2;
    }
    
    .news-list .news-item {
        flex-direction: column;
        min-height: 400px;
    }
    
    .news-list .with-bg-image .news-bg-image {
        width: 100% !important;
        height: 50% !important;
    }
    
    .news-list .with-bg-image .news-bg-overlay {
        width: 100% !important;
        height: 50% !important;
        background: linear-gradient(
            to bottom,
            rgba(0,0,0,0.7) 0%,
            rgba(0,0,0,0.3) 100%
        );
    }
    
    .news-list .with-bg-image .news-content {
        width: 100%;
        height: 50%;
        margin-left: 0;
        justify-content: flex-start;
        padding: 1.5rem;
    }
    
    .news-masonry .news-item:first-child {
        grid-column: span 2;
        grid-row: span 1;
    }
}

/* ✅ ИСПРАВЛЕНО ТОЛЬКО ДЛЯ МОБИЛЬНЫХ (< 768px) */
@media (max-width: 768px) {
    .news-highlight-module {
        grid-template-columns: 1fr !important; /* ✅ Одинаковая ширина для всех */
        gap: 1.5rem;
    }
    
    /* ✅ Все grid layouts становятся 1 колонкой с одинаковой шириной */
    .news-grid,
    .news-grid.grid-desktop-2,
    .news-grid.grid-desktop-3,
    .news-grid.grid-desktop-4,
    .news-grid.grid-tablet-1,
    .news-grid.grid-tablet-2,
    .news-grid.grid-tablet-3 {
        grid-template-columns: 1fr !important;
    }
    
    /* ✅ Первая новость тоже занимает 1 колонку (одинаковая ширина) */
    .news-grid .news-item:first-child,
    .news-grid.grid-desktop-2 .news-item:first-child,
    .news-grid.grid-desktop-3 .news-item:first-child,
    .news-grid.grid-desktop-4 .news-item:first-child {
        grid-column: span 1 !important;
        min-height: 300px; /* ✅ Сохраняем увеличенную высоту для первой новости */
    }
    
    .news-item {
        min-height: 280px; /* ✅ Единая высота для всех новостей */
        width: 100%; /* ✅ Гарантируем одинаковую ширину */
    }
    
    .news-item:first-child .news-content {
        padding: 2rem;
    }
    
    .news-item:first-child .news-title {
        font-size: 1.4rem;
    }
    
    .news-item:first-child .news-intro {
        font-size: 1rem;
    }
    
    .news-content {
        padding: 1.5rem;
    }
    
    .news-title {
        font-size: 1.1rem;
    }
    
    .news-masonry .news-item:first-child {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    /* ✅ Masonry layout тоже становится 1 колонкой */
    .news-masonry {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .news-item {
        min-height: 250px; /* ✅ Единая высота на маленьких мобильных */
    }
    
    .news-item:first-child {
        min-height: 280px; /* ✅ Первая новость чуть выше */
    }
    
    .news-content {
        padding: 1rem;
    }
    
    .news-item:first-child .news-content {
        padding: 1.5rem;
    }
    
    .news-title {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }
    
    .news-item:first-child .news-title {
        font-size: 1.2rem;
    }
    
    .news-intro {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .news-item:first-child .news-intro {
        font-size: 0.95rem;
    }
    
    .readmore-link {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .news-item:first-child .readmore-link {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* ✅ ИСПРАВЛЕНО: Стили для заголовка модуля и ссылки "Все новости" */
.news-highlight-module-wrapper {
    position: relative;
    width: 100%;
}

.news-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    width: 100%;
    flex-wrap: nowrap;
}

.news-module-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 500;
    color: #264a8a;
    flex: 1;
    min-width: 0; /* ✅ Важно для flex-элементов */
}

.all-news-link {
    display: inline-flex;
    align-items: center;
    color: #264a8a;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5rem 1.5rem;
    border: 2px solid #264a8a;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: transparent;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 2rem; /* ✅ Отступ от заголовка */
}

.all-news-link:hover {
    background: #264a8a;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.all-news-arrow {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.all-news-link:hover .all-news-arrow {
    transform: translateX(3px);
}

/* ✅ ИСПРАВЛЕНО: Responsive Styles для заголовка */
@media (max-width: 768px) {
    .news-module-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .news-module-title {
        font-size: 1.6rem;
        width: 100%;
        flex: none;
    }
    
    .all-news-link {
        margin-left: 0;
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .news-module-title {
        font-size: 1.4rem;
    }
    
    .all-news-link {
        font-size: 0.9rem;
        padding: 0.4rem 1.2rem;
    }
}