/* ==========================================================================
   Walley Checkout - fresh design (from checkout-redesign-v2.html)
   All rules scoped under #walley-checkout so site theme styles don't leak in.
   ========================================================================== */

#walley-checkout {
    --teal: #4a9e8e;
    --teal-dark: #3a7e72;
    --teal-light: #e8f4f1;
    --teal-lighter: #f3faf8;
    --text: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #999;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --bg: #ffffff;
    --bg-surface: #fafaf9;
    --green-bg: #e8f4f1;
    --green-text: #2a7a66;
    /* Match simplecheckout / Svea card chrome */
    --card-bg: #fcfefcb0;
    --card-border: #f3f9f6;

    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: visible;
}

/* Sticky sidebar needs ancestors without overflow clipping */
#content:has(#walley-checkout),
#container:has(#walley-checkout) {
    overflow: visible;
}

#walley-checkout *,
#walley-checkout *::before,
#walley-checkout *::after { box-sizing: border-box; }

#walley-checkout .wc-wrapper {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    overflow: visible;
}

/* Trust bar */
#walley-checkout .wc-trust-bar {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
}
#walley-checkout .wc-trust-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}
#walley-checkout .wc-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}
#walley-checkout .wc-trust-item svg { width: 18px; height: 18px; color: var(--teal); flex-shrink: 0; }

/* Add-ons — keep page layout only; defer typography/spacing to module CSS */
#walley-checkout .wc-addons { padding: 32px 0; border-bottom: 1px solid var(--border-light); }
#walley-checkout #optional-fee-discount.box { border: none; background: none; }
#walley-checkout #optional-fee-discount .box-heading,
#walley-checkout #optional-fee-discount .box-heading h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 20px;
    letter-spacing: 0.5px;
    border: none;
    background: none;
    padding: 0;
}
#walley-checkout #optional-fee-discount .box-content {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
}
#walley-checkout #optional-fee-discount .question-block {
    display: block;
    min-width: 0;
    width: auto;
    vertical-align: top;
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 20px 22px 22px;
    background: var(--card-bg);
    box-sizing: border-box;
}
#walley-checkout #optional-fee-discount h4 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.35;
    color: var(--text);
}
#walley-checkout #optional-fee-discount h4 .ofd-heading {
    display: block;
    font-weight: 600;
    font-size: 16px;
}
#walley-checkout #optional-fee-discount h4 .ofd-heading small {
    font-weight: 400;
}
#walley-checkout #optional-fee-discount h4 .ofd-subheading,
#walley-checkout #optional-fee-discount h4 .ofd-subheading small {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--text-secondary);
}
/* Let module label rules win (14px / 600 / native gaps); only light touch-ups */
#walley-checkout #optional-fee-discount label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 10px -5px;
    padding: 0;
    gap: 5px;
    border: none;
    border-radius: 0;
    background: transparent;
    align-items: baseline;
}
#walley-checkout #optional-fee-discount label:last-of-type { margin-bottom: 0; }
#walley-checkout #optional-fee-discount label:hover {
    background: transparent;
    border-color: transparent;
}
#walley-checkout #optional-fee-discount label small {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}
#walley-checkout #optional-fee-discount select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 4px;
}
#walley-checkout .checkout-price-pill,
#walley-checkout #optional-fee-discount small.checkout-price-pill {
    margin-left: auto;
    margin-top: 4px;
    margin-right: 0;
    padding: 4px 10px;
    border-radius: 999px;
    border: 0;
    box-shadow: none;
    background: #dcf1e6;
    color: #2a7a66;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    display: inline-block;
}

/* Main grid */
#walley-checkout .wc-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 48px;
    padding: 40px 0 60px;
    align-items: start;
    overflow: visible;
}
#walley-checkout .wc-section { margin-bottom: 32px; }
#walley-checkout .wc-section-title,
#walley-checkout .wc-faq-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 16px;
    letter-spacing: 0.5px;
    line-height: 1.25;
}

