/* =======================================================
   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) --- */
html, body {
    overflow-x: hidden !important; /* Cắt bỏ và giấu đi mọi thứ tràn ra chiều ngang */
    width: 100%;                   /* Ép chiều rộng trang luôn vừa khít 100% màn hình */
    position: relative;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    padding-top: 50px;
}

/* --- 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);
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1030 !important;
}

.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: 20px 0;
    text-align: center;
    position: relative;
    min-height: 250px;
    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-height: 50vh !important; /* Giới hạn chiều cao không bao giờ vượt quá 70% màn hình */
    width: auto !important;      /* Chiều rộng tự động thu phóng theo tỷ lệ gốc */
    max-width: 100% !important;  /* Ngăn không cho ảnh bề ngang quá to tràn ra khỏi viền bài viết */
    
    display: block !important;   /* Chuyển thành khối để căn giữa */
    margin: 0 auto 15px auto !important;
    }
}
/* --- 8. Tương thích thiết bị di động (Responsive) --- */
@media (max-width: 768px) {
    .hero-banner {
        padding: 10px 0;
        min-height: 350px;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .style-render-content {
        font-size: 1rem;
    }
    
    .navbar-custom .navbar-brand {
        font-size: 1.2rem;
    }
}
/* ==========================================
   TÙY CHỈNH CHIỀU CAO BANNER TRANG CHỦ
========================================== */
#home {
    min-height: 50vh !important; /* Thay đổi thông số này. 50vh nghĩa là cao bằng 50% màn hình */
    padding-top: 20px !important; /* Giảm khoảng trống phía trên chữ */
    padding-bottom: 10px !important; /* Giảm khoảng trống phía dưới chữ */
    display: flex;
    align-items: center;
}

/* Thu nhỏ thêm một chút nữa trên giao diện điện thoại (nếu muốn) */
@media (max-width: 768px) {
    #home {
        min-height: 40vh !important; 
        padding-top: 60px !important;
        padding-bottom: 60px !important;
    }
}
/* ==========================================
   NÚT LIÊN HỆ NỔI GÓC TRÁI MÀN HÌNH
========================================== */
.floating-contact {
    position: fixed;
    bottom: 30px;      /* Cách đáy màn hình 30px */
    left: 20px;        /* Cách lề trái 20px */
    z-index: 9999;     /* Luôn nổi trên cùng */
    display: flex;
    flex-direction: column;
    gap: 15px;         /* Khoảng cách giữa nút Zalo và nút Điện thoại */
    align-items: flex-start;
}

/* 1. Nút Zalo */
.btn-zalo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: rgba(0, 136, 255, 0.5); /* Đổi thành RGBA (0.75 là độ mờ 75%) */
   /* backdrop-filter: blur(4px); /* Thêm hiệu ứng kính mờ cho nền phía sau */
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    animation: pulse-zalo 2s infinite;
    transition: transform 0.3s;
}
.btn-zalo:hover {
    transform: scale(1.1);
    background-color: rgba(0, 136, 255, 0.95); /* Khi di chuột vào sẽ rõ lên gần như cũ */
}
.zalo-text {
    color: white;
    font-weight: 900;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

/* 2. Nút Điện thoại */
.btn-phone {
    display: flex;
    align-items: center;
    background-color: rgba(147, 192, 45, 0.5); /* Đổi thành RGBA (0.75 là độ mờ 75%) */
   /* backdrop-filter: blur(4px); /* Thêm hiệu ứng kính mờ cho nền phía sau */
    border-radius: 30px;
    text-decoration: none;
    color: white;
    padding: 4px 15px 4px 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}
.btn-phone:hover {
    color: white;
    transform: scale(1.05);
    background-color: rgba(147, 192, 45, 0.95); /* Khi di chuột vào sẽ rõ lên gần như cũ */
}

.phone-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background-color: transparent;
    border-radius: 50%;
    font-size: 22px;
    animation: ring-phone 1.5s infinite; /* Hiệu ứng rung chuông */
}
.phone-number {
    font-size: 16px;
    font-weight: bold;
    margin-left: 5px;
    margin-right: 5px;
}

/* ==========================================
   HIỆU ỨNG CHUYỂN ĐỘNG CHO NÚT (ANIMATIONS)
========================================== */
/* Tỏa sóng màu xanh Zalo */
@keyframes pulse-zalo {
    0% { box-shadow: 0 0 0 0 rgba(0, 136, 255, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(0, 136, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 136, 255, 0); }
}

/* Rung chuông điện thoại */
@keyframes ring-phone {
    0% { transform: rotate(0); }
    10% { transform: rotate(30deg); }
    20% { transform: rotate(-28deg); }
    30% { transform: rotate(34deg); }
    40% { transform: rotate(-32deg); }
    50% { transform: rotate(30deg); }
    60% { transform: rotate(-28deg); }
    70% { transform: rotate(0); }
    100% { transform: rotate(0); }
}
/* Ép bảng phụ của TinyMCE luôn nổi trên Modal của Bootstrap */
.tox-tinymce-aux {
    z-index: 9999999 !important;
}
@media (min-width: 769px) {
    .btn-phone {
        display: none !important;
    }
}
/* Đẩy hộp thoại quản lý xuống dưới Navbar */
.modal-dialog {
    margin-top: 80px !important; 
}

/* Nếu bạn đang dùng Offcanvas thay vì Modal */
.offcanvas, .offcanvas-top {
    margin-top: 65px !important; 
}