/* ================================================================== */
/* ==   PHIÊN BẢN CSS DI ĐỘNG HOÀN CHỈNH (ĐÃ SỬA LỖI CĂN GIỮA MODAL)  == */
/* ================================================================== */

/* Áp dụng cho màn hình có chiều rộng từ 800px trở xuống */
@media (max-width: 800px) {

    /* --- 1. BỐ CỤC & CHỮ VIẾT TOÀN TRANG --- */
    body {
        margin-top: 0 !important;
        padding: 0 10px;
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
    }

/* ==   2. THANH TÌM KIẾM (ĐÃ THU NHỎ)                    == */
/* ======================================================== */

.fixed-search {
    position: static !important;
    width: 100% !important;
    left: 0 !important;
    margin: 0 !important;
    padding: 10px 0; /* << GIẢM KHOẢNG ĐỆM DỌC */
    box-shadow: none !important;
    border-radius: 0 !important;
    background-color: transparent !important;
}

#searchForm {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    align-items: center; /* Căn giữa các mục bên trong theo chiều dọc */
}

/* Tinh chỉnh ô nhập liệu */
#searchQuery {
    flex-grow: 1;
    height: 40px; /* << Đặt chiều cao cụ thể */
    padding: 0 15px;
    font-size: 15px; /* << Giảm cỡ chữ một chút */
    /* Các thuộc tính khác về border, background... sẽ được kế thừa */
}

/* Đảm bảo các nút bấm bên trong thanh tìm kiếm cũng nhỏ lại */
#searchForm button {
    height: 40px;
    padding: 0 12px;
}
    /* --- 3. THANH MENU CHÍNH --- */
    

    /* --- 4. CÁC KHỐI THẺ (CARD) CHÍNH --- */
  
   /* ======================================================== */
/* ==   4. CÁC KHỐI THẺ SÁCH (LƯỚI 2 CỘT - PHIÊN BẢN CUỐI) == */
/* ======================================================== */

/* Dùng ID #cards-placeholder để đảm bảo độ ưu tiên cao nhất */
#cards-placeholder {
    display: grid !important; /* << ÉP BỐ CỤC LƯỚI */
    grid-template-columns: repeat(2, 1fr) !important; /* << ÉP 2 CỘT */
    gap: 15px; /* Khoảng cách giữa các sách */
    width: 100%;
    padding: 0;
}

/* Đảm bảo các card-container (item của lưới) hoạt động đúng */
.card-container {
    width: 100%;
    display: flex;
}

.card {
    width: 100% !important;
    margin: 0 !important;
    background-color: var(--card-bg-color);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Đảm bảo hình ảnh bên trong card cũng được bo góc */
.card .image-container img {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
    
    /* --- 5. CỬA SỔ POP-UP (MODAL) - ĐÃ CẬP NHẬT --- */
    /* Quy tắc chung cho lớp phủ nền mờ */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(5px);
        z-index: 9999;
        display: flex; /* << BẮT BUỘC: Kích hoạt Flexbox */
        justify-content: center; /* << BẮT BUỘC: Căn giữa theo chiều ngang */
        align-items: center; /* << BẮT BUỘC: Căn giữa theo chiều dọc */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    /* Khi modal được kích hoạt */
    .modal-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Quy tắc chung cho hộp modal bên trong */
    .modal {
        width: 95%;
        max-height: 90vh;
        transform: scale(0.9); /* Hiệu ứng phóng to khi hiện ra */
        transition: transform 0.3s ease;
    }
    .modal-overlay.active .modal {
        transform: scale(1);
    }

    .modal-header img {
        height: 150px;
        object-fit: cover;
    }
    .modal-actions {
        flex-direction: column;
        gap: 20px;
    }
    .modal-password-gate {
        align-items: center;
    }
    .modal-password-gate input[type="password"] {
        width: 80%;
    }

    /* --- 6. KHU VỰC BÌNH LUẬN --- */
    .comment-section-container {
        width: 95% !important;
        max-width: 100%;
        margin: 30px auto;
        padding: 15px;
    }
    .comment-form-container .form-group {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .comment-form-container input[type="text"],
    .comment-form-container textarea {
        width: 100%;
        font-size: 16px;
    }
    .comment-form-container button[type="submit"] {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        font-weight: bold;
    }
/* ======================================================== */
/* ==   21. SỬA LỖI NÚT XEM TRƯỚC & TẢI VỀ (DI ĐỘNG)       == */
/* ======================================================== */

.modal-actions {
    flex-direction: column; /* Xếp các nút theo chiều dọc */
    gap: 10px;              /* Tạo khoảng cách giữa 2 nút */
    align-items: stretch;   /* Kéo dài các nút cho bằng nhau */
    white-space: nowrap; 
    width: auto;
}
    /* --- 7. CÁC NÚT BẤM CỐ ĐỊNH & CHATBOX --- */
    #show-packages-button {
        bottom: 15px;
        left: 15px;
        padding: 12px 20px;
        font-size: 10px;
    }
    #chatbot-toggler {
        bottom: 15px;
        right: 15px;
    }
    .chatbot-popup {
        width: 100%; height: 100%;
        right: 0; bottom: 0;
        border-radius: 0;
    }
    
    /* --- 8. ẨN/DI CHUYỂN CÁC YẾU TỐ TRANG TRÍ --- */
    .toast, .HSK {
        display: none !important; 
    }
    .about-title {
        font-size: 3.5rem !important; 
        top: 5px;
    }
    
    /* --- 9. CHÂN TRANG (FOOTER) --- */
    .modern-footer .footer-container {
        flex-direction: column;
    }
    .modern-footer .footer-column {
        margin: 10px 0;
    }
    
    /* --- 10. TỐI ƯU LOGO --- */
    #displayed-image {
        display: none !important;
    }
    
    /* --- 11. BẢNG QUẢNG CÁO --- */
    /* ======================================================== */
