/* ==========================================================================
   Progenix Cart Drawer (Shopify-style slide-in) + Variant Swatches
   ========================================================================== */

/* Suppress the older WPCode-injected "#custom-cart-notice" toast — it binds
   to the same core `added_to_cart` event this drawer does, so both used to
   fire together. The drawer replaces it; the WPCode snippet itself can also
   be disabled/removed in WPCode whenever convenient. */
#custom-cart-notice {
    display: none !important;
}

#pg-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background-color: rgba(15, 23, 42, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#pg-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

#pg-cart-overlay.is-open {
    display: block;
}

#pg-cart-overlay.is-visible {
    opacity: 1;
}

#pg-cart-overlay.is-visible #pg-cart-drawer {
    transform: translateX(0);
}

.pg-cart-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.pg-cart-drawer__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.pg-cart-drawer__close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #475569;
    border-radius: 9999px;
    transition: background-color 0.15s, color 0.15s;
}

.pg-cart-drawer__close:hover {
    background-color: #f1f5f9;
    color: var(--pg-primary, #31a3b9);
}

#pg-cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.pg-cart-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.pg-cart-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
}

.pg-cart-item:first-child {
    padding-top: 0;
}

.pg-cart-item__image {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.pg-cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pg-cart-item__details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pg-cart-item__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    line-height: 1.3;
}

.pg-cart-item__variation {
    font-size: 0.75rem;
    color: #64748b;
}

.pg-cart-item__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.pg-cart-item__price {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
}

.pg-qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.pg-qty-stepper button {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #334155;
    line-height: 1;
}

.pg-qty-stepper button:hover {
    background: #eef6f8;
    color: var(--pg-primary, #31a3b9);
}

.pg-qty-stepper span {
    min-width: 30px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
}

.pg-cart-item__remove {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.75rem;
    text-decoration: underline;
    padding: 0;
    margin-top: 4px;
    align-self: flex-start;
}

.pg-cart-item__remove:hover {
    color: #ef4444;
}

.pg-cart-drawer__footer {
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    padding: 20px 24px 24px;
    background: #fff;
}

.pg-coupon-box {
    margin-bottom: 16px;
}

.pg-coupon-box__row {
    display: flex;
    gap: 8px;
}

.pg-coupon-box input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}

