/* 1. Base Cart Layout (Desktop: 2 Columns) */
.woocommerce-cart main .container,
.woocommerce-cart #primary .container,
.woocommerce-cart .entry-content .container {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.woocommerce-cart .woocommerce {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding: 20px 0 !important; /* Reduced from 30px */
    animation: fadeInUp 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Container for Cart Items */
.woocommerce-cart-form {
    flex: 1 1 60%;
    min-width: 0;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
}

/* Container for Cart Totals */
.cart-collaterals {
    flex: 1 1 30%;
    min-width: 340px;
    position: sticky;
    top: 120px;
    margin: 0 !important;
}

/* Hide Shipping entirely from Cart Page */
.woocommerce-cart .cart_totals .shop_table tr.shipping,
.woocommerce-cart .woocommerce-shipping-calculator,
.woocommerce-cart .shipping-calculator-button {
    display: none !important;
}

/* 2. Premium Table Redesign with CSS Grid */
.woocommerce-cart-form__contents {
    width: 100%;
    border-collapse: collapse !important;
    border: none !important;
    margin: 0 !important;
    background: transparent !important;
}

.woocommerce-cart-form__contents thead {
    display: none !important;
}

/* The Grid Layout */
.woocommerce-cart-form__contents thead tr,
.woocommerce-cart-form__contents tbody tr.cart_item {
    display: grid !important;
    grid-template-columns: 40px 80px minmax(150px, 1fr) 100px 130px 100px;
    align-items: center;
    gap: 20px;
}

.woocommerce-cart-form__contents thead th {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #94a3b8;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
}

.woocommerce-cart-form__contents thead th.product-name { text-align: left !important; }
.woocommerce-cart-form__contents thead th.product-price { text-align: center !important; }
.woocommerce-cart-form__contents thead th.product-quantity { text-align: center !important; }
.woocommerce-cart-form__contents tfoot,
.woocommerce-cart-form__contents thead th.product-subtotal { text-align: right !important; }

/* Hide Screen Reader text in header properly */
.woocommerce-cart-form__contents thead th .screen-reader-text {
    display: none !important;
}

/* Individual Cart Item Card */
.woocommerce-cart-form__contents tbody tr.cart_item {
    background: #fff !important;
    border-radius: 20px !important;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.04) !important;
    border: 1px solid #f8fafc !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 20px 25px !important;
    margin-bottom: 16px !important;
}

.woocommerce-cart-form__contents tbody tr.cart_item:hover {
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08) !important;
    transform: translateY(-3px);
    border-color: #f1f5f9 !important;
}

.woocommerce-cart-form__contents tbody td {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Remove button */
.woocommerce-cart-form__contents a.remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fef2f2 !important;
    color: #ef4444 !important;
    border-radius: 50%;
    font-size: 14px;
    font-weight: normal;
    text-decoration: none;
    transition: all 0.3s ease;
    margin: 0;
    border: 1px solid transparent;
}

.woocommerce-cart-form__contents a.remove:hover {
    background: #ef4444 !important;
    color: #fff !important;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Thumbnail */
.woocommerce-cart-form__contents td.product-thumbnail img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 14px !important;
    border: 1px solid #f1f5f9 !important;
    padding: 2px !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03) !important;
}

/* Product Info */
.woocommerce-cart-form__contents td.product-name {
    text-align: left !important;
}

.woocommerce-cart-form__contents td.product-name a {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--logo-black, #000000) !important;
    text-decoration: none !important;
    display: block !important;
    margin-bottom: 6px !important;
    line-height: 1.4 !important;
    transition: color 0.2s;
}

.woocommerce-cart-form__contents td.product-name a:hover {
    color: var(--primary-cyan) !important;
}

.woocommerce-cart-form__contents td.product-name .variation {
    font-size: 13px !important;
    color: #64748b !important;
    margin: 0 !important;
}

.woocommerce-cart-form__contents td.product-name .variation dt {
    font-weight: 600;
    display: inline-block;
    margin-right: 4px;
}
.woocommerce-cart-form__contents td.product-name .variation dd {
    display: inline-block;
    margin: 0;
}

