/* CODwo Product Form - Unified UI */

:root {
    --codwo-bg: #f4f7fa;
    --codwo-surface: #ffffff;
    --codwo-surface-muted: #f8fafc;
    --codwo-border: #d7dee8;
    --codwo-border-strong: #c5d0dd;
    --codwo-text: #112132;
    --codwo-text-muted: #4f6275;
    --codwo-primary: #0f4c81;
    --codwo-primary-strong: #0b3b65;
    --codwo-button-bg: var(--codwo-primary);
    --codwo-button-bg-hover: var(--codwo-primary-strong);
    --codwo-button-text: #ffffff;
    --codwo-title-color: var(--codwo-text);
    --codwo-success: #1f7a5a;
    --codwo-success-soft: #e9f5ef;
    --codwo-danger: #c03d3d;
    --codwo-danger-soft: #fbefef;
    --codwo-shadow: 0 10px 28px rgba(12, 30, 52, 0.08);
    --codwo-radius: 14px;
}

.codwo-product-form-wrapper,
.codwo-product-form-wrapper * {
    box-sizing: border-box;
}

.codwo-product-form-wrapper {
    max-width: 640px;
    margin: 32px auto;
    padding: var(--codwo-form-padding, 32px);
    border-radius: var(--codwo-radius);
    background: var(--codwo-surface);
    border: 1px solid var(--codwo-border);
    box-shadow: var(--codwo-shadow);
    color: var(--codwo-text);
    font-family: "Inter", "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.codwo-layout-modern {
    background: var(--codwo-surface);
}

.codwo-layout-minimal {
    background: var(--codwo-surface);
    box-shadow: none;
    padding: var(--codwo-form-padding, 24px);
    border-radius: 12px;
}

.codwo-layout-minimal .codwo-form-title {
    text-align: start;
    font-size: 26px;
    margin-bottom: 12px;
}

.codwo-layout-minimal .codwo-form-description {
    text-align: start;
    margin-bottom: 18px;
}

.codwo-layout-minimal .codwo-promotions-banner {
    margin-bottom: 18px;
}

.codwo-layout-minimal .codwo-form-product-media {
    justify-content: flex-start;
}

.codwo-layout-minimal .codwo-trust-badges {
    display: none;
}

.codwo-is-hidden {
    display: none;
}

.codwo-promotions-banner {
    display: grid;
    gap: 10px;
    margin-bottom: 6px;
}

.codwo-promo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--codwo-promo-bg, var(--codwo-primary));
    color: #fff;
}

.codwo-promo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 14px;
    flex-shrink: 0;
}

.codwo-promo-content strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

.codwo-promo-content p {
    margin: 0;
    font-size: 13px;
    opacity: 0.95;
    line-height: 1.35;
}

.codwo-modern-form,
.codwo-minimal-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.codwo-product-form button,
.codwo-product-form input[type="button"],
.codwo-product-form input[type="submit"] {
    -webkit-appearance: none;
    appearance: none;
    background-image: none !important;
    text-shadow: none !important;
}

.codwo-form-title {
    margin: 0 0 14px;
    text-align: center;
    font-size: var(--codwo-font-size-title, 34px);
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 800;
    color: var(--codwo-title-color, var(--codwo-text));
}

.codwo-form-description {
    margin: -6px 0 14px;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    color: var(--codwo-text-muted);
}

.codwo-form-product-media {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.codwo-form-product-media img {
    width: min(100%, 220px);
    border-radius: 14px;
    border: 1px solid var(--codwo-border);
    box-shadow: 0 6px 16px rgba(12, 30, 52, 0.08);
    object-fit: cover;
}

.codwo-variations-section,
.codwo-promo-selector-section,
.codwo-quantity-section,
.codwo-form-fields,
.codwo-captcha-wrapper,
.codwo-order-summary,
.codwo-otp-section,
.codwo-bank-transfer-section,
.codwo-coupon-section {
    margin-bottom: 6px;
}

/* Field-to-field gap inside the form. Controlled by --codwo-field-gap. */
.codwo-form-fields {
    display: flex;
    flex-direction: column;
    gap: var(--codwo-field-gap, 14px);
}
.codwo-form-fields > .codwo-field-group {
    margin-bottom: 0;
}

.codwo-variations-section h4,
.codwo-promo-selector-section h4,
.codwo-bank-transfer-section h4 {
    margin: 0 0 14px;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--codwo-text);
}

.codwo-variation-group {
    margin-bottom: 16px;
}

