/* =========================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ========================================= */
:root {
    /* Colors */
    --color-bg: #fff;
    --color-text-primary: #000;
    --color-text-dark: #1a1a1a;
    --color-text-medium: #303134;
    --color-text-muted: #777;
    --color-text-placeholder: #a3a3a3;
    --color-border-strong: #292929;
    --color-border-medium: #707070;
    --color-border-light: #AFAFAF;
    --color-border-input: #ddd;
    --color-border-coupon: #ccc;
    --color-bg-thumbnail: #f0f0f0;
    --color-btn-primary-bg: #303134;
    --color-btn-primary-text: #fff;
    --color-btn-primary-hover: #333;
    --color-btn-secondary-bg: #fff;
    --color-btn-secondary-text: #141313;

    /* Typography */
    --font-family-base: "DM Sans", sans-serif;
    --font-size-base: 0.93rem;
    --font-size-sm: 0.8rem;
    --font-size-xs: 0.75rem;
    --font-size-xxs: 0.65rem;
    --font-size-totals: 0.88rem;
    --font-size-btn: 16px;
    --font-size-cart-title: 1.75rem;
    --font-size-cart-title-mobile: 1.8rem;
    --font-size-remove: 15px;
    --font-size-coupon: 15px;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-2xl: 24px;
    --spacing-3xl: 32px;
    --spacing-4xl: 40px;
    --spacing-section: 80px;

    /* Layout */
    --cart-sidebar-width: 400px;
    --cart-layout-gap: 16px;
    --thumbnail-size: 64px;
    --thumbnail-cell-width: 80px;
    --remove-cell-width: 60px;
    --qty-width: 50px;

    /* Border */
    --border-radius-btn: 8px;
    --border-width-strong: 2px;

    /* Transitions */
    --transition-default: all 0.4s ease-in-out;
    --transition-btn: all 0.35s ease-in-out;

    /* Sticky offset */
    --sticky-top: 24px;

    /* Breakpoints (for reference in comments) */
    /* --bp-tablet: 960px; */
    /* --bp-mobile: 640px; */
}

/* =========================================
   BASE
   ========================================= */
body.woocommerce-cart {
    background: var(--color-bg);
    font-family: var(--font-family-base);
    color: var(--color-text-primary);
}

/* =========================================
   WRAPPER
   ========================================= */
.custom-cart-wrapper {
    padding: var(--spacing-4xl) var(--spacing-2xl) var(--spacing-section);
}

/* =========================================
   CART TITLE
   ========================================= */
.cart-title {
    font-size: var(--font-size-cart-title);
    margin-bottom: var(--spacing-4xl);
}

/* =========================================
   LAYOUT: LEFT + RIGHT
   ========================================= */
.custom-cart-layout {
    display: grid;
    grid-template-columns: 1fr var(--cart-sidebar-width);
    gap: var(--cart-layout-gap);
    align-items: start;
}

@media (max-width: 960px) {
    .custom-cart-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-4xl);
    }
}

/* =========================================
   CART TABLE
   ========================================= */
.woocommerce-cart-form table.shop_table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    margin: 0;
}

.woocommerce-cart-form table.shop_table thead tr th {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: 500;
    text-transform: uppercase;
    padding: 0 var(--spacing-md) 14px;
    text-align: left;
    border-bottom: var(--border-width-strong) solid var(--color-border-strong);
}

.woocommerce-cart-form table.shop_table thead tr th.product-thumbnail {
    width: var(--thumbnail-cell-width);
}

.woocommerce-cart-form table.shop_table thead tr th.product-remove {
    width: var(--remove-cell-width);
}

.woocommerce-cart-form table.shop_table tbody tr td {
    padding: 12px;
    vertical-align: middle;
}

/* Product thumbnail */
.woocommerce-cart-form table td.product-thumbnail {
    width: 100px;
    padding-left: 0;
}

