/* =======================================================
   Tệp Giao diện CSS - HTX Nông nghiệp Bích Châu
   Tối ưu hóa: Responsive, Bootstrap 5 Override, TinyMCE
======================================================== */

/* --- 1. Cài đặt chung (Cơ bản) --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* --- 2. Thanh điều hướng (Navbar) --- */
.navbar-custom {
    background-color: #2e7d32; /* Xanh lá đậm chuẩn nông nghiệp */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.navbar-custom .navbar-brand {
    font-size: 1.4rem;
    letter-spacing: 0.5px;
}

.navbar-custom .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-custom .nav-link:hover {
    color: #c8e6c9 !important; /* Đổi màu xanh nhạt khi hover */
    transform: translateY(-1px);
}

/* --- 3. Banner trang chủ (Hero Section) --- */
.hero-banner {
    /* Hình nền được thiết lập động qua PHP, đây là các style bổ trợ */
    background-color: #2e7d32; 
    color: white;
    padding: 120px 0;
    text-align: center;
    position: relative;
    min-height: 450px;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
}

.hero-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: linear-gradient(to bottom, rgba(10, 50, 15, 0.7), rgba(0, 30, 10, 0.4));
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

.hero-content h1 {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 1px;
}

/* --- 4. Khu vực Bài viết (Post Cards) --- */
.post-card {
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 4px solid #28a745; /* Vạch xanh lá tạo điểm nhấn bên trái */
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1) !important;
}

.post-item {
    margin-bottom: 20px;
}

/* --- 5. Trình bày nội dung từ TinyMCE (Bài viết) --- */
.style-render-content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #444;
}

/* Đảm bảo hình ảnh tải lên không bị tràn khung trên điện thoại */
.style-render-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Responsive cho Video Youtube (Iframe) */
.style-render-content iframe {
    max-width: 100%;
    border-radius: 8px;
    aspect-ratio: 16 / 9; /* Giữ tỷ lệ khung hình video chuẩn */
    width: 100%;
    height: auto;
}

.style-render-content ul, 
.style-render-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

/* --- 6. Nút bấm tương tác của Admin (Nút đăng bài) --- */
.btn-trigger-create {
    transition: all 0.3s ease;
    background-color: white;
    color: #6c757d;
}

.btn-trigger-create:hover {
    background-color: #e8f5e9;
    border-color: #28a745;
    color: #155724;
}

/* --- 7. Tùy biến thanh cuộn (Scrollbar) cho đồng bộ --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
 
::-webkit-scrollbar-thumb {
    background: #2e7d32; 
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1b5e20; 
}
/* Ẩn ảnh trước khi hiệu ứng AOS hoạt động */
[data-aos] {
    opacity: 0;
    transition-property: opacity, transform;
}
[data-aos].aos-animate {
    opacity: 1;
}
/* ==========================================
   TÙY CHỈNH HÌNH ẢNH TRONG BÀI VIẾT
========================================== */

/* 1. Mặc định cho màn hình nhỏ (Điện thoại) */
.style-render-content img {
    max-width: 100% !important; /* Luôn full 100% chiều rộng màn hình */
    height: auto !important;    /* Giữ nguyên tỷ lệ ảnh, không bị méo */
    display: block;             /* Giúp ảnh không bị lỗi khoảng trắng bên dưới */
    margin: 0 auto 15px auto;   /* Căn giữa ảnh và cách lề dưới 15px */
}

/* 2. Đối với màn hình lớn (Máy tính, Laptop - từ 768px trở lên) */
@media (min-width: 868px) {
    .style-render-content img {
        max-width: 50% !important; 
        max-width: 50% !important;
    }
}
/* --- 8. Tương thích thiết bị di động (Responsive) --- */
@media (max-width: 768px) {
    .hero-banner {
        padding: 80px 0;
        min-height: 350px;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .style-render-content {
        font-size: 1rem;
    }
    
    .navbar-custom .navbar-brand {
        font-size: 1.2rem;
    }
}