/**
 * WooCommerce Cart/Basket Page Styles
 *
 * Styling for the basket page to match the refined product listing design.
 * Includes: remove button, product rows, thumbnails, quantity input,
 * update button, totals box, checkout button, coupon section, table headers.
 *
 * @package Astra Child - Your Electrics
 * @since 1.0.0
 */


/* ============================================
   1. REMOVE BUTTON
   Small circular button, subtle until hovered
   ============================================ */

.product-remove a {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.product-remove a:hover {
    background: #fef2f2;
    color: #e63946;
}


/* ============================================
   2. PRODUCT ROW STYLING
   Light background, border-radius, subtle hover lift
   ============================================ */

.woocommerce-cart-form__cart-item,
tr.cart_item {
    background: #f8fafc;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.woocommerce-cart-form__cart-item:hover,
tr.cart_item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* Add spacing between rows for visual separation */
.woocommerce-cart-form__contents tr.cart_item td {
    padding: 16px 12px;
    vertical-align: middle;
}

/* Remove default table borders that conflict with rounded rows */
.woocommerce-cart-form__contents,
.woocommerce-cart-form__contents tbody,
.woocommerce-cart-form__contents tr,
.woocommerce-cart-form__contents td {
    border: none;
}

/* Add spacing between cart item rows */
.woocommerce-cart-form__contents {
    border-collapse: separate;
    border-spacing: 0 8px;
}


/* ============================================
   3. LARGER PRODUCT THUMBNAIL
   Increased size, subtle border-radius
   ============================================ */

.product-thumbnail img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
    padding: 4px;
}

/* Ensure the thumbnail cell doesn't constrain the image */
.woocommerce-cart-form td.product-thumbnail {
    width: 100px;
}


/* ============================================
   4. QUANTITY INPUT
   Consistent with site form styling
   ============================================ */

.woocommerce-cart-form input.qty {
    width: 60px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: center;
    transition: border-color 0.2s ease;
}

.woocommerce-cart-form input.qty:focus {
    outline: none;
    border-color: #e63946;
}

/* Remove spinner arrows for cleaner look (optional) */
.woocommerce-cart-form input.qty::-webkit-outer-spin-button,
.woocommerce-cart-form input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.woocommerce-cart-form input.qty[type=number] {
    -moz-appearance: textfield;
}


/* ============================================
   5. UPDATE BASKET BUTTON (SECONDARY STYLE)
   Ghost/outlined style so it doesn't compete with checkout
   ============================================ */

button[name="update_cart"],
.woocommerce-cart-form .button:not(.checkout-button) {
    background: transparent;
    color: #e63946;
    border: 2px solid #e63946;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

button[name="update_cart"]:hover,
.woocommerce-cart-form .button:not(.checkout-button):hover {
    background: #e63946;
    color: #ffffff;
}

/* Disabled state for update button */
button[name="update_cart"]:disabled,
button[name="update_cart"][disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

button[name="update_cart"]:disabled:hover,
button[name="update_cart"][disabled]:hover {
    background: transparent;
    color: #e63946;
}


/* ============================================
   6. BASKET TOTALS BOX
   Light background, subtle shadow, border-radius
   ============================================ */

.cart_totals {
    background: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.cart_totals h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    color: #1f2937;
}

.cart_totals table {
    margin-bottom: 20px;
}

.cart_totals th,
.cart_totals td {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

/* Last row should not have a border */
.cart_totals tr:last-child th,
.cart_totals tr:last-child td {
    border-bottom: none;
}

/* Order total styling */
.cart_totals .order-total th,
.cart_totals .order-total td {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    padding-top: 16px;
}

.cart_totals .order-total .woocommerce-Price-amount {
    color: #e63946;
}


/* ============================================
   7. PROCEED TO CHECKOUT BUTTON
   Prominent red, full width, good padding
   ============================================ */

.wc-proceed-to-checkout a.checkout-button {
    display: block;
    width: 100%;
    background: #e63946;
    color: #ffffff;
    padding: 16px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.wc-proceed-to-checkout a.checkout-button:hover {
    background: #dc2f3c;
    transform: scale(1.02);
    color: #ffffff;
}

/* Remove default button styling that may conflict */
.wc-proceed-to-checkout {
    padding: 0;
    margin-top: 20px;
}


/* ============================================
   8. COUPON SECTION (COLLAPSED BY DEFAULT)
   Hidden by default, revealed when user clicks toggle link
   ============================================ */

.coupon-toggle {
    color: #6b7280;
    font-size: 0.9rem;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.coupon-toggle:hover {
    color: #e63946;
}

.coupon {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.coupon input[type="text"] {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    min-width: 150px;
}

.coupon input[type="text"]:focus {
    outline: none;
    border-color: #e63946;
}

.coupon input[type="text"]::placeholder {
    color: #9ca3af;
}

/* Apply coupon button styling */
.coupon .button {
    background: #1f2937;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.coupon .button:hover {
    background: #374151;
}


/* ============================================
   9. TABLE HEADER STYLING
   Cleaner headers with uppercase text
   ============================================ */

.woocommerce-cart-form__contents th,
.shop_table.cart th {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px;
    border-bottom: 2px solid #e5e7eb;
    background: transparent;
}


/* ============================================
   10. PRODUCT NAME LINK
   Better typography, hover state
   ============================================ */

.woocommerce-cart-form .product-name a {
    color: #1f2937;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.woocommerce-cart-form .product-name a:hover {
    color: #e63946;
}


/* ============================================
   11. PRICE STYLING
   Consistent formatting for cart prices
   ============================================ */

.woocommerce-cart-form td.product-price,
.woocommerce-cart-form td.product-subtotal {
    font-weight: 500;
    color: #1f2937;
}

.woocommerce-cart-form td.product-subtotal .woocommerce-Price-amount {
    font-weight: 600;
}


/* ============================================
   12. CART ACTIONS ROW
   Better layout for coupon and update button
   ============================================ */

.woocommerce-cart-form td.actions {
    padding: 20px 12px;
    background: transparent;
}

/* Flex layout for actions row */
.woocommerce-cart-form .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}


/* ============================================
   13. EMPTY CART MESSAGE
   Styled message when cart is empty
   ============================================ */

.cart-empty.woocommerce-info {
    background: #f8fafc;
    border-left: 4px solid #e63946;
    padding: 20px 24px;
    border-radius: 8px;
    color: #1f2937;
    margin-bottom: 24px;
}

.cart-empty.woocommerce-info::before {
    color: #e63946;
}

/* Return to shop button */
.return-to-shop .button {
    background: #e63946;
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.return-to-shop .button:hover {
    background: #dc2f3c;
    color: #ffffff;
}


/* ============================================
   14. CART COLLATERALS LAYOUT
   Improved layout for totals section
   ============================================ */

.cart-collaterals {
    margin-top: 32px;
}

/* Cross-sells section if present */
.cross-sells {
    margin-bottom: 32px;
}

.cross-sells h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: #1f2937;
}


/* ============================================
   15. RESPONSIVE ADJUSTMENTS
   Mobile-friendly cart styling
   ============================================ */

@media (max-width: 768px) {
    /* Stack cart table on mobile */
    .woocommerce-cart-form__contents thead {
        display: none;
    }

    .woocommerce-cart-form__contents tr.cart_item {
        display: flex;
        flex-wrap: wrap;
        padding: 16px;
        margin-bottom: 12px;
        position: relative;
    }

    .woocommerce-cart-form__contents tr.cart_item td {
        padding: 8px 4px;
        border: none;
    }

    /* Thumbnail takes full width row */
    .woocommerce-cart-form td.product-thumbnail {
        width: auto;
        flex: 0 0 80px;
    }

    /* Product name beside thumbnail */
    .woocommerce-cart-form td.product-name {
        flex: 1;
        padding-left: 12px;
    }

    /* Remove button positioned absolutely */
    .woocommerce-cart-form td.product-remove {
        position: absolute;
        top: 12px;
        right: 12px;
    }

    /* Price, quantity, subtotal in a row */
    .woocommerce-cart-form td.product-price,
    .woocommerce-cart-form td.product-quantity,
    .woocommerce-cart-form td.product-subtotal {
        flex: 1;
        text-align: center;
    }

    /* Add labels on mobile */
    .woocommerce-cart-form td.product-price::before {
        content: "Price";
        display: block;
        font-size: 0.75rem;
        color: #6b7280;
        text-transform: uppercase;
        margin-bottom: 4px;
    }

    .woocommerce-cart-form td.product-quantity::before {
        content: "Qty";
        display: block;
        font-size: 0.75rem;
        color: #6b7280;
        text-transform: uppercase;
        margin-bottom: 4px;
    }

    .woocommerce-cart-form td.product-subtotal::before {
        content: "Total";
        display: block;
        font-size: 0.75rem;
        color: #6b7280;
        text-transform: uppercase;
        margin-bottom: 4px;
    }

    /* Actions row */
    .woocommerce-cart-form .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .coupon {
        width: 100%;
        margin-bottom: 12px;
    }

    .coupon input[type="text"] {
        flex: 1;
    }

    button[name="update_cart"] {
        width: 100%;
    }

    /* Cart totals full width */
    .cart_totals {
        width: 100%;
        padding: 20px;
    }

    .wc-proceed-to-checkout a.checkout-button {
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    .product-thumbnail img {
        width: 60px;
        height: 60px;
    }

    .woocommerce-cart-form input.qty {
        width: 50px;
        padding: 6px 8px;
    }

    .cart_totals {
        padding: 16px;
    }

    .cart_totals h2 {
        font-size: 1.1rem;
    }
}