.woocommerce-cart-form table td.product-thumbnail img {
    width: 100px;
    height: auto;
    object-fit: cover;
    display: block;
    background: var(--color-bg-thumbnail);
}

/* Product name */
.woocommerce-cart-form table td.product-name a {
    color: var(--color-text-dark);
    text-decoration: none;
    font-weight: 400;
    text-transform: uppercase;
}

.woocommerce-cart-form table td.product-name a:hover {
    text-decoration: underline;
}

/* Remove / Delete */
.woocommerce-cart-form table td.product-remove a.remove {
    color: var(--color-text-medium) !important;
    font-size: var(--font-size-remove);
    font-weight: 400;
    text-decoration: underline;
    background: none;
    display: inline;
    width: auto;
    height: auto;
    line-height: normal;
    border-radius: 0;
    transition: var(--transition-default);
}

.woocommerce-cart-form table td.product-remove a.remove:hover {
    background: none;
    opacity: 0.8;
}

/* Quantity input */
.woocommerce-cart-form .qty {
    width: var(--qty-width);
    text-align: center;
    border: 1px solid var(--color-border-input);
    padding: 6px var(--spacing-sm);
    font-size: var(--font-size-sm);
    -moz-appearance: textfield;
    border-radius: 0;
}

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

/* =========================================
   ACTIONS ROW (Coupon + Update)
   ========================================= */
.woocommerce-cart-form table td.actions {
    border-bottom: none;
    padding: var(--spacing-2xl) 0 0;
}

.woocommerce-cart-form .coupon {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--color-border-coupon);
    padding-bottom: var(--spacing-xs);
}

.woocommerce-cart-form .coupon input#coupon_code {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--font-size-coupon);
    font-weight: 500;
    padding: 6px 0;
    background: transparent;
}

.woocommerce-cart-form .coupon input#coupon_code::placeholder {
    color: var(--color-text-placeholder);
}

.woocommerce-cart-form .coupon button[name="apply_coupon"] {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-size-coupon);
    color: var(--color-text-medium);
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: var(--spacing-xs) 0;
}

.woocommerce-cart-form .coupon button[name="apply_coupon"]:hover {
    color: #555;
}

/* WooCommerce disabled/hover button overrides */
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) #respond input#submit.disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) #respond input#submit:disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) #respond input#submit:disabled[disabled],
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) a.button.disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) a.button:disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) a.button:disabled[disabled],
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button.disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button:disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button:disabled[disabled],
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) input.button.disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) input.button:disabled,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) input.button:disabled[disabled],
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce #respond input#submit.disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce #respond input#submit:disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce #respond input#submit:disabled[disabled],
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce a.button.disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce a.button:disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce a.button:disabled[disabled],
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button.disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button:disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button:disabled[disabled],
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce input.button.disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce input.button:disabled,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce input.button:disabled[disabled] {
    padding: var(--spacing-md) 22px;
}

.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) #respond input#submit:hover,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) a.button:hover,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) button.button:hover,
.woocommerce:where(body:not(.woocommerce-block-theme-has-button-styles)) input.button:hover,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce #respond input#submit:hover,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce a.button:hover,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button:hover,
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce input.button:hover {
    background-color: var(--color-bg);
}

/* Update Cart Button */
.update-cart-btn,
button[name="update_cart"],
:where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button {
    background-color: var(--color-btn-secondary-bg);
    color: var(--color-btn-secondary-text);
    border: 1px solid var(--color-border-medium);
    font-size: var(--font-size-btn);
    font-weight: 500;
    border-radius: var(--border-radius-btn);
    transition: var(--transition-btn);
}

/* =========================================
   RIGHT: CART TOTALS
   ========================================= */
.cart-right .cart_totals {
    position: sticky;
    top: var(--sticky-top);
}

/* TOTALS HEADING */
.totals-heading {
    font-size: var(--font-size-base);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 14px;
}

/* TOTALS TABLE */
.totals-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-3xl);
}

