/* ==========================================================================
   FILE CSS RIÊNG BIỆT CHO TRANG CHI TIẾT SẢN PHẨM & CÁC KHUNG HỘP HỖ TRỢ
   ========================================================================== */

/* 1. KHÔNG GIAN BỐ CỤC CHÍNH */
.product-detail-container {
    margin-top: 60px;
    margin-bottom: 80px;
    outline: none !important;
}

/* ĐÃ FIX: Xóa dấu phẩy thừa để tránh ép thuộc tính nhầm lên khối bao ngoài .product-gallery */
.product-gallery .main-image img {
    width: 100%;
    height: 450px;
    /* ĐÃ CẬP NHẬT: Định chiều cao cố định để ảnh Sofa cân đối, không bị kéo dài */
    border: 1px solid #eaeaea;
    object-fit: cover;
    /* Giữ nguyên tỉ lệ ảnh không bị móp hay méo hình */
}

.thumbnail-list {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.thumbnail-list img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.thumbnail-list img.active,
.thumbnail-list img:hover {
    border-color: var(--primary-color);
}

/* ĐÃ FIX: Mở lại Flexbox và xóa width: 100% để cột thông tin hoạt động mượt mà với col-lg-6 của Bootstrap */
.product-info-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-left: 20px;
    /* Tạo khoảng trống đệm giữa ảnh lớn và cột chữ bên phải */
}

.product-title {
    font-size: 32px;
    color: #222;
    margin-bottom: 15px;
    font-weight: 700;
}

.product-price {
    font-size: 26px;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 25px;
}

.product-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 30px;
}

/* =========================================================
   SỬA LỖI LỆCH TÊN VÀ GIÁ Ở KHỐI "SẢN PHẨM TƯƠNG TỰ"
   ========================================================= */
.product-info {
    display: flex;
    justify-content: space-between;
    align-items: center !important;
    /* Ép tên và giá căn giữa đều nhau theo chiều dọc */
    margin-top: 10px;
}

.product-info .product-name {
    margin-bottom: 0 !important;
    /* Xóa khoảng trống thừa ở đáy của thẻ H4 */
    font-size: 16px;
    line-height: 1;
}

.product-info .product-price {
    margin-bottom: 0 !important;
    font-size: 15px;
    line-height: 1;
}

/* 2. ĐỊNH DẠNG CÁC TÙY CHỌN SẢN PHẨM */
.option-group {
    margin-bottom: 25px;
}

.option-label {
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
    color: #333;
}

.color-options {
    display: flex;
    gap: 15px;
}

