/* =========================================
   1. CORE VARIABLES & BASE
   ========================================= */
:root {
    --primary: #004aad;
    --accent: #FFA726;
    --text-main: #000;
    --text-muted: #666;
    --border-color: #eee;
}

body { background-color: #fff; }

/* =========================================
   2. COMMON STYLES (Shared)
   ========================================= */
.cart-title {
    padding-top: 40px;
    color: var(--accent);
    font-weight: 800;
    margin-bottom: 40px;
    text-align: center;
    font-size: clamp(32px, 4vw, 48px);
}

.action-group {
    display: flex; align-items: center; gap: 15px; 
    white-space: nowrap;
}
.btn-edit {
    color: var(--text-main); text-decoration: none; font-size: 1rem; 
    font-weight: 500; display: flex; align-items: center; gap: 5px;
}
.btn-delete {
    color: #333; font-size: 1.2rem; cursor: pointer; transition: 0.2s;
}
.btn-delete:hover { color: #dc3545; }

/* Footer */
.cart-footer {
    margin-top: 50px; padding-top: 30px;
    display: flex; align-items: center;
}
.btn-request-quote {
    background-color: #b00020; color: white; font-weight: 500;
    border-radius: 8px; border: none; transition: 0.3s; cursor: pointer;
}
.btn-request-quote:hover { background-color: #8a0019; }

.empty-cart-container {
    padding-top: 60px;
    padding-bottom: 80px;
}

/* รูปตะกร้า */
.empty-cart-icon {
    width: 397px; /* ปรับขนาดตามความเหมาะสม */
    height: auto;
    opacity: 0.8; /* ทำให้สีเทาดูจางลงเล็กน้อยตามรูป */
}

/* ข้อความ */
.empty-cart-text {
    font-size: 25px; /* ตามที่กำหนด */
    font-weight: 800; /* bold */
    margin-top: 40px;
    color: var(--text-main); /* หรือสีดำ #000 ตามรูป */
}

/* ปุ่มเลือกซื้อสินค้า */
.btn-shop-now {
    background-color: #FFA726 !important; /* สีส้มตามที่กำหนด */
    color: #000 !important; /* ตัวหนังสือสีดำ */
    font-size: 20px !important; /* ขนาด 20px */
    font-weight: 500 !important; /* normal (500 กำลังดีสำหรับปุ่ม) */
    padding: 10px 30px;
    border-radius: 8px;
    border: none;
    transition: 0.3s;
    margin-top: 40px;
}

.btn-shop-now:hover {
    background-color: #e69520 !important; /* สีเข้มขึ้นตอน Hover */
    color: #000 !important;
}
/* =========================================
   3. LAPTOP & SMALL DESKTOP (992px - 1399px)
   ✅ MacBook Air (13"), Laptop
   ✅ สถานะ: ปกติ (ห้ามแก้)
   ========================================= */
@media (min-width: 992px) and (max-width: 1399px) {
    .container {
        max-width: 94% !important;
        margin-left: auto !important; margin-right: auto !important;
        padding-left: 15px; padding-right: 15px;
    }
    .header-product { padding-right: 0; text-align: center; }
    .header-detail { padding-left: 0; margin-left: 0; text-align: center; }
    .cart-item-row { border-bottom: 1px solid var(--border-color); padding: 25px 0; }
    .col-img-wrapper { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; }
    .custom-checkbox {
        width: 30px; height: 30px; border: 1px solid #ccc; border-radius: 4px;
        cursor: pointer; display: flex; align-items: center; justify-content: center;
        position: absolute; left: 0px; z-index: 10;
    }
    .custom-checkbox i { display: none; font-size: 18px; }
    .custom-checkbox.checked { background-color: var(--primary); border-color: var(--primary); color: white; }
    .custom-checkbox.checked i { display: block; }
    .product-img-frame {
        width: 130px; height: 95px; border: 1px solid #f0f0f0; overflow: hidden;
        display: flex; align-items: center; justify-content: center;
        background-color: #fff; margin-right: 0; 
    }
    .product-thumb { width: 100%; height: 100%; object-fit: contain; }
    .col-detail-wrapper { margin-left: 0; padding-left: 15px; }
    .detail-box {
        border: 1px solid #e0e0e0; border-radius: 6px; padding: 12px;
        color: var(--text-muted); font-size: 0.9rem; background-color: #fff;
        line-height: 1.5; min-height: 80px; width: 100%;
    }
    .product-name-header { font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
    .action-group { margin-left: 15px; }
    .cart-footer { justify-content: flex-start; gap: 30px; }
    .total-items-text { font-size: 1.3rem; font-weight: 800; color: var(--text-main); }
    .btn-request-quote { padding: 10px 25px; font-size: 1.1rem; }
}


/* =========================================
   4. LARGE DESKTOP (Screen >= 1400px)
   ✅ จอใหญ่: Design เดิม (Overlap)
   ========================================= */
@media (min-width: 1400px) {
    .header-product { padding-right: 35px; text-align: center; }
    .header-detail { padding-left: 0; margin-left: -50px; text-align: center; }
    .cart-item-row { border-bottom: 1px solid var(--border-color); padding: 30px 0; }
    .col-img-wrapper { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; }
    .custom-checkbox {
        width: 34px; height: 34px; border: 1px solid #ccc; border-radius: 4px;
        cursor: pointer; display: flex; align-items: center; justify-content: center;
        position: absolute; left: 20px; z-index: 10;
    }
    .custom-checkbox i { display: none; font-size: 22px; }
    .custom-checkbox.checked { background-color: var(--primary); border-color: var(--primary); color: white; }
    .custom-checkbox.checked i { display: block; }
    .product-img-frame {
        width: 163px; height: 108px; border: 1px solid #f0f0f0; overflow: hidden;
        display: flex; align-items: center; justify-content: center;
        background-color: #fff; flex-shrink: 0;
        margin-right: -35px;
    }
    .product-thumb { width: 100%; height: 100%; object-fit: contain; }
    .col-detail-wrapper { margin-left: -50px; padding-left: 15px; } 
    .product-name-header { font-size: 16px; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
    .detail-box {
        border: 1px solid #e0e0e0; border-radius: 6px; padding: 15px;
        color: var(--text-muted); font-size: 0.9rem; background-color: #fff;
        line-height: 1.6; min-height: 80px; width: 100% !important;
    }
    .action-group { margin-left: 20px; }
    .cart-footer { justify-content: flex-start; gap: 105px; }
    .total-items-text { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }
    .btn-request-quote { padding: 10px 40px; font-size: 1.2rem; }

    .choices.is-invalid .choices__inner {
    border-color: #dc3545 !important;
    background-image: none; /* ลบ icon default ถ้ามี */
    }
}


/* =========================================
   5. MOBILE & TABLET (iPad, Galaxy Fold, iPhone)
   ✅ แก้ไข: เพิ่มความสูงขั้นต่ำ (min-height) ให้ Detail Box
   ✅ แก้ไข: ขยาย Container ใน Tablet ให้กว้างขึ้น ไม่ดูลีบ
   ========================================= */
@media (max-width: 991.98px) {
    
    /* 1. ขยาย Container ให้เต็มจอ Tablet (แก้ปัญหาดูลีบด้านข้าง) */
    .container {
        max-width: 100% !important;
        padding-left: 15px; padding-right: 15px;
    }

    /* 2. ซ่อนเส้น <hr> */
    hr, .container hr, body hr { 
        display: none !important; border: none !important;
        height: 0 !important; margin: 0 !important;
        opacity: 0 !important; visibility: hidden !important;
    }

    /* --- Headers --- */
    .header-product, .header-detail {
        display: block !important; float: left !important;
        font-weight: normal; color: #888; font-size: 0.95rem;
        padding-bottom: 10px; margin-bottom: 15px;
        background-color: transparent !important;
        border-bottom: 1px solid #eee; 
    }

    .header-product {
        width: 140px !important; 
        margin-left: 10px !important; 
        text-align: center !important; 
        padding-right: 0 !important; margin-right: 0 !important;
    }

    .header-detail {
        width: calc(100% - 150px) !important; 
        margin-left: 0 !important; margin-right: 0 !important;
        padding-left: 125px !important; 
        text-align: left !important;
    }

    /* --- Items Row --- */
    .cart-item-row {
        margin-left: 0 !important; margin-right: 0 !important; /* ปรับให้เต็มขอบ */
        padding: 20px 0; border-bottom: 1px solid #eee;
        display: flex; flex-direction: row; flex-wrap: nowrap; align-items: flex-start;
        clear: both;
    }

    /* Left: Checkbox + Image */
    .col-img-wrapper {
        width: 115px !important; min-width: 115px; flex-shrink: 0;
        display: flex; flex-direction: row; align-items: flex-start; justify-content: flex-start;
        margin-right: 15px;
    }

    .custom-checkbox {
        position: relative; left: auto;
        width: 19px; height: 19px; border: 1px solid #ccc; border-radius: 4px;
        margin-right: 10px; margin-top: 30px; flex-shrink: 0;
        display: flex; align-items: center; justify-content: center;
    }
    .custom-checkbox i { font-size: 13px; display: none; }
    .custom-checkbox.checked { background-color: var(--primary); border-color: var(--primary); }
    .custom-checkbox.checked i { display: block; color: white; }

    .product-img-frame { width: 84px; height: 84px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
    .product-thumb { width: 100%; height: 100%; object-fit: contain; }

    /* Right: Details */
    .col-detail-wrapper {
        flex: 1; width: auto; display: flex; flex-direction: column;
        margin-left: 0 !important; padding-left: 0 !important;
    }

    .product-name-header { font-size: 14px; margin-bottom: 5px; text-align: left; font-weight: normal; }
    
    /* 🔥 FIX DETAIL BOX: เพิ่ม min-height และ Flex เพื่อจัดกลาง */
    .detail-box {
        width: 380% !important; 
        padding: 12px; 
        font-size: 0.85rem;
        border: 1px solid #e0e0e0; border-radius: 0 !important; color: var(--text-muted);
        
        /* จุดที่เพิ่ม: บังคับความสูงขั้นต่ำเหมือน Laptop */
        min-height: 90px; 
        
        /* จัดข้อความให้อยู่กลางแนวตั้ง กรณีข้อความสั้น */
        display: flex; 
        flex-direction: column; 
        justify-content: center; 
    }

    .action-group { width: 100%; justify-content: flex-end; margin-top: 8px; margin-left: 0; }

    /* Footer */
    .cart-footer {
        flex-direction: column; gap: 15px; align-items: center; text-align: center; margin-top: 0; padding-top: 20px; clear: both;
    }
    .total-items-text { font-size: 14px; font-weight: normal; width: 100%; text-align: start; margin-left: 10px; }
    .btn-request-quote { width: 100%; max-width: 300px; font-size: 18px; padding: 10px; }
}
@media (max-width: 576px) {
    .empty-cart-icon {
        width: 237px;
    }
    .empty-cart-text {
        font-size: 22px;
    }
    .btn-shop-now {
        font-size: 18px !important;
        padding: 8px 25px;
    }
}
/* =========================================
   6. SMALL MOBILE (iPhone SE, Fold Cover)
   ========================================= */
@media (max-width: 380px) {
    .header-product { width: 110px !important; margin-left: 5px !important; }
    .header-detail { width: calc(100% - 120px) !important; padding-left: 100px !important; }
    .col-img-wrapper { width: 100px !important; min-width: 100px; margin-right: 10px; }
    .product-img-frame { width: 70px; height: 70px; }
    .custom-checkbox { margin-top: 25px; }
}