#walley-checkout #walley-iframe-container { min-height: 200px; }
#walley-checkout .wc-loading { color: var(--text-muted); font-size: 13px; padding: 24px 0; text-align: center; }
#walley-checkout .wc-error {
    color: #a3402f;
    background: #fbeae6;
    border: 1px solid #f2c4b9;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    margin-top: 12px;
}
#walley-checkout .wc-retry-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #2a7a66;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
#walley-checkout .wc-retry-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Shipping methods (Mode A) */
#walley-checkout .wc-shipping-list { display: flex; flex-direction: column; gap: 10px; }
#walley-checkout .wc-shipping-option {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border: 2px solid var(--card-border);
    border-radius: 12px;
    background: var(--card-bg);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
#walley-checkout .wc-shipping-option.selected { border-color: var(--teal); background: var(--teal-lighter); }
#walley-checkout .wc-shipping-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
#walley-checkout .wc-shipping-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
#walley-checkout .wc-radio {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--card-border);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 1px;
}
#walley-checkout .wc-shipping-option.selected .wc-radio { border-color: var(--teal); }
#walley-checkout .wc-radio span { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); display: none; }
#walley-checkout .wc-shipping-option.selected .wc-radio span { display: block; }
#walley-checkout .wc-shipping-info { flex: 1; min-width: 0; }
#walley-checkout .wc-shipping-method-title {
    font-size: 12px;
    color: var(--muted, #6b7280);
    margin-bottom: 2px;
}
#walley-checkout .wc-shipping-name { font-weight: 500; font-size: 14px; }
#walley-checkout .wc-shipping-price { flex-shrink: 0; display: flex; align-items: center; }
#walley-checkout .wc-shipping-price .checkout-price-pill {
    margin-left: 0;
    border: 0;
    box-shadow: none;
    background: #dcf1e6;
    color: #2a7a66;
}
#walley-checkout .wc-shipping-desc,
#walley-checkout .wc-shipping-extra {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text, #374151);
    padding-left: 32px;
}
#walley-checkout .wc-shipping-desc select,
#walley-checkout .wc-shipping-extra select {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
}
#walley-checkout .wc-shipping-price .checkout-price-pill {
    margin-left: 0;
}

/* Sidebar column stretches with the left column so the panel has room to stick.
   Sticky is on the panel (title + card), not the shrink-wrapped column alone. */
#walley-checkout .wc-sidebar {
    position: relative;
    align-self: stretch;
    z-index: 5;
}
#walley-checkout .wc-sidebar-panel {
    position: -webkit-sticky;
    position: sticky;
    top: 24px;
}
#walley-checkout .wc-sidebar-panel.is-fixed {
    position: fixed;
    z-index: 20;
    margin: 0;
}
#walley-checkout .wc-sidebar-panel.is-bottom {
    position: absolute;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
}
#walley-checkout .wc-order-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    border: 2px solid var(--card-border);
}
#walley-checkout .wc-order-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}
#walley-checkout .wc-order-item:last-of-type { border-bottom: 0; margin-bottom: 4px; }
#walley-checkout .wc-item-img {
    width: 52px; height: 64px; border-radius: 8px;
    background: #f1ece4; flex-shrink: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
#walley-checkout .wc-item-img img { max-width: 100%; max-height: 100%; object-fit: cover; }
#walley-checkout .wc-item-details { flex: 1; min-width: 0; padding-right: 4px; }
#walley-checkout .wc-item-title {
    margin: 0 0 6px;
}
#walley-checkout .wc-item-brand {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--text-secondary);
}
#walley-checkout .wc-item-name {
    display: block;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    margin-top: 2px;
}
#walley-checkout .wc-item-name:hover,
#walley-checkout .wc-item-name:focus {
    color: var(--text);
    text-decoration: none;
}
#walley-checkout .wc-item-name__core {
    font-weight: 700;
}
#walley-checkout .wc-item-name__meta {
    display: block;
    font-size: 12px;
    font-style: italic;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0;
    margin-top: 1px;
}
#walley-checkout .wc-item-price {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.01em;
    padding-top: 1px;
    text-align: right;
}
#walley-checkout .wc-item-price--promo {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    white-space: normal;
}
#walley-checkout .wc-promo-prices {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}
#walley-checkout .wc-promo-price-old {
    display: block;
    text-decoration: line-through;
    color: var(--text-muted);
    font-weight: 400;
}
#walley-checkout .wc-promo-price-pay {
    display: block;
    font-weight: 700;
    color: var(--text);
}
#walley-checkout .wc-promo-price-pay--free {
    color: var(--green-text);
}
#walley-checkout .wc-promo-save {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--green-text);
    line-height: 1.3;
}
#walley-checkout .wc-promo-badge {
    display: inline-block;
    padding: 2px 7px;
    background: #dcf1e6;
    color: #17876f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 6px;
    line-height: 1.3;
    flex-shrink: 0;
}

