
.opsim-modular-checkout-wrapper {
    margin-top: 10px;
    width: 100%;
    border: 1px solid var(--opsim-brand, #531628);
    border-radius: var(--opsim-radius);
    padding: 15px 15px 8px 15px;
    background: #fff;
}

.opsim-modular-checkout-wrapper .opsim-checkout-header {
    text-align: left;
    margin-bottom: 12px;
}

.opsim-modular-checkout-wrapper .opsim-checkout-header h2 {
    color: var(--opsim-brand, #531628);
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 2px 0;
    text-transform: uppercase;
}

.opsim-modular-checkout-wrapper .opsim-checkout-header p {
    color: #6B7280;
    font-size: 0.8rem;
    margin: 0;
}

.opsim-modular-checkout-wrapper .opsim-quick-checkout-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Input group, icon section, input and the confirm button are NOT defined
   here any more. They are the shared COD form component and live in
   assets/css/modules/cod-form.css, which the checkout page loads too so the
   two forms cannot drift apart. This sheet is a declared dependent of it
   (see inc/woocommerce/checkout/init.php), so it always loads second and can
   still override for the product page only.
   Product-page-only additions to those elements go below, scoped to
   .opsim-modular-checkout-wrapper as usual. */

.opsim-modular-checkout-wrapper .opsim-flag-section {
    width: 95px;
    gap: 6px;
    padding: 0 8px;
}

.opsim-modular-checkout-wrapper .opsim-flag-section svg {
    stroke: none;
    fill: #c1272d;
    width: 18px;
    height: 12px;
}

.opsim-modular-checkout-wrapper .opsim-country-code {
    font-weight: 800;
    font-size: 0.9rem;
    color: #111827;
}

.opsim-modular-checkout-wrapper .opsim-quantity-selector-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fdfdfd;
    border: 1px solid #f0f0f0;
    border-radius: var(--opsim-radius);
    padding: 10px 15px;
    margin-top: 2px;
}

.opsim-modular-checkout-wrapper .opsim-qty-label {
    font-weight: 800;
    font-size: 0.8rem;
    color: #111827;
    text-transform: uppercase;
}

.opsim-modular-checkout-wrapper .opsim-quantity-control {
    /* Three fixed tracks, [ − ][ n ][ + ]: no track is sized by its content,
       so the digit stays centred between two equal buttons at any width. */
    --opsim-qty-btn-w: 32px;
    --opsim-qty-num-w: 40px;
    display: grid;
    grid-template-columns: var(--opsim-qty-btn-w) var(--opsim-qty-num-w) var(--opsim-qty-btn-w);
    align-items: stretch;
    flex: 0 0 auto;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: var(--opsim-radius);
    background: #fff;
    height: 32px;
    overflow: hidden;
}

.opsim-modular-checkout-wrapper .opsim-qty-btn {
    width: 100%;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    color: #111827;
    font-weight: 700;
}

.opsim-modular-checkout-wrapper .opsim-qty-btn:hover {
    background: #f9f9f9;
}

.opsim-modular-checkout-wrapper .opsim-qty-input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 100%;
    border: none !important;
    border-left: 1px solid #e5e7eb !important;
    border-right: 1px solid #e5e7eb !important;
    border-radius: 0;
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: #111827;
    -webkit-text-fill-color: #111827;
    opacity: 1;
    background: #fff;
    padding: 0;
    margin: 0;
    /* The native spinner reserves room on the right and pushes the digit left. */
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.opsim-modular-checkout-wrapper .opsim-qty-input::-webkit-inner-spin-button,
.opsim-modular-checkout-wrapper .opsim-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@media (max-width: 767px) {
    .opsim-modular-checkout-wrapper .opsim-quantity-control {
        --opsim-qty-btn-w: 40px;
        --opsim-qty-num-w: 44px;
        height: 38px;
    }
}

.opsim-modular-checkout-wrapper .opsim-product-variations-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 5px 0;
}

.opsim-modular-checkout-wrapper .opsim-variation-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opsim-modular-checkout-wrapper .opsim-variation-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.opsim-modular-checkout-wrapper .opsim-variation-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #4b5563;
    text-transform: uppercase;
}

.opsim-modular-checkout-wrapper .opsim-selected-variation-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #111827;
}

