/* ==== SỬA LỖI TRÀN NGANG CẤP ĐỘ TRANG ==== */
body,
html {
    overflow-x: hidden; /* NGĂN CHẶN LỖI TRÀN NGANG TOÀN BỘ TRANG */
}

/* ==== Font tổng ==== */
.book-detail {
    font-family: "Poppins", sans-serif;
    padding: 20px 100px;
    overflow: hidden; /* Ngăn chặn lỗi tràn cục bộ bên trong chi tiết sách */
}

/* ==== Row chính (Chứa 3 cột) ==== */
/* Giữ nguyên cấu trúc row/col của Bootstrap */
.book-detail .row {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-left: -15px;
    margin-right: -15px;
}

.book-detail .col-md-4,
.book-detail .col-md-5,
.book-detail .col-md-3 {
    padding-left: 15px;
    padding-right: 15px;
}

/* ==== CỘT 1: ẢNH SÁCH ==== */
.col-md-4 {
    flex-shrink: 0 !important;
}
.main-book-image {
    border: 1px solid #ddd;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    width: 100%;
    /* Dùng max-height để giới hạn kích thước khung */
    max-height: 440px;
    box-sizing: border-box;
}

.main-img {
    width: 100%;
    /* TỐI ƯU: Dùng auto và max-height để giữ tỷ lệ */
    height: auto;
    max-height: 420px;
    object-fit: contain; /* Đảm bảo ảnh hiển thị toàn bộ */
}

/* ==== CỘT 2: THÔNG TIN ==== */
.col-md-5 {
    flex-grow: 1;
}
.book-title {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 10px;
}

.author {
    font-size: 16px;
    color: #777;
    margin-bottom: 15px;
}

/* Giá bán */
.price-box {
    margin-bottom: 15px;
}

.current-price {
    font-size: 28px;
    font-weight: bold;
    color: #d10000;
}

/*.old-price {*/
/*    text-decoration: line-through;*/
/*    margin-left: 12px;*/
/*    color: #888;*/
/*}*/

/*.discount {*/
/*    background: #ff6600;*/
/*    color: #fff;*/
/*    padding: 4px 8px;*/
/*    border-radius: 4px;*/
/*    margin-left: 10px;*/
/*}*/

