/* ===== ОСНОВНЫЕ СТИЛИ БЛОГА ===== */
.blog-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== ХЕДЕР БЛОГА ===== */
.blog-header {
    background: linear-gradient(135deg, #1a237e, #283593);
    color: white;
    padding: 40px 0;
    margin-bottom: 30px;
    text-align: center;
}

.blog-header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.blog-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== КОНТЕЙНЕР КОНТЕНТА ===== */
.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== ОСНОВНАЯ СЕТКА: 3 КОЛОНКИ НОВОСТЕЙ + САЙДБАР ===== */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 320px;
    gap: 25px;
    align-items: start;
    margin-bottom: 40px;
}

/* ===== ПОТОК НОВОСТЕЙ (первые 3 колонки) ===== */
.news-stream {
    grid-column: 1 / 4;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

/* ===== САЙДБАР (4-я колонка) ===== */
.sidebar {
    grid-column: 4 / 5;
    position: sticky;
    top: 80px;
    align-self: start;
}

.sidebar-tile {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #f0f4f8;
}

.sidebar-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.sidebar-tile:last-child {
    margin-bottom: 0;
}

.tile-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #3498db;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tile-title i {
    color: #3498db;
    font-size: 1.1rem;
}

/* ===== КАРТОЧКА НОВОСТИ ===== */
.grid-cell {
    opacity: 0;
    transform: translateY(20px);
    height: 100%;
}

.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f4f8;
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* Изображение карточки */
.card-image {
    position: relative;
    width: 100%;
    padding-bottom: 60%; /* Соотношение 5:3 */
    overflow: hidden;
    background: linear-gradient(135deg, #3498db, #2ecc71);
    flex-shrink: 0;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(52, 152, 219, 0.95);
    color: white;
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
}

.card-badge:hover {
    background: #2980b9;
    transform: scale(1.05);
}

/* Контент карточки */
.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    color: #2c3e50;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.card-title a:hover {
    color: #3498db;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: #7f8c8d;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-item i {
    font-size: 0.75rem;
    color: #95a5a6;
}

.card-excerpt {
    color: #5d6d7e;
    line-height: 1.6;
    font-size: 0.9rem;
    margin-bottom: 16px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f4f8;
    text-align: center;
}

/* ===== КНОПКА "ЧИТАТЬ ДАЛЕЕ" ===== */
.read-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f8fafc, #edf2f7);
    color: #2c3e50;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    width: 100%;
}