.opsim-modular-checkout-wrapper .opsim-swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.opsim-modular-checkout-wrapper .opsim-swatch-item {
    min-width: 38px;
    height: 38px;
    border: 1.5px solid #e5e7eb;
    border-radius: var(--opsim-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fff;
    padding: 2.5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.opsim-modular-checkout-wrapper .opsim-swatch-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.opsim-modular-checkout-wrapper .opsim-swatch-item.active {
    border-color: var(--opsim-brand, #531628);
    box-shadow: 0 0 0 1px var(--opsim-brand, #531628);
    background: #fff;
}

.opsim-modular-checkout-wrapper .opsim-swatch-item img,
.opsim-modular-checkout-wrapper .opsim-swatch-color {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--opsim-radius);
    transition: transform 0.2s ease;
}

.opsim-modular-checkout-wrapper .opsim-swatch-item.active img,
.opsim-modular-checkout-wrapper .opsim-swatch-item.active .opsim-swatch-color {
    transform: scale(1);
}

.opsim-modular-checkout-wrapper .opsim-swatch-text {
    font-size: 0.75rem;
    font-weight: 800;
    color: #111827;
    padding: 0 12px;
    white-space: nowrap;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: var(--opsim-radius);
    transition: all 0.2s ease;
}

.opsim-modular-checkout-wrapper .opsim-swatch-item.active .opsim-swatch-text {
    background: rgba(var(--opsim-brand-rgb, 94, 85, 143), 0.1);
    color: var(--opsim-brand, #531628);
}

/*
 * Availability states, written by checkout/js/variations.js on every selection
 * change. They are two different things and read differently on purpose:
 *
 *   .is-out-of-stock  — a real variation the customer simply cannot have right
 *                       now. Struck through, still visible, still tells them
 *                       the colour exists.
 *   .is-unavailable   — no variation combines this value with what is already
 *                       selected. Dimmed and inert, because clicking it could
 *                       only ever produce an invalid selection.
 *
 * The rule below used to be written for a class named `out-of-stock` that
 * nothing ever applied — the old selector never disabled a swatch, so every
 * value looked orderable regardless of stock.
 */
.opsim-modular-checkout-wrapper .opsim-swatch-item.is-out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f1f5f9;
    border-style: solid;
    border-color: #e2e8f0;
}

.opsim-modular-checkout-wrapper .opsim-swatch-item.is-out-of-stock::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top right, transparent calc(50% - 1px), #94a3b8 50%, transparent calc(50% + 1px));
    pointer-events: none;
}

.opsim-modular-checkout-wrapper .opsim-swatch-item.is-unavailable {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
    border-color: #e2e8f0;
}

/* A bundle row whose dropdowns resolve to nothing orderable. */
.opsim-quantity-offer-item .opsim-bundle-item-row.is-unavailable {
    outline: 1.5px solid #ef4444;
    outline-offset: 2px;
}

.opsim-modular-checkout-wrapper .opsim-order-summary-box {
    background: rgba(var(--opsim-brand-rgb, 94, 85, 143), 0.04);
    border: 1px solid rgba(var(--opsim-brand-rgb, 94, 85, 143), 0.1);
    border-radius: var(--opsim-radius);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
}

.opsim-modular-checkout-wrapper .opsim-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #4b5563;
    font-weight: 500;
}

/* Coupon discount. Same row geometry as the others (inherited from
   .opsim-summary-row above); only the colour marks it as money coming off.
   Rendered by Checkout\summary_rows() in inc/woocommerce/checkout/totals.php,
   and absent entirely when there is no discount. */
.opsim-modular-checkout-wrapper .opsim-discount-row,
.opsim-modular-checkout-wrapper .opsim-discount-row span:last-child {
    color: #15803d;
    font-weight: 600;
}

.opsim-modular-checkout-wrapper .opsim-total-row {
    margin-top: 2px;
    padding-top: 6px;
    border-top: 1px solid rgba(var(--opsim-brand-rgb, 94, 85, 143), 0.1);
    font-size: 0.95rem;
    font-weight: 800;
    color: #111827;
}

.opsim-modular-checkout-wrapper .opsim-total-row span:last-child {
    color: var(--opsim-brand, #531628);
}

/* Confirm Button — base style lives in assets/css/base.css (button contract);
   size, the two-line content block and the loading spinner live in the shared
   assets/css/modules/cod-form.css. Only the out-of-stock state, which exists
   on the product page alone, is left here. */
.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.is-out-of-stock {
    background-color: #9ca3af !important;
    /* keeps the contract's brand-tinted border from showing on a grey button */
    border-color: color-mix(in srgb, #9ca3af 70%, transparent) !important;
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.opsim-modular-checkout-wrapper .opsim-form-message {
    font-size: 0.8rem;
    text-align: center;
    font-weight: 600;
}
.opsim-modular-checkout-wrapper .opsim-form-message:empty {
    display: none;
}
.opsim-modular-checkout-wrapper .opsim-form-message:not(:empty) {
    margin-top: 5px;
}
/* Errors only: the success state was removed with the message that used to
   print above the submit button on a completed order. */
.opsim-modular-checkout-wrapper .opsim-form-message.error { color: #dc2626; }

@media (min-width: 992px) {
    .opsim-modular-checkout-wrapper .opsim-checkout-header {
        text-align: left;
    }
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.anim-pulse {
    animation: opsim-pulse 4s infinite ease-in-out;
}
@keyframes opsim-pulse {
    0%, 50%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(1.04); }
    20%, 40% { transform: scale(1); }
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.anim-shake {
    animation: opsim-shake 4s infinite ease-in-out;
}
@keyframes opsim-shake {
    0%, 40%, 100% { transform: translateX(0); }
    5%, 15%, 25%, 35% { transform: translateX(-2px); }
    10%, 20%, 30% { transform: translateX(2px); }
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.anim-glow {
    animation: opsim-glow 4s infinite ease-in-out;
}
@keyframes opsim-glow {
    0%, 50%, 100% { box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
    15%, 35% { box-shadow: 0 0 15px rgba(255, 255, 255, 0.5), 0 0 10px var(--opsim-brand, #531628); }
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.anim-bounce {
    animation: opsim-bounce 4s infinite ease-in-out;
}
@keyframes opsim-bounce {
    0%, 10%, 25%, 40%, 50%, 100% { transform: translateY(0); }
    5%, 20% { transform: translateY(-5px); }
    15%, 30% { transform: translateY(-2px); }
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.anim-shimmer {
    position: relative;
    overflow: hidden;
}
.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.anim-shimmer::before {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: opsim-shimmer 4s infinite linear;
}
@keyframes opsim-shimmer {
    0% { left: -150%; }
    40%, 100% { left: 150%; }
}

@media (max-width: 767px) {
    .opsim-modular-checkout-wrapper {
        padding: 12px 10px;
    }

    .opsim-checkout-header {
        margin-bottom: 12px;
    }

    .opsim-checkout-header h2 {
        font-size: 13.5px !important;
        font-weight: 600 !important;
        letter-spacing: 0.3px;
        margin-bottom: 2px;
    }

    .opsim-checkout-header p {
        font-size: 11.5px !important;
        line-height: 1.4;
    }

    /* Field height and button proportions: shared component, see
       assets/css/modules/cod-form.css. This extra bottom margin is not part
       of it — it stacks on the form's 8px flex gap for a 16px rhythm, which
       is this form's own mobile spacing and not the checkout page's. */
    .opsim-modular-checkout-wrapper .opsim-checkout-input-group {
        margin-bottom: 8px;
    }

    .opsim-modular-checkout-wrapper .opsim-checkout-input {
        font-size: 12.5px !important;
        padding-left: 36px;
    }

    .opsim-modular-checkout-wrapper .opsim-field-icon {
        width: 15px;
        height: 15px;
        left: 11px;
    }

    .opsim-modular-checkout-wrapper .opsim-quantity-box {
        margin: 10px 0;
    }

    .opsim-modular-checkout-wrapper .opsim-quantity-label {
        font-size: 12px !important;
        font-weight: 500;
    }

    .opsim-modular-checkout-wrapper .opsim-quantity-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }

    .opsim-modular-checkout-wrapper .opsim-quantity-input {
        width: 36px !important;
        height: 32px !important;
        font-size: 12.5px !important;
    }

    .opsim-modular-checkout-wrapper .opsim-summary-table {
        margin: 10px 0;
        font-size: 12px;
    }
}