/* Price & Subtotal */
.woocommerce-cart-form__contents td.product-price {
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #475569 !important;
    text-align: center !important;
}

.woocommerce-cart-form__contents td.product-subtotal {
    font-weight: 800 !important;
    font-size: 16px !important;
    color: var(--primary-cyan) !important;
    text-align: right !important;
}

/* Quantity */
.woocommerce-cart-form__contents td.product-quantity {
    text-align: center !important;
}

.woocommerce-cart-form__contents td.product-quantity .quantity {
    display: inline-flex !important;
    background: #f8fafc !important;
    border-radius: 10px !important;
    padding: 4px !important;
    border: 1px solid #e2e8f0 !important;
    transition: 0.3s;
    margin: 0 auto;
}

.woocommerce-cart-form__contents td.product-quantity .quantity:hover {
    border-color: #cbd5e1 !important;
    background: #fff !important;
}

.woocommerce-cart-form__contents td.product-quantity .qty {
    width: 40px !important;
    border: none !important;
    background: transparent !important;
    text-align: center !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #0f172a !important;
    outline: none !important;
    -moz-appearance: textfield;
    padding: 0 !important;
}

.woocommerce-cart-form__contents td.product-quantity .qty::-webkit-inner-spin-button, 
.woocommerce-cart-form__contents td.product-quantity .qty::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

/* Actions Row (Coupon & Update Cart) */
.woocommerce-cart-form__contents tr:last-child {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin-top: 30px !important;
}

.woocommerce-cart-form__contents tr:last-child:hover {
    box-shadow: none !important;
    transform: none !important;
}

.woocommerce-cart-form__contents tr:last-child td {
    padding: 0 !important;
}

.woocommerce-cart-form__contents .actions {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    background: transparent !important;
    border: none !important;
}

.woocommerce-cart-form__contents .coupon {
    display: flex !important;
    gap: 12px !important;
    flex: 1;
    width: 100% !important;
    max-width: 100% !important;
    align-items: center;
}

.woocommerce-cart-form__contents .coupon .input-text {
    flex: 1 !important;
    min-width: 180px !important;
    padding: 15px 20px !important;
    border-radius: 14px !important;
    border: 1px solid #e2e8f0 !important;
    background: #fff !important;
    font-size: 15px !important;
    outline: none !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02) !important;
    color: var(--logo-black, #000000) !important;
}

.woocommerce-cart-form__contents .coupon .input-text:focus {
    border-color: #0f172a !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06) !important;
}

.woocommerce-cart-form__contents .coupon button,
.woocommerce-cart-form__contents button[name="update_cart"] {
    padding: 15px 30px !important;
    border-radius: 14px !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    border: none !important;
    white-space: nowrap !important;
}

