/* ========================================
   NEWS PAGE - Tin Tức
   Figma Design Implementation
   ======================================== */

.news-page {
    background: #f0f4f8;
    min-height: calc(100vh - 150px);
    padding-bottom: 50px;
}

/* Breadcrumb */
.news-breadcrumb {
    background: #fff;
    padding: 12px 0;
    font-size: 13px;
    border-bottom: 1px solid #e5e5e5;
}

.news-breadcrumb a {
    color: var(--primary-blue);
    text-decoration: none;
}

.news-breadcrumb a:hover {
    text-decoration: underline;
}

.news-breadcrumb span {
    color: #666;
}

/* Page Title */
.news-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 25px 0 20px;
    text-transform: uppercase;
    text-align: center;
}

/* ========================================
   Category Carousel
   ======================================== */
.news-categories-carousel {
    position: relative;
    margin-bottom: 20px;
    padding: 0 40px;
}

.categories-wrapper {
    display: flex;
    gap: 25px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 15px 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.categories-wrapper::-webkit-scrollbar {
    display: none;
}

.category-item {
    flex: 0 0 auto;
    text-align: center;
    min-width: 140px;
}

.category-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    gap: 8px;
}

.category-image {
    width: 140px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background: #f5f5f5;
}

.category-item.active .category-image,
.category-item:hover .category-image {
    border-color: var(--primary-blue);
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-image .placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

.category-image.all-category {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0066cc 0%, #0099ff 100%);
}

.category-image.all-category i {
    font-size: 40px;
    color: #fff;
}

.category-item span {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 5px;
}

.category-item.active span,
.category-item:hover span {
    color: var(--primary-blue);
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
}

.carousel-nav:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.carousel-nav.prev {
    left: 0;
}

.carousel-nav.next {
    right: 0;
}


/* ========================================
   Search Bar
   ======================================== */
.news-search {
    max-width: 500px;
    margin: 0 auto 30px;
}

.news-search form {
    position: relative;
    display: flex;
    align-items: center;
}

.news-search i {
    position: absolute;
    left: 15px;
    color: #999;
    font-size: 16px;
}

.news-search input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.news-search input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* ========================================
   Featured & Suggested Section
   ======================================== */
.news-featured-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.section-header .view-all {
    font-size: 13px;
    color: var(--primary-blue);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.section-header .view-all:hover {
    text-decoration: underline;
}

/* Empty state khi không có bài viết trong category */
.empty-news {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-news i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    color: #ccc;
}

.empty-news p {
    font-size: 15px;
}

/* Featured Post */
.featured-post {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.featured-card {
    display: block;
    text-decoration: none;
}

.featured-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
    padding-top: 100%; /* 1:1 aspect ratio */
}

.featured-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.featured-card:hover .featured-image img {
    transform: scale(1.03);
}

.featured-info {
    padding: 0 5px;
}

.featured-date {
    font-size: 12px;
    color: #999;
    display: block;
    margin-bottom: 8px;
}

.featured-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-card:hover .featured-title {
    color: var(--primary-blue);
}

.featured-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Suggested Posts */
.suggested-posts {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.suggested-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.suggested-item {
    display: flex;
    gap: 12px;
    text-decoration: none;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.suggested-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.suggested-image {
    flex: 0 0 180px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.suggested-image::before {
    content: '';
    display: block;
    padding-top: 100%; /* 1:1 aspect ratio */
}

.suggested-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.suggested-item:hover .suggested-image img {
    transform: scale(1.05);
}

.suggested-info {
    flex: 1;
    min-width: 0;
}

.suggested-date {
    font-size: 11px;
    color: #999;
    display: block;
    margin-bottom: 5px;
}

.suggested-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.suggested-item:hover .suggested-title {
    color: var(--primary-blue);
}


/* ========================================
   Category Section & Post Cards
   ======================================== */
.news-category-section {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.category-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Post Card */
.post-card {
    display: block;
    text-decoration: none;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    transition: box-shadow 0.2s, transform 0.2s;
}

.post-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.post-image {
    position: relative;
    padding-top: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-info {
    padding: 12px;
}

.post-date {
    font-size: 11px;
    color: #999;
    display: block;
    margin-bottom: 6px;
}

.post-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0;
    line-height: 1.4;
    height: 40px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card:hover .post-title {
    color: var(--primary-blue);
}

/* ========================================
   All Posts Section
   ======================================== */
.news-all-section {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.all-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ========================================
   Pagination
   ======================================== */
.news-pagination {
    margin-top: 25px;
    display: flex;
    justify-content: center;
}

.news-pagination .pagination {
    display: flex;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.news-pagination .pagination li a,
.news-pagination .pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.news-pagination .pagination li a:hover {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.news-pagination .pagination li.active span,
.news-pagination .pagination li.active a {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.news-pagination .pagination li.disabled span {
    color: #ccc;
    cursor: not-allowed;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1199px) {
    .category-posts-grid,
    .all-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991px) {
    .news-featured-section {
        grid-template-columns: 1fr;
    }
    
    .suggested-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .suggested-item {
        flex: 0 0 calc(50% - 10px);
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .category-posts-grid,
    .all-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .news-title {
        font-size: 20px;
    }
    
    .news-categories-carousel {
        padding: 0 35px;
    }
    
    .category-image {
        width: 100px;
        height: 100px;
    }
    
    .category-item span {
        font-size: 11px;
        max-width: 100px;
    }
    
    .news-search {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .featured-title {
        font-size: 16px;
    }
    
    .suggested-item {
        flex: 0 0 100%;
    }
    
    .suggested-image {
        flex: 0 0 150px;
    }
    
    .category-posts-grid,
    .all-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .news-categories-carousel {
        padding: 0 30px;
    }
    
    .categories-wrapper {
        gap: 10px;
    }
    
    .category-image {
        width: 80px;
        height: 80px;
    }
    
    .carousel-nav {
        width: 28px;
        height: 28px;
    }
    
    .suggested-image {
        flex: 0 0 120px;
    }
    
    .suggested-title {
        font-size: 13px;
    }
    
    .post-info {
        padding: 10px;
    }
    
    .post-title {
        font-size: 13px;
        height: 36px;
    }
    
    .news-pagination .pagination li a,
    .news-pagination .pagination li span {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}