/* ==   11. BẢNG PREMIUM (TINH CHỈNH LẦN CUỐI)             == */
/* ======================================================== */

.player-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.player-content {
    width: 100%;
    max-width: 98vw;
    height: auto;
    max-height: 95vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 15px 10px; /* << GIẢM PADDING DỌC */
    box-sizing: border-box;
}

.player-content h2 {
    font-size: clamp(1.2rem, 4.5vw, 1rem); /* << THU NHỎ CỠ CHỮ */
    text-align: center;
    margin-bottom: 8px;
}

.player-content .subtitle {
    font-size: clamp(0.8rem, 2.8vw, 0.9rem); /* << THU NHỎ CỠ CHỮ */
    text-align: center;
    margin-bottom: 20px;
}

.packages-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 8px; /* << GIẢM KHOẢNG CÁCH */
    width: 100%;
}

.package {
    flex: 1;
    min-width: 90px;
    display: flex;
    flex-direction: column;
    padding: 12px 8px; /* << GIẢM PADDING */
    text-align: center;
    border-radius: 12px;
}
.package .popular-tag {
    font-size: 11px;       /* << Giảm cỡ chữ */
    padding: 3px 8px;      /* << Giảm khoảng đệm */
    white-space: nowrap;   /* << Ngăn chữ xuống dòng */
    align-self: center;    /* Căn thẻ ra giữa gói */
    margin-bottom: 8px;    /* Tạo khoảng cách với giá tiền */
}

.package h3 {
    font-size: clamp(0.85rem, 3vw, 1rem); /* << THU NHỎ CỠ CHỮ */
    min-height: 35px;
}

.package .price {
    font-size: clamp(1rem, 5vw, 2rem); /* << THU NHỎ CỠ CHỮ */
    margin: 8px 0;
}

.package ul {
    list-style: none;
    padding: 0;
    margin: 8px 0;
    flex-grow: 1;
     text-align: left;     /* << Căn trái các mục trong danh sách */
      /* Thêm một chút thụt lề để không bị sát cạnh */
}

.package ul li {
    font-size: clamp(0.65rem, 2.3vw, 0.75rem); /* << THU NHỎ CỠ CHỮ */
    margin-bottom: 6px;
    line-height: 1.3;
     
}

.package .btn {
    padding: 8px; /* << THU NHỎ NÚT BẤM */
    font-size: clamp(0.75rem, 2.8vw, 0.85rem); /* << THU NHỎ CỠ CHỮ */
    width: 100%;
}

.package .package-button {
    padding: 8px 10px;      /* << Giảm khoảng đệm */
    font-size: 10px;        /* << Giảm cỡ chữ */
    font-weight: bold;      /* Giữ chữ đậm để dễ nhìn */
}
    /* --- 13. NÚT NGÔN NGỮ --- */
    .language-switcher {
        display: none !important;
    }

    /* --- 14. MODAL QUÉT QR --- */
    #qr-scanner-fab {
        display: flex;
        position: fixed;
        bottom: 15px;
        right: 85px;
        width: 50px;
        height: 50px;
        background-color: #00bcd4;
        color: white;
        border: none;
        border-radius: 50%;
        justify-content: center;
        align-items: center;
        font-size: 22px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        cursor: pointer;
        z-index: 1500;
        transition: all 0.3s ease;
    }
    #qr-scanner-fab:hover {
        transform: scale(1.1);
        background-color: #0097a7;
    }
    body.dark-theme #qr-scanner-fab {
        background-color: #00ff9d;
        color: #121212;
    }
    
    /* Tùy chỉnh riêng cho modal camera */
    #qr-reader.modal {
        height: 60vh;
        max-height: 700px;
        background: #111;
        padding: 0;
        position: relative;
    }

    #qr-reader video {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        position: absolute;
        top: 0;
        left: 0;
        border-radius: 16px;
    }
    #qr-reader-close-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 2;
    }
    #qr-reader-status {
        position: absolute;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 2;
        background-color: rgba(0, 0, 0, 0.75);
        color: white;
        padding: 10px 20px;
        border-radius: 8px;
        font-size: 14px;
        text-align: center;
        white-space: nowrap;
    }

/* ======================================================== */
/* ==   16. THU NHỎ NÚT DARK MODE (ĐÃ SỬA LẠI TÊN ID)      == */
/* ======================================================== */

#theme-toggle { /* << SỬA LẠI TÊN ID CHO ĐÚNG */
    width: 30px !important;
    height: 30px !important;
    font-size: 18px !important;
}

/* ======================================================== */
/* ==   17. ẨN MÔ TẢ NGẮN TRONG CARD SÁCH (DI ĐỘNG)        == */
/* ======================================================== */

.card-content p {
    display: none;
}
 .card-content {
    height:auto;
 }














    
} /* Dấu ngoặc đóng của @media (max-width: 800px) */


/* ======================================================== */
/* ==   15. ẨN NÚT QUÉT QR TRÊN PHIÊN BẢN MÁY TÍNH         == */
/* ======================================================== */
@media (min-width: 801px) {
    #qr-scanner-fab {
        display: none !important;
    }
}