.codwo-variation-group label,
.codwo-quantity-section label,
.codwo-field-group label,
.codwo-simple-captcha label {
    display: block;
    margin-bottom: 8px;
    font-size: var(--codwo-font-size-label, 14px);
    font-weight: 600;
    color: var(--codwo-text);
}

.codwo-variation-select,
.codwo-field-group input[type="text"],
.codwo-field-group input[type="tel"],
.codwo-field-group input[type="email"],
.codwo-field-group input[type="number"],
.codwo-field-group input[type="file"],
.codwo-field-group textarea,
.codwo-captcha-input,
.codwo-otp-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--codwo-border-strong);
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.2;
    color: var(--codwo-text);
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    font-family: inherit;
}

.codwo-field-group textarea {
    min-height: 88px;
    resize: vertical;
}

.codwo-variation-select:focus,
.codwo-field-group input:focus,
.codwo-field-group textarea:focus,
.codwo-captcha-input:focus,
.codwo-otp-input:focus {
    outline: none;
    border-color: var(--codwo-primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}

.codwo-field-group input.error,
.codwo-field-group textarea.error {
    border-color: var(--codwo-danger);
    box-shadow: 0 0 0 3px rgba(192, 61, 61, 0.13);
}

.codwo-field-group input.success,
.codwo-field-group textarea.success {
    border-color: var(--codwo-success);
    box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.14);
}

.codwo-field-error {
    display: block;
    min-height: 18px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--codwo-danger);
}

.codwo-required,
.codwo-field-group .required {
    color: var(--codwo-danger);
}

.codwo-variation-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid var(--codwo-border);
    border-radius: 10px;
    background: var(--codwo-surface-muted);
    flex-wrap: wrap;
}

.codwo-variation-price {
    color: var(--codwo-text);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.codwo-variation-stock {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
/* State colours on the inline variation stock badge (matches .codwo-stock-badge) */
.codwo-variation-stock.codwo-stock--in {
    background: rgba(22, 163, 74, 0.12);
    color: #0f7a40;
}
.codwo-variation-stock.codwo-stock--low {
    background: rgba(239, 108, 0, 0.15);
    color: #9a4a04;
}
.codwo-variation-stock.codwo-stock--low::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.22);
    animation: codwo-variation-stock-pulse 1.6s ease-in-out infinite;
}
.codwo-variation-stock.codwo-stock--out {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
}
@keyframes codwo-variation-stock-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.22); }
    50%      { box-shadow: 0 0 0 5px rgba(234, 88, 12, 0.0); }
}

.codwo-in-stock,
.codwo-variation-stock.in-stock {
    color: var(--codwo-success);
    font-weight: 600;
}

.codwo-out-of-stock,
.codwo-variation-stock.out-of-stock {
    color: var(--codwo-danger);
    font-weight: 600;
}

.codwo-promo-options {
    display: grid;
    gap: 14px;
}

.codwo-promo-option {
    border: 1px solid var(--codwo-border-strong);
    border-radius: 14px;
    background: #fff;
    background-image: none !important;
    text-align: start;
    padding: 16px;
    cursor: pointer;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: start;
    column-gap: 14px;
    row-gap: 6px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
    box-shadow: none;
    outline: none;
    text-decoration: none !important;
    color: var(--codwo-text);
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.25;
    text-transform: none !important;
    letter-spacing: normal !important;
    position: relative;
    min-height: 126px;
    height: auto !important;
    overflow: visible;
}

.codwo-promo-option:hover {
    background: #fff !important;
    border-color: var(--codwo-primary);
    box-shadow: 0 8px 20px rgba(15, 76, 129, 0.12);
}

.codwo-promo-option.selected {
    border-color: var(--codwo-success);
    background: var(--codwo-success-soft) !important;
    box-shadow: 0 8px 18px rgba(31, 122, 90, 0.18);
}

.codwo-promo-option.selected:hover {
    border-color: var(--codwo-success);
    background: var(--codwo-success-soft) !important;
}

.codwo-promo-option:focus,
.codwo-promo-option:active {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.22);
}

.codwo-promo-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.26);
}

