/* =====================================================
   TIN TỨC PAGE STYLES
   Nông Sản Tây Bắc - News Page
   ===================================================== */

/* =====================================================
   HERO BANNER
   ===================================================== */
.tt-page-hero {
    position: relative;
    background: url('../images/new-background.png') center center/cover no-repeat;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 0;
}

.tt-page-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
}

.tt-page-hero .container {
    position: relative;
    z-index: 2;
}

.tt-page-title {
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Breadcrumb */
.tt-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    font-size: 14px;
}

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

.tt-breadcrumb a:hover {
    color: #8bc34a;
}

.tt-breadcrumb .separator {
    font-size: 10px;
    opacity: 0.7;
}

.tt-breadcrumb .current {
    opacity: 0.9;
}

/* =====================================================
   NEWS SECTION
   ===================================================== */
.tt-news-section {
    padding: 50px 0 80px;
    background: #fff;
}

/* Sticky sidebar: row uses flex-start so sidebar doesn't jump when content height changes */
.tt-news-section .row {
    align-items: flex-start;
}

/* Sidebar column needs to stretch for sticky positioning to work */
/* Using min-height and align-self to ensure column stretches */
.tt-news-section .col-lg-4 {
    align-self: stretch !important;
    min-height: 100%;
}

/* =====================================================
   NEWS CARDS
   ===================================================== */
.tt-news-card {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
}

.tt-news-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

.tt-news-card-link {
    display: block;
    position: relative;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.tt-news-card-img {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Square aspect ratio */
    overflow: hidden;
}

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

.tt-news-card:hover .tt-news-card-img img {
    transform: scale(1.08);
}

/* Gradient overlay for text readability */
.tt-news-card-img::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

/* Date Badge */
.tt-news-date {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4a6f28;
    color: #fff;
    padding: 8px 10px;
    border-radius: 4px;
    text-align: center;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    min-width: 50px;
    z-index: 2;
}

.tt-news-date .day {
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.tt-news-date .year {
    font-size: 12px;
    font-weight: 400;
    display: block;
}

/* Card Content - positioned at bottom of image */
.tt-news-card-content {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    padding: 0 15px;
    z-index: 2;
}

.tt-news-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Read More Button */
.tt-news-readmore {
    position: absolute;
    bottom: 12px;
    left: 15px;
    display: inline-block;
    background: #4a6f28;
    color: #fff;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 3px;
    transition: all 0.3s ease;
    z-index: 3;
}

.tt-news-card:hover .tt-news-readmore {
    background: #3d5c21;
}

/* =====================================================
   LOAD MORE BUTTON
   ===================================================== */
.tt-news-loadmore {
    text-align: center;
    margin-top: 40px;
}

.tt-btn-loadmore {
    display: inline-block;
    background: #4a6f28;
    color: #fff;
    padding: 12px 40px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tt-btn-loadmore:hover:not(.disabled) {
    background: #3d5c21;
    transform: translateY(-2px);
}

.tt-btn-loadmore.disabled {
    background: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

.tt-btn-loadmore:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Animation for newly loaded news items */
.news-item-new {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.tt-news-sidebar {
    position: relative;
    /* Đảm bảo sidebar stretch full height để sticky hoạt động */
    align-self: stretch;
}

.tt-sidebar-widget {
    background: #f8faf5;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.tt-widget-title {
    font-size: 18px;
    font-weight: 600;
    color: #4a6f28;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8f0e0;
}

/* =====================================================
   CATEGORIES WIDGET
   ===================================================== */
.tt-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tt-category-list li {
    border-bottom: 1px solid #e8f0e0;
}

.tt-category-list li:last-child {
    border-bottom: none;
}

.tt-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.tt-category-item:hover {
    color: #4a6f28;
}

.tt-category-item i {
    font-size: 12px;
    color: #aaa;
    transition: color 0.3s ease;
}

.tt-category-item:hover i {
    color: #4a6f28;
}

/* =====================================================
   FEATURED NEWS WIDGET - STICKY (handled by JavaScript)
   ===================================================== */
.tt-featured-news-widget {
    /* JavaScript handles sticky positioning */
    z-index: 100;
    background: #f8faf5;
}

/* Sidebar không cần display: flex - position: relative đã được định nghĩa ở trên */

.tt-featured-news-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tt-featured-news-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.tt-featured-news-item:hover {
    background: #fff;
}

.tt-featured-news-img {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
}

.tt-featured-news-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tt-featured-news-item:hover .tt-featured-news-img img {
    transform: scale(1.1);
}

.tt-featured-news-content h4 {
    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;
    transition: color 0.3s ease;
}

.tt-featured-news-item:hover .tt-featured-news-content h4 {
    color: #4a6f28;
}

/* =====================================================
   RESPONSIVE STYLES
   ===================================================== */
@media (max-width: 1199px) {
    .tt-featured-news-widget.is-sticky {
        width: calc((100% - 30px) * 0.333 - 40px);
    }
}

@media (max-width: 991px) {
    .tt-page-title {
        font-size: 32px;
    }
    
    .tt-page-hero {
        min-height: 160px;
        padding: 40px 0;
    }
    
    .tt-news-section {
        padding: 40px 0 60px;
    }
    
    .tt-news-sidebar {
        margin-top: 40px;
    }
    
    .tt-featured-news-widget.is-sticky {
        position: static;
        width: auto;
        max-width: none;
    }
}

@media (max-width: 767px) {
    .tt-page-title {
        font-size: 28px;
    }
    
    .tt-page-hero {
        min-height: 140px;
        padding: 30px 0;
    }
    
    .tt-news-card-img {
        padding-top: 85%; /* Slightly less square on mobile */
    }
    
    .tt-news-card-content {
        bottom: 45px;
    }
    
    .tt-news-readmore {
        bottom: 10px;
        padding: 5px 14px;
        font-size: 11px;
    }
    
    .tt-sidebar-widget {
        padding: 20px;
    }
    
    .tt-featured-news-img {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 575px) {
    .tt-page-title {
        font-size: 24px;
    }
    
    .tt-breadcrumb {
        font-size: 13px;
    }
    
    .tt-news-card-title {
        font-size: 14px;
    }
    
    .tt-news-date {
        padding: 6px 8px;
        min-width: 45px;
    }
    
    .tt-news-date .day {
        font-size: 13px;
    }
    
    .tt-news-date .year {
        font-size: 11px;
    }
}