/* Qty / remove — compact by default */
#walley-checkout .wc-item-actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 28px;
}
#walley-checkout .wc-qty-label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    line-height: 1;
}
#walley-checkout .wc-qty-ctrl {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: auto;
    max-width: 92px;
    height: 28px;
    padding: 0 2px;
    border-radius: 999px;
    border: 0.5px solid #f3f9f6;
    border-top: 1.5px solid #4c85651c;
    background-color: #fafafa;
    box-shadow: inset 0 -15px 10px #fff, inset 1px 1px 0 rgb(0 0 0 / 2%), 4px 3px 13px 0 rgb(0 0 0 / 3%);
    box-sizing: border-box;
}
#walley-checkout .wc-qty-btn {
    flex: 0 0 24px;
    width: 24px;
    min-width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
    text-shadow: none;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease;
}
#walley-checkout .wc-qty-btn:hover {
    background: #fff;
    color: #111;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
#walley-checkout .wc-qty-btn:active { transform: scale(0.96); }
#walley-checkout .wc-qty-input,
#walley-checkout input.wc-qty-input[type="number"] {
    flex: 0 0 28px !important;
    width: 28px !important;
    min-width: 0 !important;
    max-width: 28px !important;
    height: 26px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    text-align: center;
    font-size: 12px !important;
    font-weight: 500;
    color: var(--text);
    padding: 0 !important;
    box-sizing: border-box;
    -moz-appearance: textfield;
}
#walley-checkout .wc-qty-input:focus { outline: none; }
#walley-checkout .wc-qty-input::-webkit-outer-spin-button,
#walley-checkout .wc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#walley-checkout .wc-item-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease, background 0.15s ease;
}
#walley-checkout .wc-item-remove:hover {
    color: #b42318;
    background: rgba(180, 35, 24, 0.06);
}

/* Desktop: progressive disclosure — idle shows ×qty only; hover reveals controls */
@media (hover: hover) and (pointer: fine) {
    #walley-checkout .wc-qty-ctrl,
    #walley-checkout .wc-item-remove {
        display: none;
    }
    #walley-checkout .wc-qty-label {
        display: inline;
    }
    #walley-checkout .wc-order-item:hover .wc-qty-label,
    #walley-checkout .wc-order-item:focus-within .wc-qty-label {
        display: none;
    }
    #walley-checkout .wc-order-item:hover .wc-qty-ctrl,
    #walley-checkout .wc-order-item:focus-within .wc-qty-ctrl {
        display: inline-flex;
    }
    #walley-checkout .wc-order-item:hover .wc-item-remove,
    #walley-checkout .wc-order-item:focus-within .wc-item-remove {
        display: inline-flex;
    }
}

/* Touch / coarse pointer: always show a quiet compact stepper */
@media (hover: none), (pointer: coarse) {
    #walley-checkout .wc-qty-label { display: none; }
    #walley-checkout .wc-qty-btn:active {
        background: #fff;
        color: #111;
    }
    #walley-checkout .wc-item-remove {
        margin-left: 2px;
        color: var(--text-muted);
        opacity: 0.7;
    }
}