.totals-table th,
.totals-table td {
    font-size: var(--font-size-base);
    font-weight: 500;
    padding: 14px 0;
    border-top: 1px solid var(--color-border-light)!important;
    color: var(--color-text-dark);
    vertical-align: top;
}

.totals-table th {
    text-align: left;
    font-weight: 500;
}

.totals-table td {
    text-align: right;
}

.totals-table tr:first-child th,
.totals-table tr:first-child td {
    border-top: 1px solid var(--color-text-dark);
}

/* Placeholder */
.totals-table .placeholder-amount {
    display: block;
}

.totals-table .shipping-note {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: var(--spacing-xs) 0 0;
    text-align: right;
    max-width: 180px;
    margin-left: auto;
}

/* Shipping section */
.totals-table .woocommerce-shipping-totals td ul {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: right;
}

/* =========================================
   RECURRING TOTALS SECTION
   (WooCommerce Subscriptions plugin)
   ========================================= */
.cart_totals .subscription-recurring-totals,
.cart_totals .recurring-totals-section {
    margin-top: var(--spacing-sm);
}

.cart_totals .cart-recurring-totals h2,
.cart_totals .cart-recurring-totals .cart_totals h2 {
    font-size: var(--font-size-xxs);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 14px;
    color: var(--color-text-dark);
}

/* =========================================
   PROCEED TO CHECKOUT BUTTON
   ========================================= */

.wc-proceed-to-checkout a.checkout-button,
.wc-proceed-to-checkout .checkout-button {
    display: block;
    width: 100%;
    background: var(--color-btn-primary-bg) !important;
    color: var(--color-btn-primary-text) !important;
    border: none !important;
    padding: 18px var(--spacing-2xl) !important;
    font-size: var(--font-size-btn) !important;
    font-weight: 500 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    border-radius: var(--border-radius-btn) !important;
}

.wc-proceed-to-checkout a.checkout-button:hover,
.wc-proceed-to-checkout .checkout-button:hover {
    background: var(--color-btn-primary-hover) !important;
}

/* WooCommerce layout overrides */
.woocommerce .cart-collaterals .cart_totals,
.woocommerce-page .cart-collaterals .cart_totals {
    float: none;
    width: 100%;
}

.woocommerce-page table.cart td.actions {
    text-align: left;
}

.woocommerce a.remove:hover {
    color: var(--color-text-primary) !important;
}

body .woocommerce table.shop_table td,
body.woocommerce-cart .cart-collaterals .cart_totals table {
    border-top: 2px solid #000;
}

.recurring-totals {
    text-transform: uppercase;
    font-weight: 500;
}

body.woocommerce-cart .wc-proceed-to-checkout {
    padding: 0;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media screen and (max-width: 992px) {
    .update-cart-btn,
    button[name="update_cart"],
    :where(body:not(.woocommerce-block-theme-has-button-styles)):where(:not(.edit-post-visual-editor)) .woocommerce button.button {
        padding: 12px 0;
    }
}

@media screen and (max-width: 735px) {
    .cart-title {
        font-size: var(--font-size-cart-title-mobile);
    }

    .woocommerce-cart-form table.shop_table thead {
        display: none;
    }

    .woocommerce-cart-form table.shop_table tbody tr td {
        display: block;
        padding: var(--spacing-sm) 0;
        border-bottom: none;
        text-align: right;
    }

    .woocommerce-cart-form table.shop_table tbody tr td::before {
        content: attr(data-title) ": ";
        float: left;
        font-weight: 600;
        font-size: var(--font-size-xs);
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    .woocommerce-cart-form table.shop_table tbody tr td.product-thumbnail {
        display: none;
    }

    .woocommerce-cart-form table.shop_table tbody tr {
        display: block;
        padding: var(--spacing-lg) 0;
    }

    .custom-cart-wrapper {
        padding: var(--spacing-2xl) var(--spacing-lg) 60px;
    }
}