/* ===== SaaS Cart Page Styles ===== */

/* Override WooCommerce Container Flex */
.woocommerce-cart .woocommerce {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    max-width: 1200px;
    margin: 50px auto;
    color: #fff;
    position: relative;
}

/* Hide WooCommerce native clearfix */
.woocommerce-cart .woocommerce::before,
.woocommerce-cart .woocommerce::after {
    display: none !important;
}

/* Notices Full Width */
.woocommerce-cart .woocommerce-notices-wrapper,
.woocommerce-cart .woocommerce-message,
.woocommerce-cart .woocommerce-error,
.woocommerce-cart .woocommerce-info {
    width: 100%;
    flex: 0 0 100%;
}

/* Form / Table Wrapper */
.woocommerce-cart .woocommerce .woocommerce-cart-form {
    width: calc(65% - 20px) !important;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.1));
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

/* Sidebar Totals Wrapper */
.woocommerce-cart .woocommerce .cart-collaterals {
    width: calc(35% - 20px) !important;
    clear: none !important;
    float: none !important;
    position: sticky;
    top: 120px; 
}
.woocommerce-cart .woocommerce .cart_totals {
    width: 100% !important;
    float: none !important;
    background: linear-gradient(135deg, rgba(0,0,0,0.3), rgba(2,6,23,0.9));
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* --- Table Styling --- */
.woocommerce table.shop_table {
    border: none;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    width: 100%;
    table-layout: fixed; /* Strictly adhere to widths */
}
.woocommerce table.shop_table th {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 10px 20px 20px 20px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    text-align: center; /* Center standard columns */
}
.woocommerce table.shop_table td {
    background: transparent;
    border: none;
    padding: 24px 20px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: center; /* Center standard columns */
}
/* Specifically align Product Name column */
.woocommerce table.shop_table th.product-name,
.woocommerce table.shop_table td.product-name {
    text-align: right !important;
    padding-right: 10px !important;
    width: auto !important; /* Will consume remainder of the fixed table width */
}
html[dir="ltr"] .woocommerce table.shop_table th.product-name,
html[dir="ltr"] .woocommerce table.shop_table td.product-name {
    text-align: left !important;
    padding-left: 10px !important;
}

/* Minimize the space the X and Thumbnail take so they stick to the Product Name */
.woocommerce table.shop_table td.product-remove,
.woocommerce table.shop_table th.product-remove {
    width: 50px !important;
    padding: 0 !important;
    text-align: center !important;
}

.woocommerce table.shop_table td.product-thumbnail,
.woocommerce table.shop_table th.product-thumbnail {
    width: 90px !important;
    padding: 0 5px !important;
    text-align: center !important;
}

/* Fix width percentages to stop elements shifting arbitrarily */
.woocommerce table.shop_table th.product-price,
.woocommerce table.shop_table td.product-price,
.woocommerce table.shop_table th.product-subtotal,
.woocommerce table.shop_table td.product-subtotal {
    text-align: center !important;
}
.woocommerce table.shop_table th.product-quantity,
.woocommerce table.shop_table td.product-quantity {
    width: 13% !important;
    text-align: center !important;
}
.woocommerce-cart-form table.shop_table tr.cart_item:last-child td {
    border-bottom: none;
}
.woocommerce table.shop_table tr.cart_item {
    transition: 0.3s;
}
.woocommerce table.shop_table tr.cart_item:hover td {
    background: rgba(255,255,255,0.02);
}

/* Product Cell Layouts */
.woocommerce table.cart td.product-thumbnail img {
    border-radius: 12px;
    width: 80px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s;
}
.woocommerce table.cart td.product-thumbnail img:hover {
    transform: scale(1.05);
}
.woocommerce table.cart td.product-name a {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: 0.3s;
}
.woocommerce table.cart td.product-name a:hover {
    color: #5fc9df;
}
.woocommerce table.cart td.product-price,
.woocommerce table.cart td.product-subtotal {
    color: #22c55e;
    font-weight: 800;
    font-size: 16px;
}

/* Remove button */
.woocommerce table.cart td.product-remove a.remove {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-decoration: none;
    transition: 0.3s;
    line-height: 1;
}
.woocommerce table.cart td.product-remove a.remove:hover {
    background: #ef4444 !important;
    color: #fff !important;
    transform: scale(1.1) rotate(90deg);
}

/* Cart Quantity */
.woocommerce .cart .quantity {
    display: inline-flex;
    position: relative;
    border-radius: 10px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    height: 40px;
    overflow: hidden;
}
.woocommerce .cart .quantity input.qty {
    width: 50px;
    height: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: textfield;
}

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

/* Actions Row (Coupon & Update Cart) */
.woocommerce table.cart td.actions {
    padding: 35px 20px 20px 20px !important;
    background: transparent;
    border-top: 1px dashed rgba(255,255,255,0.1);
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 20px;
}
.woocommerce table.cart td.actions .coupon {
    display: flex;
    gap: 15px;
    align-items: center;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
html[dir="ltr"] .woocommerce table.cart td.actions .coupon {
    float: left;
}
.woocommerce table.cart td.actions .coupon label {
    display: none;
}
.woocommerce table.cart td.actions .coupon input[name="coupon_code"] {
    background: rgba(255,255,255,0.05); /* Brighter for visibility */
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-family: inherit;
    outline: none;
    transition: 0.3s;
    min-width: 140px;
}
.woocommerce table.cart td.actions .coupon input[name="coupon_code"]::placeholder {
    color: rgba(255,255,255,0.6);
}
.woocommerce table.cart td.actions .coupon input[name="coupon_code"]:focus {
    border-color: #5fc9df;
    box-shadow: 0 0 10px rgba(95, 201, 223, 0.2);
}
.woocommerce table.cart td.actions button {
    background: rgba(255,255,255,0.08); /* Lighter secondary button */
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: 0.3s;
    white-space: nowrap !important; /* Prevent text wrapping */
}
.woocommerce table.cart td.actions button.button:disabled,
.woocommerce table.cart td.actions button.button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(255,255,255,0.04) !important;
    color: rgba(255,255,255,0.4) !important;
}
.woocommerce table.cart td.actions button:hover:not(:disabled) {
    background: rgba(95, 201, 223, 0.1);
    color: #5fc9df;
    border-color: rgba(95, 201, 223, 0.4);
}
/* Apply Coupon Button Specific Style */
.woocommerce table.cart td.actions .coupon button {
    background: linear-gradient(135deg, #118fa6, #5fc9df);
    color: #fff;
    border: none;
    box-shadow: 0 5px 15px rgba(17, 143, 166, 0.2);
}
.woocommerce table.cart td.actions .coupon button:hover {
    background: linear-gradient(135deg, #16a7c2, #7ce4f2);
    box-shadow: 0 8px 25px rgba(17, 143, 166, 0.3);
    color: #fff;
}


/* --- Cart Totals (Sidebar) --- */
.woocommerce .cart-collaterals h2 {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 25px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 15px;
}
.woocommerce .cart-collaterals table.shop_table {
    border: none;
    margin: 0 0 35px 0;
    border-collapse: separate;
}
.woocommerce .cart-collaterals table.shop_table th {
    color: #94a3b8;
    background: transparent;
    border: none;
    padding: 18px 0;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.woocommerce .cart-collaterals table.shop_table td {
    color: #fff;
    background: transparent;
    border: none;
    padding: 18px 0;
    text-align: left; /* RTL left */
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
html[dir="ltr"] .woocommerce .cart-collaterals table.shop_table td {
    text-align: right;
}

/* Shipping Methods inside Totals */
.woocommerce .cart-collaterals #shipping_method {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: right; /* RTL align checkbox on right, text on left visually */
}
html[dir="ltr"] .woocommerce .cart-collaterals #shipping_method {
    text-align: left;
}
.woocommerce .cart-collaterals #shipping_method li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
html[dir="ltr"] .woocommerce .cart-collaterals #shipping_method li {
    justify-content: flex-end;
}

.woocommerce .cart-collaterals table.shop_table tr.order-total th,
.woocommerce .cart-collaterals table.shop_table tr.order-total td {
    border-top: none;
    border-bottom: none;
    font-size: 22px;
    font-weight: 800;
    color: #22c55e;
    padding-top: 25px;
}

/* Proceed to Checkout Button */
.woocommerce .cart-collaterals .checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: linear-gradient(135deg, #118fa6, #5fc9df);
    color: #fff;
    padding: 18px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(17, 143, 166, 0.3);
    transition: 0.3s;
}
.woocommerce .cart-collaterals .checkout-button:hover {
    background: linear-gradient(135deg, #16a7c2, #7ce4f2);
    box-shadow: 0 15px 35px rgba(17, 143, 166, 0.4);
    transform: translateY(-3px);
}

/* Responsiveness */
@media (max-width: 991px) {
    .woocommerce-cart .woocommerce .woocommerce-cart-form, 
    .woocommerce-cart .woocommerce .cart-collaterals {
        width: 100% !important;
        position: static !important;
    }
    
    .woocommerce-cart .woocommerce .woocommerce-cart-form {
        padding: 20px;
    }
    
    .woocommerce table.cart td.actions {
        display: flex;
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    .woocommerce table.cart td.actions .coupon {
        float: none;
        flex-direction: column;
        gap: 10px;
    }
    .woocommerce table.cart td.actions .coupon input[name="coupon_code"],
    .woocommerce table.cart td.actions .coupon button,
    .woocommerce table.cart td.actions button {
        width: 100%;
    }
}

@media (max-width: 768px) {
    /* Responsive Table for WooCommerce */
    .woocommerce table.shop_table_responsive thead {
        display: none;
    }
    .woocommerce table.shop_table_responsive tbody tr {
        display: block;
        margin-bottom: 20px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding-bottom: 20px;
    }
    .woocommerce table.shop_table_responsive tbody tr td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;
        border: none;
        text-align: left; /* RTL */
    }
    html[dir="ltr"] .woocommerce table.shop_table_responsive tbody tr td {
        text-align: right;
    }
    .woocommerce table.shop_table_responsive tbody tr td::before {
        content: attr(data-title) ": ";
        font-weight: 700;
        color: #94a3b8;
        float: right; /* RTL */
    }
    html[dir="ltr"] .woocommerce table.shop_table_responsive tbody tr td::before {
        float: left;
    }
    
    /* Center thumbnail on mobile */
    .woocommerce-page table.cart td.product-thumbnail {
        justify-content: center;
    }
    .woocommerce-page table.cart td.product-thumbnail::before {
        display: none;
    }
    .woocommerce-page table.cart td.product-remove {
        justify-content: flex-start;
    }
    .woocommerce-page table.cart td.product-remove::before {
        display: none;
    }
}