.codwo-promo-option.disabled,
.codwo-promo-option:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.codwo-promo-option-media {
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: center;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--codwo-border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.codwo-promo-option-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.codwo-promo-option-main {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.codwo-promo-option-title {
    color: var(--codwo-text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0;
    position: static !important;
    float: none !important;
    text-decoration: none !important;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    unicode-bidi: plaintext;
}

.codwo-promo-option-subtitle {
    color: var(--codwo-text-muted);
    font-size: 14px;
    line-height: 1.3;
    margin: 0;
    position: static !important;
    float: none !important;
    text-decoration: none !important;
    unicode-bidi: plaintext;
}

.codwo-promo-option-badge {
    width: fit-content;
    padding: 4px 10px;
    border-radius: 8px;
    background: #179a34;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    font-weight: 800;
}

.codwo-promo-option-pricing {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-width: 0;
}

.codwo-promo-option-price,
.codwo-promo-option-new-price {
    color: var(--codwo-success);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
    margin: 0;
    position: static !important;
    float: none !important;
    text-decoration: none !important;
    unicode-bidi: plaintext;
}

.codwo-promo-option-old-price {
    color: #7f8b99;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: line-through;
    unicode-bidi: plaintext;
}

.codwo-promo-option-recommended {
    grid-column: 2;
    grid-row: 3;
    justify-self: start;
    display: none;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f08a24;
    color: #fff;
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
    width: fit-content;
}

.codwo-promo-option.is-highlighted .codwo-promo-option-recommended {
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-promo-option {
    grid-template-columns: minmax(0, 1fr) 72px;
    text-align: right;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-media {
    grid-column: 2;
    grid-row: 1 / span 3;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-main,
.codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-pricing,
.codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-recommended {
    grid-column: 1;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-pricing {
    justify-content: flex-end;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-recommended {
    justify-self: end;
}

.codwo-quantity-controls {
    display: inline-flex;
    align-items: stretch;
    max-width: 164px;
    border-radius: 10px;
    overflow: hidden;
}

.codwo-qty-minus,
.codwo-qty-plus {
    width: 44px;
    height: 42px;
    border: 1px solid var(--codwo-border-strong);
    background: var(--codwo-surface-muted);
    color: var(--codwo-text);
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    /* Reset all four corners first, then round only the outer (inline-end) edge below. */
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

/* .codwo-qty-minus is the FIRST flex child → it sits on the inline-start (left in LTR, right in RTL).
   Round the two inline-start corners so the rounded edge always faces outward. */
.codwo-qty-minus {
    border-start-start-radius: 10px;
    border-end-start-radius: 10px;
    border-inline-end: 0;
}

/* .codwo-qty-plus is the LAST flex child → it sits on the inline-end (right in LTR, left in RTL).
   Round the two inline-end corners. */
.codwo-qty-plus {
    border-start-end-radius: 10px;
    border-end-end-radius: 10px;
    border-inline-start: 0;
}

.codwo-qty-minus:hover,
.codwo-qty-plus:hover {
    border-color: var(--codwo-primary);
    background: #eef4fb;
    color: var(--codwo-primary);
    z-index: 1;
}

.codwo-quantity-controls input {
    width: 76px;
    height: 44px;
    text-align: center;
    border: 1px solid var(--codwo-border-strong);
    border-inline: 0;
    border-radius: 0;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--codwo-text);
    padding: 0;
    background: #fff;
    -moz-appearance: textfield;
    appearance: textfield;
}
.codwo-quantity-controls input::-webkit-outer-spin-button,
.codwo-quantity-controls input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.codwo-quantity-controls input:focus {
    outline: none;
    border-color: var(--codwo-primary);
    box-shadow: inset 0 0 0 1px var(--codwo-primary);
    z-index: 1;
}

.codwo-captcha-wrapper {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--codwo-border);
    background: var(--codwo-surface-muted);
}

.codwo-captcha-label {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
}

.codwo-captcha-question-text {
    unicode-bidi: plaintext;
    direction: auto;
    font-size: 15px;
    font-weight: 700;
}

.codwo-captcha-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.codwo-captcha-input {
    width: 100% !important;
    max-width: 170px;
    display: inline-block !important;
    margin-inline-end: 0;
    text-align: center;
    font-weight: 700;
    -moz-appearance: textfield;
    appearance: textfield;
}

.codwo-captcha-input::-webkit-outer-spin-button,
.codwo-captcha-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.codwo-captcha-input:invalid {
    border-color: var(--codwo-border-strong);
    box-shadow: none;
}

.codwo-captcha-input:focus:invalid {
    border-color: var(--codwo-primary);
}

.codwo-refresh-captcha {
    border: 1px solid var(--codwo-border-strong);
    background: #fff;
    color: var(--codwo-text);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.codwo-refresh-captcha:hover {
    border-color: var(--codwo-primary);
    color: var(--codwo-primary);
}

.codwo-recaptcha-notice {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--codwo-text-muted);
}

.codwo-otp-section {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--codwo-border);
    background: var(--codwo-surface-muted);
}

.codwo-bank-transfer-section {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #b8cde4;
    background: #f4f8ff;
}

.codwo-bank-transfer-details {
    margin: 0 0 10px;
    padding: 12px;
    border-radius: 10px;
    border: 1px dashed #9fbce0;
    background: #fff;
    font-size: 14px;
    line-height: 1.5;
    color: var(--codwo-text);
}

.codwo-bank-transfer-instructions {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--codwo-text-muted);
}

.codwo-field-bank-transfer-proof input[type="file"] {
    padding: 10px;
    cursor: pointer;
}

.codwo-bank-transfer-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--codwo-text-muted);
}

.codwo-bank-transfer-file-name {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--codwo-success);
    font-weight: 600;
}

.codwo-otp-section.verified {
    border-color: #b6e1d1;
    background: var(--codwo-success-soft);
}

.codwo-otp-actions,
.codwo-otp-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.codwo-otp-status {
    font-size: 13px;
}

.codwo-status-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.codwo-status-text.success {
    color: var(--codwo-success);
}

.codwo-status-text.error {
    color: var(--codwo-danger);
}

.codwo-status-text.loading {
    color: var(--codwo-primary);
}

.codwo-btn-secondary,
.codwo-submit-btn {
    border: 1px solid var(--codwo-button-bg);
    border-radius: 10px;
    background: var(--codwo-button-bg);
    color: var(--codwo-button-text);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.codwo-btn-secondary:hover,
.codwo-submit-btn:hover {
    background: var(--codwo-button-bg-hover);
    border-color: var(--codwo-button-bg-hover);
    color: var(--codwo-button-text);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
    transform: translateY(-1px);
}

.codwo-submit-btn,
.codwo-submit-btn:hover,
.codwo-submit-btn:focus,
.codwo-submit-btn:active {
    color: var(--codwo-button-text);
}

.codwo-btn-secondary:disabled,
.codwo-submit-btn:disabled {
    opacity: 0.68;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================================
   Out-of-stock form gate — freezes the entire form consistently
   across all skins (Bold / Card / COD which re-declare bg rules
   can't override these because we use !important on key paths).
   ============================================================ */

/* Primary action buttons (submit / WhatsApp / Add-to-Cart) */
.codwo-form-oos .codwo-submit-btn,
.codwo-form-oos .codwo-submit-btn:hover,
.codwo-form-oos .codwo-whatsapp-btn,
.codwo-form-oos .codwo-whatsapp-btn:hover,
.codwo-form-oos .codwo-add-to-cart-btn,
.codwo-form-oos .codwo-add-to-cart-btn:hover {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    transform: none !important;
    filter: grayscale(0.6);
    pointer-events: none;
}

/* Freeze inputs, textareas, selects (except variation dropdowns) */
.codwo-form-oos input:not([type="hidden"]):not([name^="attribute_"]),
.codwo-form-oos textarea,
.codwo-form-oos select:not([name^="attribute_"]) {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--codwo-surface-muted, #f3f4f6) !important;
    color: var(--codwo-text-muted, #6b7280) !important;
    pointer-events: none;
}

/* Promo / bundle option cards, swatches, quantity controls, FBT + Extras */
.codwo-form-oos .codwo-promo-option,
.codwo-form-oos .codwo-swatch-item,
.codwo-form-oos .codwo-qty-plus,
.codwo-form-oos .codwo-qty-minus,
.codwo-form-oos .codwo-fbt-card,
.codwo-form-oos .codwo-extra-row,
.codwo-form-oos .codwo-coupon-toggle {
    opacity: 0.55;
    cursor: not-allowed !important;
    pointer-events: none;
    filter: grayscale(0.3);
}

/* Section labels + helper text dim too, but slightly less, so the form
   still reads as a form rather than a wall of grey blobs. */
.codwo-form-oos .codwo-field-group label,
.codwo-form-oos .codwo-variation-group label,
.codwo-form-oos .codwo-quantity-section label,
.codwo-form-oos .codwo-promo-selector-section h4,
.codwo-form-oos .codwo-order-summary,
.codwo-form-oos .codwo-form-product-price,
.codwo-form-oos .codwo-form-description {
    opacity: 0.75;
}

/* The variation block stays FULLY interactive so shoppers can keep
   trying combinations until they find one that's in stock. */
.codwo-form-oos .codwo-variations-section,
.codwo-form-oos .codwo-variations-section * {
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
}
.codwo-form-oos .codwo-variation-group label {
    opacity: 1;
}

/* Product-level OOS indicator on the wrapper — skins can tint further */
.codwo-product--oos .codwo-product-header,
.codwo-product--oos .codwo-form-product-price {
    position: relative;
}

.codwo-btn-secondary {
    padding: 10px 16px;
    font-size: 14px;
}

/* `.codwo-btn-link` styles are !important because some themes apply a generic
   `button:hover { color: red }` (or a global link-hover) that wins on
   specificity. We pin the color to the form's primary palette in every state. */
.codwo-btn-link,
.codwo-btn-link:link,
.codwo-btn-link:visited {
    border: none !important;
    background: transparent !important;
    color: var(--codwo-primary) !important;
    text-decoration: underline !important;
    text-decoration-color: var(--codwo-primary) !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 4px;
    box-shadow: none !important;
}

.codwo-btn-link:hover,
.codwo-btn-link:focus,
.codwo-btn-link:active {
    color: var(--codwo-primary-strong, var(--codwo-primary)) !important;
    text-decoration-color: var(--codwo-primary-strong, var(--codwo-primary)) !important;
    background: transparent !important;
    opacity: 0.9;
}

.codwo-order-summary {
    border: 1px solid var(--codwo-border);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--codwo-surface-muted);
    direction: inherit;
}

.codwo-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    font-size: 14px;
    color: var(--codwo-text-muted);
    border-bottom: 1px solid #e7edf3;
}

.codwo-summary-row > :first-child {
    text-align: start;
}

.codwo-summary-row > :last-child {
    text-align: end;
    unicode-bidi: isolate;
}

.codwo-summary-row:last-child {
    border-bottom: 0;
}

.codwo-summary-row strong,
.codwo-subtotal-price,
.codwo-quantity-display {
    color: var(--codwo-text);
}

.codwo-total-row {
    padding-top: 12px;
    margin-top: 5px;
    border-top: 1px solid var(--codwo-border-strong);
    font-size: 18px;
}

.codwo-total-price {
    color: var(--codwo-success);
    font-size: 22px;
    font-weight: 800;
}

.codwo-discount-row,
.codwo-discount-label,
.codwo-discount-row .codwo-discount-amount {
    color: var(--codwo-success);
    font-weight: 700;
}

.codwo-discount-badge {
    display: inline-block;
    margin-inline-start: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--codwo-danger);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
}

.codwo-form-messages {
    margin-bottom: 16px;
}
.codwo-form-messages:empty {
    display: none;
}

.codwo-message {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.35;
    border: 1px solid transparent;
}

.codwo-message.success {
    color: #15523d;
    background: #e9f5ef;
    border-color: #bee0cf;
}

.codwo-message.error {
    color: #7f2a2a;
    background: var(--codwo-danger-soft);
    border-color: #e5bcbc;
}

.codwo-submit-btn {
    width: 100%;
    padding: var(--codwo-btn-padding-y, 14px) var(--codwo-btn-padding-x, 16px);
    font-size: var(--codwo-font-size-button, 16px);
    text-transform: none;
    letter-spacing: 0;
}

.codwo-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff !important;
    background: #25D366 !important;
    border: 1px solid #25D366 !important;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.codwo-whatsapp-btn:hover,
.codwo-whatsapp-btn:focus,
.codwo-whatsapp-btn:active {
    color: #ffffff !important;
    background: #1ebe5d !important;
    border-color: #1ebe5d !important;
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.28);
    transform: translateY(-1px);
}

.codwo-whatsapp-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #ffffff;
}

.codwo-woo-cart-fallback {
    margin-top: 3px;
}

.codwo-woo-cart-fallback .codwo-woo-cart-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--codwo-text-muted);
}

