/* ===== CART PAGE (REFINED & MODERN) ===== */

/* Base & Typography */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

body {
    background-color: #f8f9fc !important;
    background-image: none !important;
    font-family: 'Outfit', sans-serif !important;
    color: #334155;
    margin: 0;
    padding: 0;
}

.cart-section {
    padding-top: 140px;
    padding-bottom: 120px;
    min-height: 100vh;
    background-color: #f8f9fc;
    flex: 1 0 auto;
}

/* Hide Floating WhatsApp on Cart Page */
.btn-whatsapp-float, .float-btn {
    display: none !important;
}

/* Page Header */
.cart-page-header {
    margin-bottom: 32px;
    background: #fff;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid #edf2f7;
}

.cart-page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #2563eb;
    margin: 0;
    letter-spacing: -0.02em;
}

.cart-count-badge {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    font-size: 0.8rem;
    padding: 4px 14px;
    font-weight: 600;
}

.select-all-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    background: #f8f9fa;
    border: 1.5px solid #e2e8f0;
    padding: 8px 18px;
    border-radius: 50px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-all-wrapper:hover {
    background: #fff;
    border-color: #2563eb;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.select-all-wrapper input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: #2563eb;
}

/* Product Group Card */
.product-group-card {
    background: #fff;
    border-radius: 20px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.product-group-card:hover {
    box-shadow: 0 12px 30px rgba(0,0,0,0.07);
    transform: translateY(-2px);
}

.product-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: #fcfdfe;
    border-bottom: 1px solid #f1f5f9;
}

.product-group-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.product-group-thumb {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.product-group-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.product-group-subtotal {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2563eb;
    background: #eff6ff;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid #dbeafe;
}

.group-select-check {
    width: 20px; height: 20px;
    accent-color: #2563eb;
    cursor: pointer;
}

/* Original PC-Style Cart Item Row (Horizontal) */
.cart-item-row {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px 24px;
    background: #fff;
    border-bottom: 1px solid #f8fafc;
}

/* Flatten hierarchy on PC using display: contents */
.item-check-wrapper, 
.item-media-section, 
.item-details-right, 
.item-actions-row {
    display: contents; 
}

.item-check {
    width: 19px; height: 19px;
    accent-color: #2563eb;
}

.item-thumb {
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.item-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    flex: 1; /* Pushes other elements to the right on Desktop */
}

.item-price-row {
    min-width: 120px;
    text-align: right;
}

.item-price-current {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.qty-stepper {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    padding: 4px;
}

.qty-btn {
    width: 32px; height: 32px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-input {
    width: 40px;
    background: transparent;
    border: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.btn-remove-link {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #ef4444;
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove-link:hover {
    background: #ef4444;
    color: #fff;
}

/* Base Styles Continued... */
.order-summary-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    position: sticky;
    top: 100px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.order-summary-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
    color: #64748b;
}

.summary-row + .summary-row {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #edf2f7;
}

.summary-product-name {
    margin-bottom: 6px;
    line-height: 1.4;
}

.summary-product-val {
    font-weight: 700;
    color: #1e293b;
    font-size: 1rem;
}

.summary-divider {
    border: none;
    border-top: 1px dashed #e2e8f0;
    margin: 16px 0;
}

.summary-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 24px;
}

.summary-total-label {
    font-weight: 700;
    color: #1e293b;
}

.summary-total-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #2563eb;
}

.btn-checkout {
    background: #0d6efd;
    color: #fff !important;
    width: 100%;
    padding: 14px !important;
    border-radius: 12px;
    font-weight: 700;
    border: none;
    transition: all 0.2s;
}

.btn-checkout:hover {
    background: #0b5ed7;
    transform: translateY(-2px);
}

/* Mobile Sticky Checkout Bar (Always Blue) */
.mobile-checkout-bar {
    display: none;
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)); /* Sits above standard global nav */
    left: 0; right: 0;
    z-index: 999;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    height: 60px;
    padding: 0;
    align-items: stretch;
    justify-content: space-between;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

.checkout-bar-left {
    padding-left: 16px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.checkout-bar-right {
    display: flex;
    align-items: center;
}

.total-info-wrapper {
    display: flex;
    flex-direction: column;
    text-align: right;
    margin-right: 12px;
    justify-content: center;
}

.mob-total-label {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: -2px;
}

.mob-total-value {
    font-size: 1rem;
    font-weight: 700;
    color: #2563eb;
}

.btn-cart-checkout {
    background: #0d6efd;
    color: #fff !important;
    height: 100%;
    border: none;
    padding: 0 24px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}

/* Responsive Overrides - Preserve Vertical Shopee Layout on Mobile */
@media (max-width: 991.98px) {
    .order-summary-sidebar { display: none !important; }
    .mobile-checkout-bar { display: flex !important; }
    .cart-section { 
        padding-top: 130px !important; /* Proper gap from header */
        padding-bottom: 220px !important; 
    }

    /* Undo display: contents for Shopee Mobile View */
    .item-media-section { display: flex; gap: 12px; flex: 1; }
    .item-details-right { display: flex; flex-direction: column; justify-content: space-between; flex: 1; min-width: 0; }
    .item-actions-row { display: flex; justify-content: space-between; align-items: center; }
    
    .cart-item-row { padding: 12px 14px; gap: 10px; align-items: flex-start; }
    .item-check-wrapper { display: flex; align-items: center; padding-top: 20px; }

    .item-thumb { width: 75px; height: 75px; border-radius: 8px; }
    .item-name { 
        font-size: 0.8rem; 
        line-height: 1.25;
        -webkit-line-clamp: 2; line-clamp: 2;
        display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
        margin-bottom: 0px; /* Removed margin */
        flex: none; /* Undo PC flex-1 */
    }
    
    .item-price-row { text-align: left; min-width: 0; margin-bottom: 2px; }
    .item-price-current { color: #2563eb; font-size: 0.85rem; }

    .qty-stepper { scale: 0.8; transform-origin: left; border-radius: 4px; margin-top: -2px; }

    /* Shop/Group Header Mobile (Shopee Style) */
    .product-group-header { padding: 12px 16px; }
    .product-group-header .header-left { gap: 10px; }
    .product-group-thumb { width: 28px; height: 28px; border-radius: 6px; }
    .product-group-name { font-size: 0.9rem; flex: none; }
    .product-group-subtotal { display: none; } /* Match Shopee: Hide subtotal in header */
    .group-select-check { width: 18px; height: 18px; }
    
    .mob-total-value { color: #2563eb; }
}

/* Empty Cart View */
.empty-cart-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 140px 20px 80px;
    background-color: #f8f9fc;
}

.empty-cart-card {
    background: transparent;
    padding: 20px;
    border-radius: 0;
    box-shadow: none;
    text-align: center;
    max-width: 550px;
    width: 100%;
}

.empty-icon {
    font-size: 80px;
    color: #e2e8f0;
    margin-bottom: 24px;
    display: block;
}

.empty-cart-card h2 {
    font-weight: 800;
    font-size: 1.5rem;
    color: #0f172a;
    margin-bottom: 12px;
}

.empty-cart-card p {
    color: #64748b;
    margin-bottom: 32px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.btn-visit-product {
    background: #0d6efd;
    color: #fff !important;
    padding: 14px 32px;
    border-radius: 14px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
}

.btn-visit-product:hover {
    background: #0b5ed7;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.25);
}

@media (max-width: 576px) {
    .empty-cart-section { padding-top: 120px; }
    .empty-cart-card { padding: 40px 20px; }
    .empty-icon { font-size: 60px; }
    .empty-cart-card h2 { font-size: 1.25rem; }
}