.color-box {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-brown {
    background-color: #a87b61;
}

.color-black {
    background-color: #1a1a1a;
}

.color-cream {
    background-color: #f3eae1;
    border: 1px solid #ddd;
}

.color-box.active,
.color-box:hover {
    transform: scale(1.1);
    border-color: #222;
}

.spec-tags {
    display: flex;
    gap: 15px;
}

.spec-tag {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.spec-tag.active,
.spec-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: #fbf9f8;
}

/* 3. BỘ ĐIỀU KHIỂN SỐ LƯỢNG & NÚT MUA */
.purchase-group {
    display: flex;
    gap: 15px;
    /* align-items: center;
    margin-top: 15px;
    margin-bottom: 40px;*/
    flex-wrap: wrap;
}

.quantity-wrapper {
    display: flex;
    border: 1px solid #ddd;
    background: #fff;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.qty-btn:hover {
    background-color: #f0f0f0;
}

.qty-input {
    width: 50px;
    height: 40px;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    font-size: 16px;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.add-to-cart-btn {
    flex: 1;
    height: 40px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.add-to-cart-btn:hover {
    background-color: #8f654d;
    transform: translateY(-2px);
}

.technical-specs {
    border-top: 1px dashed #ddd;
    padding-top: 25px;
}

.technical-specs h4 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #333;
}

.technical-specs ul li {
    margin-bottom: 8px;
    font-size: 15px;
    list-style: disc;
    margin-left: 20px;
}

/* ==========================================================================
   HỖ TRỢ TV4: CSS KHUNG HỘP GIỎ HÀNG (QUY CÁCH VUÔNG VỨC)
   ========================================================================== */
.cart-section {
    border-top: 2px solid #eaeaea;
    padding-top: 60px;
    margin-bottom: 80px;
}

.cart-section-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.cart-container {
    display: flex;
    gap: 40px;
}

.cart-items {
    /* flex: 2; */
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    background: #fff;
    margin-bottom: 15px;
}

.cart-item img {
    width: 90px;
    height: 90px;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
}

.cart-item-details h4 {
    font-size: 18px;
    margin-bottom: 5px;
}

.cart-item-details p {
    color: #777;
    font-size: 14px;
}

.cart-item-price {
    font-weight: bold;
    color: #222;
}

.remove-item-btn {
    border: none;
    background: none;
    color: #ff4d4d;
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.2s;
}

.remove-item-btn:hover {
    transform: scale(1.1);
}

/* Khung hộp tính toán hóa đơn vuông vức sắc nét theo yêu cầu */
.cart-summary-box {
    flex: 1;
    border: 2px solid #222;
    padding: 30px;
    background-color: #fff;
    height: fit-content;
    width: 100%;
}

.cart-summary-box h3 {
    font-size: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 15px;
}

.summary-divider {
    border: none;
    border-top: 1px solid #ddd;
    margin: 15px 0;
}

.total-row {
    font-weight: bold;
    font-size: 18px;
}

.total-price {
    color: var(--primary-color);
}

.checkout-btn {
    width: 100%;
    padding: 15px;
    background-color: #222;
    color: #fff;
    border: none;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

.checkout-btn:hover {
    background-color: var(--primary-color);
}

/* ==========================================================================
   HỖ TRỢ TV4: CSS POPUP FORM ĐĂNG NHẬP / ĐĂNG KÝ VUÔNG VỨC
   ========================================================================== */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Kích hoạt Modal hiển thị bằng cơ chế CSS Target */
.auth-modal:target {
    opacity: 1;
    pointer-events: auto;
}

.auth-box {
    background-color: #fff;
    border: 2px solid #222;
    /* Khung hộp vuông vức, sắc cạnh */
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    text-decoration: none;
    color: #333;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 30px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
}

.auth-tab.active {
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    outline: none;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: #222;
}

.auth-action-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 25px;
}

.forgot-pass {
    color: var(--primary-color);
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background-color: #222;
    color: #fff;
    border: none;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.3s;
}

.auth-submit-btn:hover {
    background-color: var(--primary-color);
}

.cart-container {
    gap: 30px;
}

/* ==========================================================================
   CSS CHO PHẦN THÔNG TIN Ở GIỮA (CHI TIẾT, ĐÁNH GIÁ, FORM BÌNH LUẬN)
   ========================================================================== */

/* Danh sách thông số kỹ thuật */
.spec-list li {
    font-size: 15px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 8px;
}

.spec-list li:last-child {
    border-bottom: none;
}

/* Avatar và Form đánh giá */
.bg-brown {
    background-color: var(--primary-color) !important;
}

.star-rating-input i {
    cursor: pointer;
    transition: color 0.2s;
}

.star-rating-input i:hover {
    color: #ffc107;
    /* Đổi màu vàng khi rê chuột vào sao */
}

.comment-form-wrap textarea {
    resize: none;
    background-color: #f3f3f3 !important;
    border-radius: 8px;
}

.comment-form-wrap button {
    transition: opacity 0.3s;
}

.comment-form-wrap button:hover {
    opacity: 0.8;
}

/* =========================================================
   TỐI ƯU HÓA UX HIỆN ĐẠI: CHỐNG BÔI ĐEN VÀ HIỆN DẤU " | " CHO TOÀN BỘ WEBSITE
   ========================================================= */

/* 1. Các thành phần tương tác ở trang sản phẩm (Màu sắc, kích thước, sao đánh giá, thả tim...) */
.thumbnail-list img,
.color-box,
.spec-tag,
.star-rating-input,
.star-rating-input i,
.heart-icon {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    cursor: pointer !important;
}

/* 2. Toàn bộ các loại Nút bấm, Mũi tên trượt, Tab đăng nhập và Icon điều khiển */
button,
.btn,
.qty-btn,
.add-to-cart-btn,
.arrow-btn,
.gallery-arrow,
.prev-arrow,
.next-arrow,
.auth-tab,
.close-modal-btn,
.back-to-top {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* 3. Ngăn thao tác click giữ và kéo thả (drag) làm hỏng bố cục ảnh */
.main-image img,
.product-img-wrap img {
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-user-drag: none !important;
}

/* =========================================================
   CSS CHO NÚT TRƯỢT ẢNH SẢN PHẨM (MAIN GALLERY)
   ========================================================= */
.main-image {
    position: relative;
    /* Giữ mũi tên không bị văng ra ngoài ảnh */
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.7);
    /* Nền trắng hơi trong suốt */
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    font-size: 16px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10;
    user-select: none;
}

.gallery-arrow:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.prev-arrow {
    left: 15px;
    /* Cách mép trái */
}

.next-arrow {
    right: 15px;
    /* Cách mép phải */
}

/* =========================================================
   SỬA LỖI NÚT TRƯỢT BỊ CẮT XÉN Ở PHẦN SẢN PHẨM TƯƠNG TỰ
   ========================================================= */
.related-products.product-category {
    overflow: visible !important;
    /* Tắt tính năng cắt viền */
    padding-top: 15px;
    /* Đẩy khối này xuống một chút để nút có không gian "thở" */
}

/* Đảm bảo khung lưới bên dưới vẫn cuộn mượt mà không bị lố ra ngoài */
.related-products .product-grid {
    overflow-x: auto;
    overflow-y: hidden;
    padding-top: 5px;
}