.codwo-woo-cart-fallback .codwo-woo-cart-divider::before,
.codwo-woo-cart-fallback .codwo-woo-cart-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--codwo-border);
}

.codwo-add-to-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: var(--codwo-text) !important;
    background: #ffffff !important;
    border: 1.5px solid var(--codwo-border-strong, #d6d6d6) !important;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
    text-transform: none;
    letter-spacing: 0;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.codwo-add-to-cart-btn:hover,
.codwo-add-to-cart-btn:focus {
    background: var(--codwo-surface-muted, #f7f7f8) !important;
    border-color: var(--codwo-text, #111) !important;
    color: var(--codwo-text, #111) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
    outline: none;
}

.codwo-add-to-cart-btn:disabled,
.codwo-add-to-cart-btn.is-loading {
    opacity: 0.75;
    cursor: progress;
    transform: none;
    box-shadow: none;
}

.codwo-add-to-cart-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 16px;
    line-height: 1;
}

.codwo-add-to-cart-btn__label {
    line-height: 1;
}

.codwo-add-to-cart-btn__spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: codwo-atc-spin 0.7s linear infinite;
}

.codwo-add-to-cart-btn.is-loading .codwo-add-to-cart-btn__spinner {
    display: inline-block;
}

.codwo-add-to-cart-btn.is-loading .codwo-add-to-cart-btn__icon {
    display: none;
}

@keyframes codwo-atc-spin {
    to { transform: rotate(360deg); }
}

.codwo-add-to-cart-status {
    min-height: 0;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--codwo-text-muted, #6b7280);
    text-align: center;
}

.codwo-add-to-cart-status.is-success {
    color: #0f7a3a;
    font-weight: 600;
}

.codwo-add-to-cart-status.is-error {
    color: #b42318;
    font-weight: 600;
}

.codwo-add-to-cart-status a {
    color: inherit;
    text-decoration: underline;
    font-weight: 700;
}

.codwo-whatsapp-btn__icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.codwo-whatsapp-btn__label {
    line-height: 1;
}

.codwo-btn-text,
.codwo-btn-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.codwo-btn-loading {
    display: none;
}

.codwo-btn-price {
    font-weight: 800;
}

.codwo-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.32);
    border-top-color: #fff;
    border-radius: 50%;
    animation: codwo-spin 0.8s linear infinite;
}