.read-more-btn:hover {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.read-more-btn .btn-icon {
    transition: transform 0.3s ease;
}

.read-more-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* ===== ПАГИНАЦИЯ ===== */
.pagination {
    margin: 30px 0 20px;
    display: flex;
    justify-content: center;
}

.pagination-links {
    display: flex;
    gap: 8px;
    background: white;
    padding: 10px 20px;
    border-radius: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.pagination-links a,
.pagination-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    color: #2c3e50;
    transition: all 0.2s;
}

.pagination-links a:hover {
    background: #f0f4f8;
    color: #3498db;
}

.pagination-links .current {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* ===== ПОИСК В САЙДБАРЕ ===== */
.search-box {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
}

.search-input:focus {
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-button {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* ===== КАТЕГОРИИ В САЙДБАРЕ ===== */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    border-bottom: 1px solid #f0f4f8;
}

.category-item:last-child {
    border-bottom: none;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    color: #2c3e50;
    text-decoration: none;
    transition: all 0.2s;
}

.category-link:hover {
    color: #3498db;
    padding-left: 5px;
}

.category-count {
    background: #f0f4f8;
    color: #64748b;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.category-link:hover .category-count {
    background: #3498db;
    color: white;
}

/* ===== СПИСКИ НОВОСТЕЙ В САЙДБАРЕ ===== */
.recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f4f8;
}

.recent-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
    display: block;
    margin-bottom: 6px;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-link:hover {
    color: #3498db;
}

.recent-date {
    font-size: 0.75rem;
    color: #95a5a6;
    display: flex;
    align-items: center;
    gap: 5px;
}

.recent-date i {
    font-size: 0.7rem;
}

/* ===== АДАПТИВНОСТЬ ===== */

/* Десктоп (1200px и выше) */
@media (min-width: 1200px) {
    .news-card {
        min-height: 480px;
    }
}

/* Планшеты (992px - 1199px) */
@media (max-width: 1199px) {
    .main-grid {
        grid-template-columns: 1fr 1fr 280px;
        gap: 20px;
    }
    
    .news-stream {
        grid-column: 1 / 3;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pagination {
        grid-column: 1 / 3;
    }
    
    .sidebar {
        grid-column: 3 / 4;
    }
}

/* Планшеты (768px - 991px) */
@media (max-width: 991px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .news-stream {
        grid-column: 1;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pagination {
        grid-column: 1;
    }
    
    .sidebar {
        grid-column: 1;
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .sidebar-tile {
        margin-bottom: 0;
    }
}

/* Мобильные (до 767px) */
@media (max-width: 767px) {
    .content-wrapper {
        padding: 0 15px;
    }
    
    .main-grid {
        gap: 20px;
    }
    
    .news-stream {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar {
        grid-template-columns: 1fr;
        margin-top: 20px;
    }
    
    .news-card {
        min-height: auto;
    }
    
    .card-content {
        padding: 16px;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .pagination-links {
        padding: 8px 12px;
    }
    
    .pagination-links a,
    .pagination-links span {
        min-width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

/* Очень маленькие экраны (до 480px) */
@media (max-width: 480px) {
    .card-meta {
        flex-direction: column;
        gap: 6px;
    }
    
    .sidebar-tile {
        padding: 16px;
    }
    
    .tile-title {
        font-size: 1rem;
    }
    
    .read-more-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* ===== ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ===== */

/* Плейсхолдер для карточек без изображения */
.card-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* Сообщение "Новостей нет" */
.no-posts-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.no-posts-message i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.no-posts-message h3 {
    color: #64748b;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.no-posts-message p {
    color: #94a3b8;
}

/* Пустой сайдбар */
.sidebar-empty {
    color: #94a3b8;
    text-align: center;
    padding: 15px 0;
    font-size: 0.9rem;
}

/* Популярные записи */
.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f4f8;
}

.popular-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.popular-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.popular-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
    display: block;
    margin-bottom: 6px;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-link:hover {
    color: #3498db;
}

.popular-views {
    font-size: 0.75rem;
    color: #95a5a6;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Точки в пагинации */
.pagination-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    color: #94a3b8;
    font-weight: 600;
}

/* Анимация появления карточек */
.grid-cell {
    opacity: 0;
    transform: translateY(20px);
}

/* Градиент для переполненного текста */
.card-excerpt.overflow {
    position: relative;
}

.card-excerpt.overflow::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, transparent, white);
    pointer-events: none;
}

/* Адаптивность пагинации */
@media (max-width: 480px) {
    .pagination-links {
        padding: 8px 10px;
    }
    
    .pagination-links a,
    .pagination-links span,
    .pagination-dots {
        min-width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* ===== ЗАГОЛОВОК КАТЕГОРИИ ===== */
.category-header {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f4f8;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 15px;
}

.category-title i {
    color: #3498db;
    font-size: 2rem;
}

.category-description {
    color: #5d6d7e;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.category-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #f0f4f8;
}

.category-post-count {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 0.95rem;
}

.category-post-count i {
    color: #3498db;
}

.back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    padding: 8px 16px;
    border-radius: 30px;
    background: #f0f4f8;
}

.back-to-blog:hover {
    background: #3498db;
    color: white;
    transform: translateX(-3px);
}

/* Активная категория в сайдбаре */
.category-link.active {
    color: #3498db;
    font-weight: 600;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1), transparent);
    padding-left: 15px;
    border-radius: 8px;
}

.category-link.active .category-count {
    background: #3498db;
    color: white;
}

/* Адаптивность заголовка категории */
@media (max-width: 768px) {
    .category-header {
        padding: 20px;
    }
    
    .category-title {
        font-size: 1.5rem;
    }
    
    .category-title i {
        font-size: 1.5rem;
    }
    
    .category-description {
        font-size: 1rem;
    }
    
    .category-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-cell {
    animation: fadeInUp 0.5s ease forwards;
}

.grid-cell:nth-child(1) { animation-delay: 0.05s; }
.grid-cell:nth-child(2) { animation-delay: 0.1s; }
.grid-cell:nth-child(3) { animation-delay: 0.15s; }
.grid-cell:nth-child(4) { animation-delay: 0.2s; }
.grid-cell:nth-child(5) { animation-delay: 0.25s; }
.grid-cell:nth-child(6) { animation-delay: 0.3s; }
.grid-cell:nth-child(7) { animation-delay: 0.35s; }
.grid-cell:nth-child(8) { animation-delay: 0.4s; }
.grid-cell:nth-child(9) { animation-delay: 0.45s; }