.pg-coupon-box input[type="text"]:focus {
    border-color: var(--pg-primary, #31a3b9);
}

.pg-coupon-box button {
    padding: 10px 18px;
    border-radius: 9999px;
    border: none;
    background: var(--pg-btn-bg, #0f172a);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.pg-coupon-box button:hover {
    background: var(--pg-btn-hover, #1e293b);
}

.pg-coupon-box__message {
    font-size: 0.75rem;
    margin-top: 8px;
}

.pg-coupon-box__message.is-error { color: #ef4444; }
.pg-coupon-box__message.is-success { color: #16a34a; }

.pg-applied-coupon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 9999px;
    padding: 8px 14px;
    font-size: 0.8rem;
    color: #15803d;
    margin-bottom: 8px;
}

.pg-applied-coupon button {
    background: transparent;
    border: none;
    color: #15803d;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
}

.pg-cart-drawer__totals {
    margin-bottom: 16px;
}

.pg-cart-drawer__totals-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #475569;
    padding: 4px 0;
}

.pg-cart-drawer__totals-row--discount {
    color: #16a34a;
}

.pg-cart-drawer__totals-row--total {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.pg-cart-drawer__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pg-cart-drawer__checkout,
.pg-cart-drawer__view-cart {
    display: block;
    text-align: center;
    padding: 13px;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.pg-cart-drawer__checkout {
    background: var(--pg-btn-bg, #0f172a);
    color: #fff;
    border: 1px solid var(--pg-btn-bg, #0f172a);
}

.pg-cart-drawer__checkout:hover {
    background: var(--pg-btn-hover, #1e293b);
}

.pg-cart-drawer__view-cart {
    background: transparent;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

.pg-cart-drawer__view-cart:hover {
    border-color: var(--pg-primary, #31a3b9);
    color: var(--pg-primary, #31a3b9);
}

body.pg-drawer-open {
    overflow: hidden;
}

/* ==========================================================================
   Variant Swatches (progressive enhancement of variation <select>)
   ========================================================================== */

/* WooCommerce's default variations table lays the attribute label and its
   value side-by-side in one row (<th class="label"> + <td class="value">).
   Stack them instead — label on its own row, swatches below, each
   attribute row spaced consistently. */
table.variations,
table.variations tbody,
table.variations tr {
    display: block;
    width: 100%;
}

table.variations tr + tr {
    margin-top: 18px;
}

table.variations th.label,
table.variations td.value {
    display: block;
    width: 100%;
    padding: 0;
    text-align: left;
    vertical-align: top;
}

table.variations th.label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
    margin-bottom: 8px;
}

table.variations th.label label {
    margin: 0;
}

table.variations td.value {
    margin-bottom: 0;
}

table.variations .reset_variations {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8rem;
}

.pg-swatch-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.pg-swatch-btn {
    padding: 10px 18px;
    border-radius: 9999px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.pg-swatch-btn:hover {
    border-color: var(--pg-primary, #31a3b9);
    color: var(--pg-primary, #31a3b9);
}

.pg-swatch-btn.is-selected {
    border-color: var(--pg-primary, #31a3b9);
    background: var(--pg-primary, #31a3b9);
    color: #fff;
}

.pg-swatch-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

.variations select.pg-swatch-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 480px) {
    #pg-cart-drawer {
        max-width: 100%;
    }
}

/* ==========================================================================
   Checkout Page — order review table, payment methods, terms, place order
   None of this had theme styling before (pure WooCommerce/browser defaults),
   which is why it looked visually disconnected from the rest of the site.
   ========================================================================== */

/* ---- Order review table -> card-style item rows ---- */
/* Wrapped in its own rounded/bordered card so it matches the upsell box
   above it and the payment method cards below it, instead of floating
   between them with no border of its own. */
/*
   A pre-existing inline rule (`.prose .woocommerce-checkout table.shop_table`,
   same WPCode snippet as the payment-method overrides above) forces
   `border-collapse: collapse !important`, and its 3-class selector beats our
   plain 1-class one even with !important on both sides — so our
   border-collapse: separate never actually applied, which silently killed
   the border-radius too (radius has no effect on a collapsed table, a
   standing browser limitation). Reusing that same `.prose .woocommerce-checkout`
   prefix here matches/exceeds its specificity so ours finally wins.
*/
.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table,
.woocommerce-checkout-review-order-table {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 1rem !important;
    padding: 6px 16px !important;
    margin: 20px 0 0 !important;
    background: #fbfcfd;
}

/* Both the theme's base table reset AND the same WPCode `.prose
   .woocommerce-checkout table.shop_table th/td` rule set their own
   border/padding on these cells with !important — reusing that selector
   prefix here (on top of the plain one, for anywhere .prose isn't an
   ancestor) guarantees ours is the one that actually renders. */
.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table th,
.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table td,
.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    border: none !important;
    background: transparent !important;
}

.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table thead th,
.woocommerce-checkout-review-order-table thead th {
    text-align: left !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #94a3b8;
    font-weight: 600;
    padding: 0 0 12px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.woocommerce-checkout-review-order-table thead th.product-total {
    text-align: right;
}

.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table tbody td,
.woocommerce-checkout-review-order-table tbody td {
    padding: 16px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle;
    font-size: 0.9rem;
    color: #0f172a;
}

.woocommerce-checkout-review-order-table tbody td.product-total {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.checkout-product-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkout-product-wrapper img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.checkout-product-name {
    font-weight: 600;
}

.product-quantity {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
}

.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table tfoot th,
.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table tfoot td,
.woocommerce-checkout-review-order-table tfoot th,
.woocommerce-checkout-review-order-table tfoot td {
    padding: 12px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    font-size: 0.88rem;
    text-align: right;
}

.woocommerce-checkout-review-order-table tfoot th {
    text-align: left;
    color: #475569;
    font-weight: 500;
}

.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table tfoot tr.order-total th,
.prose .woocommerce-checkout table.shop_table.woocommerce-checkout-review-order-table tfoot tr.order-total td,
.woocommerce-checkout-review-order-table tfoot tr.order-total th,
.woocommerce-checkout-review-order-table tfoot tr.order-total td {
    border-bottom: none !important;
    padding-top: 16px !important;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.woocommerce-checkout-review-order-table #shipping_method {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

/* ---- Payment methods -> bordered card list instead of a bare <ul> ---- */
/*
   A pre-existing inline stylesheet block (selectors prefixed `.prose
   #payment ...`, printed in wp_head) already restyles this exact markup
   with !important rules, and because it includes the #payment ID its
   specificity beats a plain `.wc_payment_methods li` rule even with
   !important on both sides. Reusing the same `.prose #payment` prefix
   here (plus our own classes) matches/exceeds that specificity so ours
   wins regardless of stylesheet print order — this is the actual fix for
   the payment box touching/overflowing its card edge.
*/
ul.wc_payment_methods {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prose #payment ul.wc_payment_methods > li.wc_payment_method,
ul.wc_payment_methods li.wc_payment_method {
    border: 1.5px solid #e2e8f0 !important;
    border-top: 1.5px solid #e2e8f0 !important;
    border-radius: 1rem !important;
    padding: 14px 16px !important;
    margin: 0 !important;
    transition: border-color 0.15s;
}

ul.wc_payment_methods li.wc_payment_method:has(input:checked) {
    border-color: var(--pg-primary, #31a3b9) !important;
    background: color-mix(in srgb, var(--pg-primary, #31a3b9) 5%, transparent);
}

ul.wc_payment_methods li.wc_payment_method label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #0f172a;
    cursor: pointer;
}

ul.wc_payment_methods li.wc_payment_method label img {
    height: 20px;
    width: auto;
    margin-left: auto;
}

ul.wc_payment_methods li.wc_payment_method input.input-radio {
    width: 18px;
    height: 18px;
    accent-color: var(--pg-primary, #31a3b9);
    flex-shrink: 0;
}

.prose #payment div.payment_box,
.prose #payment ul.wc_payment_methods div.payment_box {
    margin: 12px 0 0 !important;
    padding: 12px 0 0 !important;
    border: none !important;
    border-top: 1px solid #e2e8f0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 0.82rem !important;
    color: #64748b !important;
}

.payment_box p {
    margin: 0;
}

/* ---- Terms checkbox row ---- */
#order_review .form-row.validate-required {
    display: flex;
    align-items: flex-start;
    margin: 20px 0;
}

.woocommerce-form__label-for-checkbox.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
}

.woocommerce-form__input-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--pg-primary, #31a3b9);
    flex-shrink: 0;
}

/* ---- Place order button ---- */
#place_order {
    display: block;
    width: 100%;
    padding: 15px;
    border-radius: 9999px;
    border: none;
    background: var(--pg-btn-bg, #0f172a);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

#place_order:hover {
    background: var(--pg-btn-hover, #1e293b);
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
    .woocommerce-checkout-review-order-table thead {
        display: none;
    }

    .woocommerce-checkout-review-order-table tbody tr,
    .woocommerce-checkout-review-order-table tfoot tr {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .woocommerce-checkout-review-order-table tbody td,
    .woocommerce-checkout-review-order-table tfoot th,
    .woocommerce-checkout-review-order-table tfoot td {
        width: auto;
        padding: 10px 0;
    }

    .checkout-product-wrapper img {
        width: 48px;
        height: 48px;
    }

    ul.wc_payment_methods li.wc_payment_method label img {
        height: 16px;
    }
}
