/* ===================================================================
 *  Digital News - Public Stylesheet
 * =================================================================== */

/* -------------------------------------------------------------------
 *  Base & Typography
 * ------------------------------------------------------------------- */
:root {
    --primary-color: #0d6efd;
    --dark-color: #212529;
    --light-gray: #f8f9fa;
    --text-muted: #6c757d;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--light-gray);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main {
    flex: 1;
}
.section-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}
.section-title span {
    background-color: var(--light-gray);
    padding-right: 15px;
    position: relative;
    z-index: 1;
}
.section-title::after {
    content: '';
    position: absolute;
    height: 2px;
    width: 100%;
    background: linear-gradient(to right, var(--primary-color), #eee);
    top: 50%;
    left: 0;
    z-index: 0;
}

/* -------------------------------------------------------------------
 *  Header & Navigation
 * ------------------------------------------------------------------- */
header.sticky-top {
    z-index: 1020; /* Bootstrap standard z-index for navbars */
}
.navbar-brand {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
}
.navbar-nav .nav-link {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--dark-color);
}
.navbar-nav .nav-link.active, .navbar-nav .nav-link:hover {
    color: var(--primary-color);
}

/* -------------------------------------------------------------------
 *  Featured Slider
 * ------------------------------------------------------------------- */
.featured-slider .slick-slide {
    margin: 0 10px;
}
.slider-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 450px;
}
.slider-item a {
    display: block;
    width: 100%;
    height: 100%;
}
.slider-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.slider-item:hover img {
    transform: scale(1.05);
}
.slider-item .slider-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    color: #fff;
    pointer-events: none; /* Allow clicks to pass through to the <a> tag */
}
.slider-item .slider-category {
    background-color: var(--primary-color);
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
.slider-item .slider-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
    color: #fff;
}
.slick-prev, .slick-next { z-index: 1; }
.slick-prev:before, .slick-next:before { font-size: 25px; color: #fff; opacity: 0.8; }
.slick-dots li button:before { font-size: 12px; color: #fff; }
.slick-dots li.slick-active button:before { color: var(--primary-color); }


/* -------------------------------------------------------------------
 *  Article Lists (Latest, Popular, Related)
 * ------------------------------------------------------------------- */
.latest-post-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}
.latest-post-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.latest-post-item .post-image {
    width: 250px;
    height: 160px;
    flex-shrink: 0;
}
.latest-post-item .post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.latest-post-item .post-content .post-category {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}
.latest-post-item .post-content .post-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0.5rem 0;
}
.latest-post-item .post-content .post-title a {
    text-decoration: none;
    color: var(--dark-color);
}
.latest-post-item .post-content .post-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* -------------------------------------------------------------------
 *  Sidebar
 * ------------------------------------------------------------------- */