.codwo-trust-badges {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--codwo-border);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.codwo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--codwo-border);
    border-radius: 10px;
    background: #fff;
    color: var(--codwo-text-muted);
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.codwo-badge-icon {
    color: var(--codwo-primary);
    font-size: 14px;
}

body.codwo-modal-open {
    overflow: hidden;
}

.codwo-upsell-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(11, 24, 39, 0.62);
}

.codwo-upsell-modal {
    width: min(560px, 100%);
    max-height: 90vh;
    overflow: auto;
    border-radius: 14px;
    border: 1px solid var(--codwo-border);
    background: #fff;
    box-shadow: 0 24px 50px rgba(10, 20, 32, 0.28);
    padding: 22px;
    position: relative;
}

.codwo-upsell-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
}

.codwo-upsell-close:hover {
    color: var(--codwo-text);
}

.codwo-upsell-modal h3 {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--codwo-text);
}

.codwo-upsell-message {
    margin: 0 0 16px;
    color: var(--codwo-text-muted);
    line-height: 1.45;
    font-size: 14px;
}

.codwo-upsell-products {
    display: grid;
    gap: 10px;
}

/* Upsell-modal item — same badge-style selection language as the FBT cards.
   Native checkbox is visually hidden; tick badge is a ::before pseudo on the
   label that overflows the corner, JS toggles `.is-selected` on change. */