/* Khung mô tả sách */
.description-box {
    background: #fff4e6;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ffd9b3;
    max-height: 180px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.description-box h4 {
    font-size: 17px;
    margin-bottom: 10px;
    text-align: justify;
}

.description-box p {
    font-size: 15px;
    color: #555;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: justify;
    word-break: break-word;
    hyphens: auto
}

/* ==== SỬA CHỮA: NÚT SỐ LƯỢNG LIỀN MẠCH VÀ ĐẸP HƠN ==== */
.quantity-box {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
/* Tạo class bao bọc nếu HTML cho phép */
.quantity-box .quantity-selector {
    display: flex;
    border: 1px solid #bbb;
    border-radius: 4px;
    overflow: hidden;
}

.qty-btn,
.qty-input {
    width: 35px;
    height: 35px;
    background: #fff;
    font-size: 16px;
    line-height: 1;
    text-align: center;
    padding: 0;
    box-sizing: border-box;
    cursor: pointer;
    border: none;
    border-radius: 0;
}

.qty-input {
    width: 45px;
    cursor: default;
    outline: none;
    font-weight: 600;
    border-left: 1px solid #bbb;
    border-right: 1px solid #bbb;
}

.qty-btn:hover {
    background: #f0f0f0;
}

/* Nút mua */
/* Added button-group styling and improved button design */
.button-group {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

.btn-add-cart,
.btn-buy-now {
    flex: 1;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Updated button colors - green for both with different styles */
.btn-add-cart {
    background-color: #388e3c;
    color: white;
    border: 2px solid #388e3c;
}

.btn-add-cart:hover {
    background-color: #2c6f3b;
    border-color: #2c6f3b;
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(56, 142, 60, 0.3);
}

/* Buy now button with gradient */
.btn-buy-now {
    background: linear-gradient(135deg, orangered 0%, chocolate 100%);
    color: white;
    border: 2px solid orangered;
}

.btn-buy-now:hover {
    background: linear-gradient(135deg, orange 0%, orange 100%);
    border-color: orange;
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(56, 142, 60, 0.4);
}

/* Fix form to display properly inside button-group */
.button-group form {
    flex: 1;
    display: flex;
    padding: 0;
    margin: 0;
}

.button-group form button {
    flex: 1;
    width: 100%;
}


/* ==== CỘT 3: BẢNG THÔNG TIN (FIX Lỗi Mất Viền & Tối Ưu) ==== */
.col-md-3 {
    flex-shrink: 0;
}
.publisher-box {
    border: none;
    padding: 0;
    background: none;
    border-radius: 6px;
    width: 100%;
    overflow-x: auto;
}

.publisher-box table {
    min-width: 300px;
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.publisher-box th,
.publisher-box td {
    border-top: 1px solid #ddd;
    border-right: 1px solid #ddd;
    border-bottom: none;
    border-left: none;
    padding: 8px;
    font-size: 15px;
    white-space: nowrap;
}

.publisher-box td:last-child,
.publisher-box th:last-child {
    border-right: none;
}

.publisher-box tr:first-child th,
.publisher-box tr:first-child td {
    border-top: none;
}

.publisher-box th {
    background-color: #f7f7f7;
    text-align: left;
    width: 40%;
}

/* ==== PHẦN ĐÁNH GIÁ - NẰM DƯỚI TẤT CẢ ==== */
/* Tách riêng phần rating và ngăn chặn overflow khi expand */
.rating-container {
    width: 100%;
    box-sizing: border-box;
    margin-top: 40px;
    margin-bottom: 40px;
    padding: 20px 100px;
    overflow-x: hidden; /* NGĂN CHẶN SCROLL NGANG */
    overflow-y: auto;
    max-width: 100%;
}

.rating-summary {
    background: linear-gradient(135deg, #f5f5f5 0%, #fafafa 100%);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid lawngreen;
}

.rating-summary .mr-3 {
    margin-right: 30px;
}

.stars {
    display: inline-flex;
    gap: 4px;
}

.progress {
    background-color: #e9ecef !important;
}

.progress-bar {
    background-color: seagreen !important;
}

/* Log đánh giá */
#reviewLog {
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* NGĂN CHẶN SCROLL NGANG TRONG LOG */
}

.review-item {
    background: #fff;
    border: 1px solid #e9ecef !important;
    border-radius: 8px;
    padding: 16px !important;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
}

.review-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: greenyellow !important;
}

.review-item p {
    line-height: 1.6;
    color: #333;
    margin-bottom: 12px;
}

/* Button toggle */
#toggleReviewLog {
    border: 2px solid #ff7b00 !important;
    color: #ff7b00;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#toggleReviewLog:hover {
    background-color: lawngreen;
    color: #fff;
}

.review-hidden {
    display: none;
}
/*LOAD REVIEW BTN*/
/* Nút Load More đẹp */
.btn-load-more {
    width: 20%;
    padding: 10px 0;
    margin-top: 15px;

    background: darkgreen;
    border: 1px solid lawngreen;
    color: white;

    font-size: 15px;
    font-weight: 500;
    border-radius: 10px;

    cursor: pointer;
    transition: 0.25s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-load-more:hover {
    background: darkseagreen;
    border-color: darkseagreen;
}

.btn-load-more:active {
    background: #e2e2e2;
    transform: scale(0.98);
}

.btn-load-more.hidden {
    display: none;
}

/* Responsive ==== */


/* Màn hình Medium (>= 768px): Giữ 3 cột cố định */
@media (min-width: 768px) {
    .book-detail .row {
        flex-wrap: nowrap !important;
    }

    .col-md-4 {
        flex-shrink: 0;
    }
}

/* Màn hình nhỏ (Mobile/Tablet) */
@media (max-width: 767px) {
    .book-detail .row {
        flex-wrap: wrap;
    }

    .book-detail .col-md-4,
    .book-detail .col-md-5,
    .book-detail .col-md-3 {
        width: 100%;
        max-width: 100%;
        flex-shrink: 1;
        padding-left: 15px;
        padding-right: 15px;
    }

    .main-book-image {
        max-width: 100%;
        margin: 0 auto;
    }

    /* Đảm bảo rating container responsive trên mobile */
    .rating-container {
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
    }

    #reviewLog {
        overflow-x: hidden;
    }

    .review-item {
        padding: 12px !important;
    }
}

/* =========================================================
   FOOTER
   ========================================================= */
#footer {
    background: linear-gradient(135deg, #0B3D2E 0%, seagreen 100%);
    color: #fff;
    padding: 15px 10px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1300px;
    margin: 0 auto 20px auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 120px;
}

.footer-about-text {
    text-align: justify;
}


.footer-column {
    text-align: left;
}

.footer-column h4 {
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    /* Giữ nguyên font của body (Open Sans) được kế thừa */
}

.footer-column p,
.footer-column ul li a {
    font-size: 0.75rem;
    line-height: 1.4;
    color: #fff;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column ul li {
    margin-bottom: 6px;
}

.footer-column ul li a:hover {
    color: #ffd700 !important;
}

.contact-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    font-size: 0.75rem;
}

.contact-info i {
    font-size: 1rem;
    color: #ffd700;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 10px;
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.8;
}


/*Cột 2&3*/
.footer-contact {
    display: flex;
    flex-direction: column;
    height: 130px; /* điều chỉnh để các dòng cách đều */
    justify-content: space-between;
}

.footer-contact .contact-hours {
    margin: 0;
    color: #ccc;
    font-size: 14px;
}

.footer-contact .contact-info,
.footer-contact .contact-info a {
    display: flex;
    align-items: center;  /* căn icon + text theo chiều dọc */
    gap: 6px;             /* khoảng cách icon và text */
    color: #ccc;
    font-size: 14px;
    text-decoration: none;
}

.footer-contact .contact-info a:hover {
    color: #ccc;
}


.footer-contact .contact-icon {
    width: 30px; /* kích thước icon */
    height: 30px;
    margin-right: 6px; /* khoảng cách giữa icon và text */
}

.footer-contact .contact-info,
.footer-contact .contact-info a {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 14px;
    color: #ccc;           /* màu giống các dòng khác */
    text-decoration: none;  /* bỏ gạch chân */
}

.footer-contact .contact-info a:hover {
    color: #ccc;           /* hover cũng giữ màu đồng bộ */
}