.woocommerce-cart-form__contents .coupon button {
    background: #f1f5f9 !important;
    color: #334155 !important;
}
.woocommerce-cart-form__contents .coupon button:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.woocommerce-cart-form__contents button[name="update_cart"] {
    background: var(--logo-black) !important;
    color: var(--primary-cyan) !important;
    box-shadow: 0 8px 20px rgba(15,23,42,0.15) !important;
}
.woocommerce-cart-form__contents button[name="update_cart"]:hover {
    background: #1e293b !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 25px rgba(15,23,42,0.2) !important;
}
.woocommerce-cart-form__contents button[name="update_cart"]:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* 3. Cart Totals Section (Premium Card) */
.cart-collaterals .cart_totals {
    background: #fff !important;
    border-radius: 24px !important;
    padding: 35px !important;
    box-shadow: 0 12px 40px rgba(15,23,42,0.06) !important;
    border: 1px solid #f8fafc !important;
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

.cart_totals h2 {
    font-size: 22px !important;
    font-weight: 800 !important;
    color: var(--logo-black, #000000) !important;
    margin-bottom: 25px !important;
    border-bottom: 2px solid #f1f5f9 !important;
    padding-bottom: 15px !important;
    letter-spacing: -0.5px !important;
}

.cart_totals .shop_table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 30px !important;
    border: none !important;
}

.cart_totals .shop_table th,
.cart_totals .shop_table td {
    padding: 18px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
    background: transparent !important;
}

.cart_totals .shop_table th {
    text-align: left !important;
    color: #64748b !important;
    font-weight: 500 !important;
    font-size: 15px !important;
}

.cart_totals .shop_table td {
    text-align: right !important;
    font-weight: 700 !important;
    color: var(--logo-black, #000000) !important;
}

.cart_totals .shop_table .order-total th,
.cart_totals .shop_table .order-total td {
    border-bottom: none !important;
    padding-top: 25px !important;
}

.cart_totals .shop_table .order-total th {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: var(--logo-black, #000000) !important;
}

.cart_totals .shop_table .order-total td strong {
    font-size: 26px !important;
    color: var(--primary-cyan, #24E5FF) !important;
    font-weight: 900 !important;
    letter-spacing: -0.5px !important;
}

/* Proceed to Checkout Button */
.wc-proceed-to-checkout .checkout-button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--primary-cyan, #24E5FF) !important;
    color: var(--logo-black, #000000) !important;
    padding: 20px 30px !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    border-radius: 16px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    width: 100%;
    margin-top: 10px !important;
    border: none !important;
}

.wc-proceed-to-checkout .checkout-button:hover {
    background: var(--logo-black, #000000) !important;
    color: var(--primary-cyan, #24E5FF) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4) !important;
}

/* 4. Hide Update Cart Button (Auto-update enabled) */
button[name="update_cart"],
.woocommerce-cart-form button[name="update_cart"] {
    display: none !important;
}

/* 5. Compact Mobile Responsive (Pixel Perfect) */
@media (max-width: 768px) {
    .woocommerce-cart .woocommerce {
        flex-direction: column;
        gap: 20px !important; /* Reduced gap between elements */
        padding: 0 0 20px !important; /* Removed top padding to close gap with breadcrumb */
    }

    .woocommerce-cart-form {
        padding: 0 !important;
        width: 100% !important;
    }

    .cart-collaterals {
        width: 100%;
        position: static;
        padding: 0 15px !important; /* Keep some padding for totals */
    }

    .woocommerce-cart-form__contents thead {
        display: none !important;
    }

    /* Full Width Mobile Cards */
    .woocommerce-cart-form__contents tbody tr.cart_item {
        display: grid !important;
        grid-template-columns: 85px 1fr !important;
        grid-template-rows: auto auto auto auto !important;
        gap: 8px 15px !important;
        padding: 20px 15px !important;
        border-radius: 0 !important; /* Edge-to-edge */
        margin-bottom: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: 1px solid #f1f5f9 !important;
        align-items: center !important;
        width: 100% !important;
        box-shadow: none !important;
    }

    .woocommerce-cart-form__contents td {
        padding: 0 !important;
        text-align: left !important;
    }

    /* Hide WooCommerce default labels globally first */
    .woocommerce-cart-form__contents td::before {
        display: none !important;
    }

    /* Image spans full left side */
    .woocommerce-cart-form__contents td.product-thumbnail {
        grid-column: 1 / 2 !important;
        grid-row: 1 / 5 !important;
        width: 100% !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
    }

    .woocommerce-cart-form__contents td.product-thumbnail img {
        width: 85px !important;
        height: 85px !important;
        object-fit: cover !important;
        border-radius: 12px !important;
        margin-top: 5px !important;
    }

    /* Name is Top Right */
    .woocommerce-cart-form__contents td.product-name {
        grid-column: 2 / 3 !important;
        grid-row: 1 / 2 !important;
        padding-left: 5px !important; /* Extra gap from image column if needed */
    }
    
    .woocommerce-cart-form__contents td.product-name a {
        font-size: 15px !important;
        margin-bottom: 2px !important;
        display: block !important;
        text-align: left !important;
    }

    /* Unit Price with "Price:" label */
    .woocommerce-cart-form__contents td.product-price {
        display: flex !important;
        align-items: center !important;
        grid-column: 2 / 3 !important;
        grid-row: 2 / 3 !important;
        font-size: 14px !important;
        color: #64748b !important;
        font-weight: 600 !important;
        padding-left: 5px !important;
    }

    .woocommerce-cart-form__contents td.product-price::before {
        content: 'price: ' !important;
        font-size: 13px !important;
        color: #64748b !important;
        font-weight: 500 !important;
        display: inline-block !important; /* Changed from block to inline-block */
        margin-right: 5px !important;
    }

    /* Quantity */
    .woocommerce-cart-form__contents td.product-quantity {
        grid-column: 2 / 3 !important;
        grid-row: 3 / 4 !important;
        display: flex !important;
        justify-content: flex-start !important;
        padding-left: 5px !important;
    }
    
    .woocommerce-cart-form__contents td.product-quantity .quantity {
        margin: 0 !important;
        padding: 2px !important;
    }

    /* Subtotal */
    .woocommerce-cart-form__contents td.product-subtotal {
        grid-column: 2 / 3 !important;
        grid-row: 4 / 5 !important;
        font-size: 16px !important;
        color: var(--primary-red, #ff2e2e) !important;
        padding-top: 8px !important;
        padding-left: 5px !important;
        border-top: 1px dashed #e2e8f0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }
    
    .woocommerce-cart-form__contents td.product-subtotal::before {
        content: 'subtotal: ' !important;
        font-size: 13px !important;
        color: #64748b !important;
        font-weight: 500 !important;
        display: inline-block !important; /* Ensure visibility */
    }

    /* Remove Button */
    .woocommerce-cart-form__contents td.product-remove {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        width: auto !important;
    }

    /* Actions Mobile */
    .woocommerce-cart-form__contents .actions {
        flex-direction: column !important;
        padding: 20px 15px !important;
        gap: 15px !important;
        width: 100% !important;
        background: #fff !important;
    }
    
    .woocommerce-cart-form__contents .coupon {
        width: 100% !important;
        max-width: 100% !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    .woocommerce-cart-form__contents .coupon .input-text {
        width: 100% !important;
    }

    .woocommerce-cart-form .coupon button,
    .woocommerce-cart-form button[name="update_cart"] {
        width: 100% !important;
    }
}

/* 6. Empty Cart UI Styling */
.khati-empty-cart-premium {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 60px 20px !important;
    text-align: center !important;
    min-height: 400px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.empty-cart-inner {
    background: transparent !important;
    padding: 50px 40px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: 450px !important;
    width: 100% !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    border: none !important;
}

.empty-cart-visual {
    margin-bottom: 25px !important;
    display: flex !important;
    justify-content: center !important;
}

.main-icon-circle {
    width: 100px;
    height: 100px;
    background: #f8fafc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 40px;
    margin: 0 auto;
}

.empty-cart-title {
    font-size: 24px !important;
    font-weight: 800 !important;
    color: var(--logo-black, #000000) !important;
    margin: 0 0 10px !important;
}

.empty-cart-desc {
    font-size: 15px !important;
    color: #64748b !important;
    margin-bottom: 30px !important;
}

.empty-cart-actions .button {
    background: var(--logo-black, #000000) !important;
    color: var(--primary-cyan, #24E5FF) !important;
    padding: 15px 35px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: 0.3s !important;
}

.empty-cart-actions .button:hover {
    background: #1e293b !important;
    transform: translateY(-2px) !important;
}

@media (max-width: 768px) {
    .khati-empty-cart-premium {
        padding: 40px 15px !important;
        margin: 0 auto !important;
        justify-content: center !important;
    }
    
    .empty-cart-inner {
        padding: 40px 25px !important;
        width: 100% !important;
        margin: 0 auto !important;
        box-shadow: none !important;
        background: transparent !important;
        border: none !important;
    }
}