.sidebar-sticky { 
    position: -webkit-sticky;
    position: sticky; 
    top: 80px; /* Adjust based on your header height */
}
.sidebar-widget {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.widget-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}
/* Style cho các bài viết trong sidebar (Xem nhiều, Tin liên quan) */
.popular-post-item, .related-article-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.popular-post-item a, .related-article-item a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--dark-color);
    gap: 15px; /* Tạo khoảng cách giữa ảnh và text */
}
.popular-post-item img, .related-article-item img {
    width: 80px;      /* Giới hạn chiều rộng của ảnh */
    height: 60px;     /* Giới hạn chiều cao của ảnh */
    object-fit: cover; /* Đảm bảo ảnh không bị méo */
    border-radius: 5px;
    flex-shrink: 0;   /* Ngăn ảnh bị co lại */
}
.popular-post-item span, .related-article-item span {
    font-weight: bold;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* -------------------------------------------------------------------
 *  Chatbot
 * ------------------------------------------------------------------- */
.chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    z-index: 1031; /* Highest z-index */
}
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    max-width: 90%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0;
    visibility: hidden;
    z-index: 1030; /* High, but below toggler */
}
.chatbot-container.active {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}
/* Các style con của chatbot (header, body, footer, messages) giữ nguyên như phiên bản trước */
.chatbot-header { background: #0d6efd; color: white; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; }
.chatbot-close-btn { background: none; border: none; color: white; font-size: 1.5rem; }
.chatbot-body { height: 350px; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.chat-message { display: flex; gap: 10px; max-width: 90%; align-items: flex-start; }
.chat-message .avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.chat-message .content { padding: 10px 14px; border-radius: 18px; word-wrap: break-word; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.user .avatar { background-color: #0d6efd; color: white; }
.chat-message.user .content { background-color: #0d6efd; color: white; border-bottom-right-radius: 4px; }
.chat-message.bot { align-self: flex-start; }
.chat-message.bot .avatar { background-color: #e9ecef; color: #495057; }
.chat-message.bot .content { background-color: #f1f3f5; color: #212529; border-bottom-left-radius: 4px; }
.typing-indicator span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: #adb5bd; margin: 0 1px; animation: bounce 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }
.suggestion-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suggestion-btn { background-color: #fff; border: 1px solid #0d6efd; color: #0d6efd; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; }
.suggestion-btn:hover { background-color: #0d6efd; color: #fff; }
.chatbot-footer form { display: flex; }
.chatbot-footer input { flex-grow: 1; border: none; padding: 15px; font-size: 0.9rem; border-top: 1px solid #eee; }
.chatbot-footer input:focus { outline: none; }
.chatbot-footer button { background: #0d6efd; color: white; border: none; padding: 0 15px; }
/* ... các style cũ giữ nguyên ... */

/* ================================== */
/* READING PROGRESS BAR */
/* ================================== */
#reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background-color: var(--primary-color);
    width: 0%; /* Bắt đầu từ 0% */
    z-index: 1032; /* Cao nhất */
    transition: width 0.1s ease-out;
}

/* ================================== */
/* ARTICLE DETAIL PAGE (NÂNG CẤP LỚN) */
/* ================================== */
.article-header {
    margin-bottom: 2rem;
    text-align: center;
}
.article-category-tag {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
    text-decoration: none;
}
.article-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark-color);
}
.article-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1rem;
}
.article-meta .author-name {
    font-weight: bold;
    color: var(--dark-color);
}

.article-thumbnail {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 2rem;
}

/* Floating Share Buttons */
.floating-share {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: -50px; /* Ẩn ban đầu */
    opacity: 0;
    visibility: hidden;
    transition: left 0.3s ease-in-out, opacity 0.3s ease-in-out;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.floating-share.visible {
    left: 20px; /* Hiện ra khi cuộn vào bài viết */
    opacity: 1;
    visibility: visible;
}
.floating-share .share-btn {
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
/* Responsive cho nút share */
@media (max-width: 1200px) {
    .floating-share {
        display: none; /* Ẩn đi trên màn hình nhỏ */
    }
}
/* Nút share trong bài viết (dành cho mobile) */
.inline-share-buttons {
    display: none; /* Mặc định ẩn */
}
@media (max-width: 1200px) {
    .inline-share-buttons {
        display: flex; /* Hiện ra trên mobile */
        align-items: center;
        gap: 5px;
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid #eee;
    }
}

/* ... (các style cũ giữ nguyên) ... */

/* ================================== */
/* ARTICLE DETAIL PAGE - TÁI CẤU TRÚC */
/* ================================== */
#article-main-content {
    /* Style cũ giữ nguyên */
}
.article-title {
    /* Style cũ giữ nguyên */
}
.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem; /* row-gap, column-gap */
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 1.5rem;
}
/* Xóa margin-bottom của .article-controls vì đã có gap */

/* Author Box */
.author-box {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-top: 2rem;
}
.author-box .avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}
.author-box .author-info h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.author-box .author-info p {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0;
}

/* Rating System */
.rating-widget {
    margin-top: 2.5rem;
    padding: 1.5rem;
    text-align: center;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
}
.rating-widget h5 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 1rem;
}
.rating-stars {
    font-size: 2rem;
    color: #ced4da; /* Màu sao mặc định */
    cursor: pointer;
}
.rating-stars .star:hover,
.rating-stars .star.hovered {
    color: #ffc107; /* Màu sao khi hover */
}
.rating-stars .star.selected {
    color: #ffc107; /* Màu sao đã được chọn */
}
.rating-result {
    margin-top: 1rem;
    color: #6c757d;
    font-size: 0.9rem;
    min-height: 22px; /* Đảm bảo không giật layout */
}
/* Class khi người dùng đã vote */
.rating-widget.voted .rating-stars {
    cursor: not-allowed;
}
/* ... (các style cũ giữ nguyên) ... */

/* ARTICLE CONTROLS (NÂNG CẤP) */
.article-controls {
    display: flex;
    justify-content: space-between; /* Đẩy 2 cụm nút ra 2 bên */
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* Kiểu cho dropdown menu của nút share */
.article-controls .dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: none;
}
.article-controls .dropdown-item {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
}
.article-controls .dropdown-item i {
    color: #6c757d; /* Màu icon xám nhẹ */
}
.article-controls .dropdown-item:hover {
    background-color: #f1f3f5;
    color: #0d6efd;
}
.article-controls .dropdown-item:hover i {
    color: #0d6efd;
}