#walley-checkout .wc-totals { margin-top: 8px; }
#walley-checkout .wc-total-line { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; color: var(--text-secondary); }
#walley-checkout .wc-total-final {
    display: flex; justify-content: space-between;
    padding: 12px 0 0; margin-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 16px; font-weight: 600; color: var(--text);
}
#walley-checkout .wc-vat {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
    font-weight: 400;
}

#walley-checkout .wc-trust-strip {
    display: flex; justify-content: center; gap: 16px;
    margin-top: 20px; padding-top: 20px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}
#walley-checkout .wc-trust-strip-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
#walley-checkout .wc-trust-strip-item svg { width: 14px; height: 14px; color: var(--teal); }

/* FAQ */
#walley-checkout .wc-faq { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--border-light); max-width: 640px; }
#walley-checkout .wc-faq-item { border-bottom: 1px solid var(--border-light); }
#walley-checkout .wc-faq-q {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; cursor: pointer; font-size: 13px; font-weight: 500;
}
#walley-checkout .wc-faq-q svg { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
#walley-checkout .wc-faq-item.open .wc-faq-q svg { transform: rotate(180deg); }
#walley-checkout .wc-faq-a { font-size: 13px; color: var(--text-secondary); line-height: 1.7; padding: 0 0 14px; display: none; }
#walley-checkout .wc-faq-item.open .wc-faq-a { display: block; }

/* Responsive */
@media (max-width: 860px) {
    #walley-checkout .wc-grid { grid-template-columns: 1fr; gap: 32px; }
    #walley-checkout .wc-sidebar {
        position: static;
        order: -1;
        align-self: auto;
        z-index: auto;
    }
    #walley-checkout .wc-sidebar-panel {
        position: static;
        top: auto;
    }
    #walley-checkout .wc-sidebar-panel.is-fixed,
    #walley-checkout .wc-sidebar-panel.is-bottom {
        position: static;
        left: auto;
        width: auto;
        top: auto;
        bottom: auto;
    }
    #walley-checkout #optional-fee-discount .box-content { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    #walley-checkout #optional-fee-discount .box-content { grid-template-columns: 1fr; }
    #walley-checkout .wc-trust-inner { gap: 18px; }
}

/* Simple checkout reuses the Walley cart card */
#simplecheckout_cart.simplecheckout-block {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0 0 16px;
}
#simplecheckout_cart #walley-checkout {
    background: transparent;
    overflow: visible;
}
#simplecheckout_cart .wc-item-title .options,
#simplecheckout_cart .wc-item-title small {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}
#simplecheckout_cart .product-warning {
    display: block;
    font-size: 12px;
    color: #c0392b;
    margin-top: 2px;
}
#simplecheckout_cart .simplecheckout-cart-total-remove {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    cursor: pointer;
}
#simplecheckout_cart .simplecheckout-cart-total-remove img {
    width: 10px;
    height: 10px;
}
#simplecheckout_cart .wc-qty-input,
#simplecheckout_cart input.wc-qty-input[type="number"] {
    flex: 0 0 28px !important;
    width: 28px !important;
    min-width: 0 !important;
    max-width: 28px !important;
    height: 26px !important;
    padding: 0 !important;
}
#simplecheckout_cart .wc-item-brand,
#simplecheckout_cart .wc-promo-badge {
    font-size: 10px !important;
}

/* Svea checkout_new reuses the Walley cart card */
#sco-cart {
    overflow: visible;
}
#sco-cart #walley-checkout {
    background: transparent;
    overflow: visible;
}
#sco-cart .wc-item-title .options,
#sco-cart .wc-item-title small {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}
#sco-cart .product-warning {
    display: block;
    font-size: 12px;
    color: #c0392b;
    margin-top: 2px;
}
#sco-cart .wc-qty-input,
#sco-cart input.wc-qty-input[type="number"],
#sco-cart input.checkout-product-qty {
    flex: 0 0 28px !important;
    width: 28px !important;
    min-width: 0 !important;
    max-width: 28px !important;
    height: 26px !important;
    padding: 0 !important;
}
#sco-cart .wc-item-brand,
#sco-cart .wc-promo-badge {
    font-size: 10px !important;
}