.codwo-upsell-product-item {
    position: relative;
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid var(--codwo-border);
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    isolation: isolate;
}

.codwo-upsell-product-item:hover {
    border-color: var(--codwo-primary);
}

/* Overlapping tick badge */
.codwo-upsell-product-item::before {
    content: "";
    position: absolute;
    top: -10px;
    inset-inline-end: -10px;
    width: 26px;
    height: 26px;
    border: 2px solid var(--codwo-border-strong, #c8cfd8);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 0 0 3px #ffffff, 0 2px 6px rgba(15, 34, 54, 0.12);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 3;
    pointer-events: none;
}
.codwo-upsell-product-item:hover::before {
    border-color: var(--codwo-primary);
}

.codwo-upsell-product-item.is-selected {
    border-width: 3.5px;
    border-color: var(--codwo-primary);
    background: color-mix(in srgb, var(--codwo-primary) 5%, #ffffff);
    box-shadow: 0 8px 20px rgba(15, 34, 54, 0.08);
}
.codwo-upsell-product-item.is-selected::before {
    background-color: var(--codwo-primary);
    border-color: var(--codwo-primary);
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12 10 18 20 6'/%3E%3C/svg%3E");
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
    transform: scale(1.06);
    box-shadow: 0 0 0 3px #ffffff, 0 3px 10px rgba(15, 34, 54, 0.18);
}

/* Hide the native checkbox completely so no glyph/native UI can leak in.
   The label still toggles it via the standard label/input association. */
.codwo-upsell-item-checkbox,
input[type="checkbox"].codwo-upsell-item-checkbox {
    position: absolute !important;
    top: 0 !important;
    inset-inline-end: 0 !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}

.codwo-upsell-product-image img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--codwo-border);
}

.codwo-upsell-product-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.codwo-upsell-product-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--codwo-text);
}

.codwo-upsell-product-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--codwo-success);
}

.codwo-upsell-product-prices {
    display: flex;
    align-items: center;
    gap: 8px;
}

.codwo-upsell-old-price {
    color: #748093;
    text-decoration: line-through;
    font-size: 13px;
}

.codwo-upsell-new-price {
    color: var(--codwo-success);
    font-size: 18px;
    line-height: 1;
}

.codwo-upsell-actions {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.codwo-upsell-actions .codwo-btn-secondary {
    width: 100%;
}

.codwo-swipe-captcha-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(11, 24, 39, 0.68);
}

.codwo-swipe-captcha-modal {
    width: min(460px, 100%);
    border-radius: 14px;
    border: 1px solid var(--codwo-border);
    background: #fff;
    box-shadow: 0 24px 50px rgba(10, 20, 32, 0.28);
    padding: 22px;
    position: relative;
}

.codwo-swipe-captcha-modal h3 {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--codwo-text);
}

.codwo-swipe-captcha-message {
    margin: 0 0 14px;
    color: var(--codwo-text-muted);
    line-height: 1.45;
    font-size: 14px;
}

/* Puzzle scene (upper canvas + piece) */
.codwo-puzzle-scene {
    position: relative;
    width: 280px;
    max-width: 100%;
    height: 160px;
    margin: 0 auto 14px;
    border-radius: 12px;
    overflow: hidden;
    background: #111827;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 16px rgba(15, 23, 42, 0.18);
    user-select: none;
    touch-action: none;
    direction: ltr;
}
.codwo-puzzle-bg {
    display: block;
    width: 100%;
    height: 100%;
}
.codwo-puzzle-piece {
    position: absolute;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    pointer-events: none;
    transition: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    will-change: left;
}

.codwo-swipe-track {
    position: relative;
    width: 100%;
    height: 56px;
    border-radius: 999px;
    border: 1px solid var(--codwo-border-strong);
    background: #f2f5f9;
    overflow: hidden;
    direction: ltr;
    user-select: none;
    touch-action: none;
}

.codwo-swipe-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: #d8ecdf;
    transition: width 0.12s ease;
}

.codwo-swipe-instruction {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 66px;
    font-size: 14px;
    font-weight: 700;
    color: #51657a;
    pointer-events: none;
    white-space: nowrap;
}

.codwo-swipe-thumb {
    position: absolute;
    left: 0;
    top: 0;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 999px;
    background: var(--codwo-primary);
    color: #fff;
    cursor: grab;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transform: translateX(0px);
    transition: transform 0.12s ease;
}

.codwo-swipe-thumb:active {
    cursor: grabbing;
}

.codwo-swipe-status {
    min-height: 20px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
}

.codwo-swipe-status.success {
    color: var(--codwo-success);
}

.codwo-swipe-status.error {
    color: var(--codwo-danger);
}

.codwo-swipe-actions {
    margin-top: 12px;
}

@keyframes codwo-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 767px) {
    .codwo-product-form-wrapper {
        margin: 16px auto;
        padding: 18px;
        border-radius: 0;
    }

    .codwo-form-title {
        font-size: 28px;
    }

    .codwo-trust-badges {
        grid-template-columns: 1fr;
    }

    .codwo-promo-option {
        grid-template-columns: 56px minmax(0, 1fr);
        gap: 10px;
        padding: 12px;
        min-height: 0;
    }

    .codwo-promo-option-media {
        width: 56px;
        height: 56px;
    }

    .codwo-promo-option-pricing {
        grid-column: 2;
        grid-row: 2;
        align-items: flex-start;
        gap: 6px 10px;
        padding-top: 0;
    }

    .codwo-promo-option-title {
        font-size: 14px;
    }

    .codwo-promo-option-new-price {
        font-size: 16px;
    }

    .codwo-promo-option-old-price {
        font-size: 12px;
        text-decoration: line-through;
    }

    .codwo-promo-option-recommended {
        grid-column: 2;
        grid-row: 3;
        justify-self: start;
    }

    .codwo-product-form-wrapper.codwo-rtl .codwo-promo-option {
        grid-template-columns: minmax(0, 1fr) 56px;
    }

    .codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-media {
        grid-column: 2;
        grid-row: 1 / span 3;
    }

    .codwo-product-form-wrapper.codwo-rtl .codwo-promo-option-recommended {
        grid-column: 1;
        justify-self: end;
    }

    .codwo-captcha-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .codwo-captcha-input {
        max-width: none;
    }

    .codwo-refresh-captcha {
        justify-content: center;
    }

    .codwo-swipe-captcha-modal {
        padding: 18px;
    }

    .codwo-swipe-captcha-modal h3 {
        font-size: 22px;
    }

    .codwo-swipe-track {
        height: 52px;
    }

    .codwo-swipe-thumb {
        width: 52px;
        height: 52px;
        font-size: 18px;
    }

    .codwo-swipe-instruction {
        font-size: 13px;
        padding: 0 58px;
    }

    .codwo-upsell-product-item {
        grid-template-columns: 20px 60px 1fr;
    }

    .codwo-upsell-product-image img {
        width: 60px;
        height: 60px;
    }

    .codwo-otp-actions,
    .codwo-otp-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .codwo-btn-secondary {
        width: 100%;
    }
}

.codwo-coupon-section {
    margin-bottom: 6px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--codwo-border);
    background: var(--codwo-surface-muted);
}

.codwo-coupon-section h4 {
    margin: 0 0 14px;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--codwo-text);
}

.codwo-coupon-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.codwo-coupon-input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--codwo-border-strong);
    border-radius: 10px !important;
    font-size: 15px;
    color: var(--codwo-text);
    background: #fff;
    transition: border-color 0.18s ease;
}

.codwo-coupon-input:focus {
    outline: none;
    border-color: var(--codwo-primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}

.codwo-coupon-input:disabled {
    background: #f5f7fa;
    cursor: not-allowed;
}

.codwo-coupon-status {
    font-size: 13px;
    min-height: 20px;
}

.codwo-coupon-discount-row {
    color: var(--codwo-success);
    font-weight: 700;
}

.codwo-coupon-discount-amount {
    color: var(--codwo-success);
    font-weight: 700;
}

.codwo-btn-secondary.codwo-remove-coupon {
    background: var(--codwo-danger);
    border-color: var(--codwo-danger);
}

.codwo-btn-secondary.codwo-remove-coupon:hover {
    background: #a83030;
    border-color: #a83030;
    box-shadow: 0 10px 20px rgba(192, 61, 61, 0.24);
}

.codwo-product-form-wrapper.codwo-rtl,
html[lang^="ar"] .codwo-product-form-wrapper,
body.rtl .codwo-product-form-wrapper,
:lang(ar) .codwo-product-form-wrapper {
    direction: rtl;
    font-family: "Cairo", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.codwo-product-form-wrapper.codwo-ltr {
    direction: ltr;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-order-summary {
    text-align: right;
}

.codwo-product-form-wrapper.codwo-ltr .codwo-order-summary {
    text-align: left;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-summary-row,
.codwo-product-form-wrapper.codwo-rtl .codwo-variation-info,
html[lang^="ar"] .codwo-summary-row,
:lang(ar) .codwo-summary-row,
html[lang^="ar"] .codwo-variation-info,
body.rtl .codwo-summary-row,
body.rtl .codwo-variation-info,
:lang(ar) .codwo-variation-info {
    flex-direction: row;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-upsell-close,
html[lang^="ar"] .codwo-upsell-close,
body.rtl .codwo-upsell-close,
:lang(ar) .codwo-upsell-close {
    right: auto;
    left: 10px;
}

.codwo-product-form-wrapper.codwo-rtl .codwo-promo-item,
.codwo-product-form-wrapper.codwo-rtl .codwo-badge,
.codwo-product-form-wrapper.codwo-rtl .codwo-status-text,
html[lang^="ar"] .codwo-promo-item,
:lang(ar) .codwo-promo-item,
html[lang^="ar"] .codwo-badge,
:lang(ar) .codwo-badge,
html[lang^="ar"] .codwo-status-text,
body.rtl .codwo-promo-item,
body.rtl .codwo-badge,
body.rtl .codwo-status-text,
:lang(ar) .codwo-status-text {
    flex-direction: row-reverse;
}
