/**
 * JUST SHOP COD - Premium Checkout Form Styles
 * Version: 2.0.0 - JUST SHOP Brand Design
 * Colors: Golden Yellow #FFD404 (fills), Black #111111 / #1A1A1A (type)
 */

/* ================================
   CSS CUSTOM PROPERTIES
   ================================ */
:root {
    /* ---- JUST SHOP brand ----------------------------------------------
       Sampled from logo-justshop.png: #FFD404 yellow + #000000 black.

       #FFD404 is a high-luminance yellow, so it is a FILL colour only:
         black #111 on #FFD404 = 14.9:1   OK  (the logo's own pairing)
         white     on #FFD404 =  1.4:1   NEVER
         #FFD404 as text on white = 1.4:1 NEVER -> use --mcod-primary-ink
    -------------------------------------------------------------------- */
    --mcod-primary: #FFD404;        /* brand yellow - fills only, ink text on top */
    --mcod-primary-bright: #FFE55C; /* hover lift */
    --mcod-primary-deep: #F0C400;   /* gradient mid */
    --mcod-primary-darker: #D6B000; /* gradient end / active / borders */
    --mcod-primary-ink: #7A5D00;    /* dark amber - brand-hued TEXT & ICONS on light (6.19:1) */
    --mcod-primary-light: #FFFBE6;  /* tinted wash surface */
    --mcod-primary-light2: #FFF7D1; /* tinted wash, gradient end */
    --mcod-primary-glow: rgba(255, 212, 4, 0.45);
    --mcod-primary-shadow: rgba(184, 148, 0, 0.40); /* warm shadow, visible on white */
    --mcod-on-primary: #111111;     /* text/icons ON yellow */
    --mcod-primary-hover: var(--mcod-primary-deep); /* legacy alias */

    /* Neutrals */
    --mcod-black: #1A1A1A;
    --mcod-dark: #374151;
    --mcod-gray: #6B7280;
    --mcod-light-gray: #9CA3AF;
    --mcod-border: #E5E7EB;
    --mcod-bg: #FAFAFA;
    --mcod-surface: #FFFFFF;

    /* Semantic */
    --mcod-success: #10B981;
    --mcod-success-light: #D1FAE5;
    --mcod-error: #EF4444;
    --mcod-error-light: #FEE2E2;

    /* Typography */
    --mcod-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Spacing */
    --mcod-radius: 12px;
    --mcod-radius-lg: 16px;
    --mcod-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --mcod-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
}

/* ================================
   FORM WRAPPER
   ================================ */
.mcod-checkout-form-wrapper {
    direction: rtl;
    width: 100%;
    max-width: 100%;
    margin: 24px 0;
    font-family: var(--mcod-font);
}

.mcod-checkout-form {
    background: var(--mcod-surface);
    border-radius: var(--mcod-radius-lg);
    padding: 0;
    box-shadow: var(--mcod-shadow);
    border: 1px solid var(--mcod-border);
    overflow: hidden;
}

/* ================================
   PRODUCT SUMMARY CARD
   ================================ */
.mcod-product-summary {
    background: linear-gradient(135deg, var(--mcod-primary-light) 0%, var(--mcod-primary-light2) 100%);
    padding: 20px;
    border-bottom: 1px solid var(--mcod-border);
    display: flex;
    gap: 16px;
    align-items: center;
}

.mcod-product-image {
    width: 80px;
    height: 80px;
    border-radius: var(--mcod-radius);
    object-fit: cover;
    border: 2px solid var(--mcod-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.mcod-product-info {
    flex: 1;
    min-width: 0;
}

.mcod-product-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--mcod-black);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.mcod-product-price-display {
    font-size: 44px;
    font-weight: 800;
    color: var(--mcod-primary-ink);
}

/* ================================
   FORM SECTIONS
   ================================ */
.mcod-form-body {
    padding: 24px;
}

.mcod-form-section {
    margin-bottom: 20px;
}

.mcod-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--mcod-gray);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mcod-section-title svg {
    width: 18px;
    height: 18px;
    color: var(--mcod-primary-ink);
}

/* ================================
   FORM INPUTS
   ================================ */
.mcod-form-row {
    margin-bottom: 16px;
}

.mcod-form-row:last-child {
    margin-bottom: 0;
}

.mcod-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--mcod-black);
    font-size: 14px;
}

.mcod-form-row label .required {
    color: var(--mcod-error);
    margin-right: 2px;
}

.mcod-input-wrapper {
    position: relative;
}

.mcod-input-wrapper .mcod-input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--mcod-light-gray);
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}

/* Hide icon for select elements - they have native dropdown arrow */
.mcod-input-wrapper select+.mcod-input-icon {
    display: none;
}

.mcod-input-wrapper input:focus+.mcod-input-icon {
    color: var(--mcod-primary-ink);
}

.mcod-checkout-form input[type="text"],
.mcod-checkout-form input[type="tel"],
.mcod-checkout-form input[type="number"] {
    width: 100%;
    padding: 16px 18px;
    padding-right: 48px;
    border: 2px solid var(--mcod-border);
    border-radius: var(--mcod-radius);
    font-size: 16px;
    font-weight: 500;
    color: var(--mcod-black);
    background: var(--mcod-surface);
    transition: all 0.2s ease;
    direction: rtl;
    min-height: 54px;
}

.mcod-checkout-form select {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid var(--mcod-border);
    border-radius: var(--mcod-radius);
    font-size: 16px;
    font-weight: 500;
    color: var(--mcod-black);
    background: var(--mcod-surface);
    transition: all 0.2s ease;
    direction: rtl;
    min-height: 54px;
    cursor: pointer;
    appearance: auto;
}

.mcod-checkout-form input:hover,
.mcod-checkout-form select:hover {
    border-color: #D1D5DB;
}

.mcod-checkout-form input:focus,
.mcod-checkout-form select:focus {
    outline: none;
    border-color: var(--mcod-primary-darker);
    box-shadow: 0 0 0 3px var(--mcod-primary), 0 0 0 6px rgba(122, 93, 0, 0.55);
}

.mcod-checkout-form input::placeholder {
    color: var(--mcod-light-gray);
    font-weight: 400;
}

.mcod-checkout-form select:disabled {
    background: var(--mcod-bg);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Error state */
.mcod-checkout-form input.mcod-error,
.mcod-checkout-form select.mcod-error {
    border-color: var(--mcod-error);
    animation: mcod-shake 0.4s ease;
}

.mcod-checkout-form input.mcod-error:focus,
.mcod-checkout-form select.mcod-error:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

@keyframes mcod-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

/* ================================
   QUANTITY SECTION
   ================================ */
.mcod-quantity-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    border: 1px solid var(--mcod-border);
}

.mcod-quantity-section label {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--mcod-black);
}

.mcod-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--mcod-surface);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--mcod-border);
}

.mcod-qty-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--mcod-surface);
    cursor: pointer;
    font-size: 22px;
    font-weight: 600;
    color: var(--mcod-primary-ink);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mcod-qty-btn:hover {
    background: var(--mcod-primary);
    color: var(--mcod-on-primary);
}

.mcod-qty-btn:active {
    transform: scale(0.95);
}

.mcod-quantity-wrapper input[type="number"] {
    width: 60px;
    height: 44px;
    border: none;
    border-right: 1px solid var(--mcod-border);
    border-left: 1px solid var(--mcod-border);
    border-radius: 0;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--mcod-black);
    padding: 0;
    min-height: auto;
    -moz-appearance: textfield;
}

.mcod-quantity-wrapper input[type="number"]::-webkit-outer-spin-button,
.mcod-quantity-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* ================================
   SHIPPING METHOD SELECTOR
   ================================ */
.mcod-shipping-method-section {
    margin-bottom: 20px;
}

.mcod-shipping-method-section>label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--mcod-black);
    font-size: 14px;
}

.mcod-shipping-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mcod-shipping-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 14px;
    background: var(--mcod-surface);
    border: 2px solid var(--mcod-border);
    border-radius: var(--mcod-radius);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.mcod-shipping-option:hover {
    border-color: var(--mcod-primary-darker);
    background: var(--mcod-primary-light);
}

.mcod-shipping-option.selected {
    border-color: var(--mcod-primary-darker);
    background: var(--mcod-primary-light);
    box-shadow: 0 0 0 4px var(--mcod-primary-shadow);
}

.mcod-shipping-option input[type="radio"] {
    display: none;
}

.mcod-shipping-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mcod-bg);
    border-radius: 12px;
    color: var(--mcod-gray);
    transition: all 0.25s ease;
}

.mcod-shipping-option:hover .mcod-shipping-icon,
.mcod-shipping-option.selected .mcod-shipping-icon {
    background: var(--mcod-primary);
    color: var(--mcod-on-primary);
    transform: scale(1.05);
}

.mcod-shipping-icon svg {
    width: 26px;
    height: 26px;
}

.mcod-shipping-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mcod-shipping-name {
    font-weight: 700;
    color: var(--mcod-black);
    font-size: 14px;
}

.mcod-shipping-option.selected .mcod-shipping-name {
    color: var(--mcod-primary-ink);
}

.mcod-shipping-desc {
    font-size: 12px;
    color: var(--mcod-gray);
    line-height: 1.3;
}

.mcod-shipping-price {
    font-weight: 800;
    font-size: 18px;
    color: var(--mcod-primary-ink);
    margin-top: 4px;
}

/* ================================
   ORDER SUMMARY
   ================================ */
.mcod-order-summary {
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    padding: 18px 20px;
    margin: 20px 0;
    border: 1px solid var(--mcod-border);
}

.mcod-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 15px;
    color: var(--mcod-dark);
}

.mcod-summary-row:not(:last-child) {
    border-bottom: 1px solid var(--mcod-border);
}

.mcod-summary-row.mcod-total {
    font-weight: 800;
    font-size: 20px;
    color: var(--mcod-black);
    padding-top: 14px;
    margin-top: 4px;
    border-top: 2px solid var(--mcod-border);
    border-bottom: none;
}

.mcod-summary-row.mcod-total span:last-child {
    color: var(--mcod-primary-ink);
    font-size: 24px;
}

/* ================================
   SUBMIT BUTTON - PREMIUM DESIGN
   ================================ */
.mcod-form-submit {
    margin-top: 28px;
    position: relative;
}

.mcod-submit-button {
    width: 100%;
    padding: 22px 28px;
    background: linear-gradient(135deg, var(--mcod-primary) 0%, var(--mcod-primary-deep) 50%, var(--mcod-primary-darker) 100%) !important;
    border: none !important;
    border-radius: 50px !important;
    color: var(--mcod-on-primary) !important;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow:
        0 6px 24px rgba(184, 148, 0, 0.45),
        0 2px 8px rgba(184, 148, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

/* Shine effect overlay */
.mcod-submit-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.55),
            transparent);
    transition: left 0.6s ease;
}

.mcod-submit-button:hover::before {
    left: 100%;
}

.mcod-submit-button:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow:
        0 12px 40px rgba(184, 148, 0, 0.55),
        0 4px 16px rgba(184, 148, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    background: linear-gradient(135deg, var(--mcod-primary-bright) 0%, var(--mcod-primary) 50%, var(--mcod-primary-deep) 100%) !important;
}

.mcod-submit-button:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow:
        0 4px 16px rgba(184, 148, 0, 0.45),
        0 2px 8px rgba(184, 148, 0, 0.3);
}

.mcod-submit-button:disabled {
    background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%) !important;
    cursor: not-allowed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: none;
}

.mcod-submit-button:disabled::before {
    display: none;
}

.mcod-submit-button svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Button text wrapper */
.mcod-btn-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Loading state */
.mcod-btn-loading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mcod-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(17, 17, 17, 0.25);
    border-top-color: var(--mcod-on-primary);
    border-radius: 50%;
    animation: mcod-spin 0.75s linear infinite;
}

@keyframes mcod-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Subtle pulse animation on load */
@keyframes mcod-btn-pulse {

    0%,
    100% {
        box-shadow:
            0 6px 24px rgba(184, 148, 0, 0.45),
            0 2px 8px rgba(184, 148, 0, 0.3);
    }

    50% {
        box-shadow:
            0 8px 32px rgba(184, 148, 0, 0.55),
            0 4px 12px rgba(184, 148, 0, 0.4);
    }
}

.mcod-submit-button:not(:disabled):not(:hover) {
    animation: mcod-btn-pulse 2.5s ease-in-out infinite;
}

/* Focus state for accessibility */
.mcod-submit-button:focus {
    outline: none;
    box-shadow:
        0 0 0 3px var(--mcod-primary),
        0 0 0 6px rgba(122, 93, 0, 0.55),
        0 6px 24px rgba(184, 148, 0, 0.45);
}

/* ================================
   TRUST BADGES
   ================================ */
.mcod-trust-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--mcod-border);
}

.mcod-trust-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--mcod-gray);
    font-weight: 500;
}

.mcod-trust-badge svg {
    width: 16px;
    height: 16px;
    color: var(--mcod-success);
}

/* ================================
   MESSAGES
   ================================ */
.mcod-messages {
    margin-top: 16px;
}

.mcod-message {
    padding: 16px 18px;
    border-radius: var(--mcod-radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: mcod-fadeIn 0.3s ease;
}

.mcod-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mcod-message.success {
    background: var(--mcod-success-light);
    border: 1px solid var(--mcod-success);
    color: #065F46;
}

.mcod-message.error {
    background: var(--mcod-error-light);
    border: 1px solid var(--mcod-error);
    color: #991B1B;
}

@keyframes mcod-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   VARIATION OPTIONS
   ================================ */
.mcod-variations-wrapper {
    margin-bottom: 20px;
    padding: 18px;
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    border: 1px solid var(--mcod-border);
}

.mcod-variation-row {
    margin-bottom: 14px;
}

.mcod-variation-row:last-child {
    margin-bottom: 0;
}

.mcod-variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mcod-variation-option {
    padding: 12px 20px;
    border: 2px solid var(--mcod-border);
    border-radius: 10px;
    background: var(--mcod-surface);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--mcod-dark);
    transition: all 0.2s ease;
}

.mcod-variation-option:hover {
    border-color: var(--mcod-primary-darker);
    color: var(--mcod-primary-ink);
}

.mcod-variation-option.selected {
    border-color: var(--mcod-primary-darker);
    background: var(--mcod-primary);
    color: var(--mcod-on-primary);
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 480px) {
    .mcod-checkout-form-wrapper {
        margin: 16px 0;
    }

    .mcod-form-body {
        padding: 20px 16px;
    }

    .mcod-product-summary {
        padding: 16px;
    }

    .mcod-product-image {
        width: 70px;
        height: 70px;
    }

    .mcod-product-name {
        font-size: 15px;
    }

    .mcod-product-price-display {
        font-size: 18px;
    }

    .mcod-shipping-methods {
        grid-template-columns: 1fr;
    }

    .mcod-shipping-option {
        flex-direction: row;
        text-align: right;
        padding: 14px 16px;
    }

    .mcod-shipping-icon {
        width: 44px;
        height: 44px;
    }

    .mcod-shipping-details {
        flex: 1;
        align-items: flex-start;
    }

    .mcod-shipping-price {
        font-size: 16px;
    }

    .mcod-submit-button {
        padding: 18px 20px;
        font-size: 16px;
    }

    .mcod-quantity-section {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .mcod-quantity-wrapper {
        justify-content: center;
    }

    .mcod-trust-section {
        flex-direction: column;
        align-items: center;
    }
}

/* ================================
   LOADING STATE
   ================================ */
.mcod-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.mcod-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--mcod-primary-light2);
    border-top-color: var(--mcod-primary-ink);
    border-radius: 50%;
    animation: mcod-spin 0.8s linear infinite;
}

/* ================================
   OUT OF STOCK OVERLAY
   ================================ */
.mcod-out-of-stock .mcod-form-body {
    position: relative;
    min-height: 300px;
}

.mcod-stock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
    border-radius: var(--mcod-radius);
    animation: mcod-fadeIn 0.4s ease;
}

.mcod-stock-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #DC2626;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 
        0 6px 24px rgba(220, 38, 38, 0.15),
        0 2px 8px rgba(220, 38, 38, 0.1);
    border: 2px solid rgba(220, 38, 38, 0.1);
}

.mcod-stock-badge svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.5;
}

.mcod-stock-overlay p {
    color: var(--mcod-gray);
    font-size: 15px;
    font-weight: 500;
}

/* ================================
   SIMILAR PRODUCTS SECTION
   ================================ */
.mcod-similar-products {
    margin-top: 24px;
    padding: 24px;
    background: var(--mcod-surface);
    border-radius: var(--mcod-radius-lg);
    border: 1px solid var(--mcod-border);
    box-shadow: var(--mcod-shadow);
}

.mcod-similar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--mcod-black);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mcod-similar-title svg {
    color: var(--mcod-primary-ink);
}

.mcod-similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.mcod-similar-card {
    background: var(--mcod-bg);
    border-radius: var(--mcod-radius);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-decoration: none;
    display: block;
    border: 1px solid var(--mcod-border);
}

.mcod-similar-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--mcod-shadow-lg);
    border-color: var(--mcod-primary-darker);
}

.mcod-similar-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--mcod-border);
}

.mcod-similar-card-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--mcod-border) 0%, var(--mcod-bg) 100%);
}

.mcod-similar-card-info {
    padding: 14px;
}

.mcod-similar-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--mcod-black);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.8em;
}

.mcod-similar-card-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--mcod-primary-ink);
}

.mcod-similar-card-price del {
    color: var(--mcod-gray);
    font-weight: 400;
    font-size: 13px;
}

.mcod-similar-card-price ins {
    text-decoration: none;
}

@media (max-width: 480px) {
    .mcod-similar-products {
        padding: 18px;
        margin-top: 16px;
    }
    
    .mcod-similar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .mcod-similar-card-info {
        padding: 12px;
    }
    
    .mcod-similar-card-name {
        font-size: 13px;
    }
    
    .mcod-similar-card-price {
        font-size: 15px;
    }
    
    .mcod-stock-badge {
        padding: 14px 22px;
        font-size: 16px;
    }
}

/* ================================================================
   PROMO CODE
   ----------------------------------------------------------------
   Collapsed-by-default disclosure that sits between the quantity
   block and the order summary. Deliberately LOW emphasis: only the
   order CTA is allowed to use the solid yellow fill, so the toggle
   is dashed/tonal and the apply button is outlined amber.

   Ids and classes here are part of the shared promo DOM contract -
   the frontend script binds to them, do not rename.
   ================================================================ */

/* [hidden] must win over the display values declared below,
   otherwise the collapsed panel / chip / discount row would show. */
.mcod-promo [hidden],
.mcod-promo-panel[hidden],
.mcod-promo-applied[hidden],
.mcod-summary-row.mcod-discount-row[hidden] {
    display: none !important;
}

.mcod-promo {
    margin: 0 0 20px;
}

/* ---- Toggle (secondary, never competes with the CTA) ---------- */
.mcod-checkout-form .mcod-promo-toggle {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    padding: 13px 16px;
    background: var(--mcod-bg);
    border: 2px dashed var(--mcod-border);
    border-radius: var(--mcod-radius);
    color: var(--mcod-dark);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-align: inherit;
    cursor: pointer;
    box-shadow: none;
}

.mcod-promo-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mcod-promo-toggle-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--mcod-primary-ink);
}

.mcod-promo-toggle-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcod-promo-chevron {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--mcod-gray);
}

.mcod-checkout-form .mcod-promo-toggle:hover {
    background: var(--mcod-primary-light);
    border-color: var(--mcod-primary-darker);
    color: var(--mcod-primary-ink);
}

.mcod-checkout-form .mcod-promo-toggle:hover .mcod-promo-chevron {
    color: var(--mcod-primary-ink);
}

.mcod-checkout-form .mcod-promo-toggle:focus-visible {
    outline: none;
    border-color: var(--mcod-primary-darker);
    box-shadow: 0 0 0 3px var(--mcod-primary), 0 0 0 6px rgba(122, 93, 0, 0.55);
}

/* Expanded: the toggle becomes the header of the panel card.
   The bottom border goes transparent (instead of none) so the
   button keeps its exact height and nothing jumps. */
.mcod-checkout-form .mcod-promo-toggle[aria-expanded="true"] {
    background: var(--mcod-primary-light);
    border-style: solid;
    border-color: var(--mcod-primary-darker);
    border-bottom-color: transparent;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    color: var(--mcod-primary-ink);
}

.mcod-promo-toggle[aria-expanded="true"] .mcod-promo-chevron {
    color: var(--mcod-primary-ink);
    transform: rotate(180deg);
}

/* ---- Panel ---------------------------------------------------- */
.mcod-promo-panel {
    display: block;
    margin-top: -2px;
    padding: 16px 14px;
    background: var(--mcod-surface);
    border: 2px solid var(--mcod-primary-darker);
    border-top: 0;
    border-radius: 0 0 var(--mcod-radius) var(--mcod-radius);
}

.mcod-promo-label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mcod-gray);
}

.mcod-promo-controls {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

/* ---- Input: LTR content inside an RTL form -------------------- */
/* The global rule `.mcod-checkout-form input[type="text"]` forces
   direction:rtl, width:100% and a 48px icon gutter. It carries one
   element in its specificity (0,2,1), so a plain two-class selector
   would LOSE to it. The `input[type="text"]` qualifier below raises
   this rule to (0,3,1) so the LTR reset actually wins. */
.mcod-checkout-form input[type="text"].mcod-promo-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 52px;
    padding: 14px 16px;
    direction: ltr;
    text-align: left;
    text-transform: uppercase;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1.5px;
    font-variant-ligatures: none;
}

/* While empty, flip back to RTL so the Arabic placeholder sits
   naturally with the rest of the form. Typing returns it to LTR. */
.mcod-checkout-form input[type="text"].mcod-promo-input:placeholder-shown {
    direction: rtl;
    text-align: right;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
}

.mcod-checkout-form input[type="text"].mcod-promo-input:disabled {
    background: var(--mcod-bg);
    color: var(--mcod-gray);
    cursor: not-allowed;
}

/* ---- Apply button: SECONDARY (tonal amber, never solid yellow) - */
.mcod-checkout-form .mcod-promo-apply {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex: 0 0 auto;
    min-width: 104px;
    min-height: 52px;
    padding: 14px 22px;
    background: var(--mcod-primary-light);
    border: 2px solid var(--mcod-primary-darker);
    border-radius: var(--mcod-radius);
    color: var(--mcod-primary-ink);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: none;
}

.mcod-checkout-form .mcod-promo-apply:hover:not(:disabled) {
    background: var(--mcod-primary-light2);
    border-color: var(--mcod-primary-ink);
}

.mcod-checkout-form .mcod-promo-apply:active:not(:disabled) {
    transform: scale(0.98);
}

.mcod-checkout-form .mcod-promo-apply:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--mcod-primary), 0 0 0 6px rgba(122, 93, 0, 0.55);
}

.mcod-checkout-form .mcod-promo-apply:disabled {
    background: var(--mcod-bg);
    border-color: var(--mcod-border);
    color: var(--mcod-light-gray);
    cursor: not-allowed;
    transform: none;
}

.mcod-promo-apply-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(122, 93, 0, 0.25);
    border-top-color: var(--mcod-primary-ink);
    border-radius: 50%;
    animation: mcod-spin 0.75s linear infinite;
}

/* Loading: the label keeps its box (visibility, not display) so the
   button never changes width when the spinner appears. */
.mcod-promo-apply.is-loading .mcod-promo-apply-label,
.mcod-promo-apply.loading .mcod-promo-apply-label,
.mcod-promo-apply.mcod-loading .mcod-promo-apply-label,
.mcod-promo-apply[aria-busy="true"] .mcod-promo-apply-label {
    visibility: hidden;
}

.mcod-promo-apply.is-loading .mcod-promo-apply-spinner,
.mcod-promo-apply.loading .mcod-promo-apply-spinner,
.mcod-promo-apply.mcod-loading .mcod-promo-apply-spinner,
.mcod-promo-apply[aria-busy="true"] .mcod-promo-apply-spinner {
    display: block;
}

/* The plugin-wide .mcod-loading helper paints its own centred
   spinner - suppress it here so we do not stack two. */
.mcod-promo-apply.mcod-loading::after {
    display: none;
}

/* ---- Message (role="status") ---------------------------------- */
/* Collapsed while empty, so filling it never snaps the layout. */
.mcod-promo-message {
    overflow: hidden;
    max-height: 0;
    margin-top: 0;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.5;
    opacity: 0;
}

.mcod-promo-message:not(:empty) {
    max-height: 140px;
    margin-top: 12px;
    padding: 10px 14px;
    opacity: 1;
    background: var(--mcod-bg);
    border: 1px solid var(--mcod-border);
    color: var(--mcod-dark);
}

.mcod-promo-message.success:not(:empty),
.mcod-promo-message.is-success:not(:empty) {
    background: var(--mcod-success-light);
    border-color: var(--mcod-success);
    /* #065F46 = the success ink already used by .mcod-message.success */
    color: #065F46;
}

.mcod-promo-message.error:not(:empty),
.mcod-promo-message.is-error:not(:empty) {
    background: var(--mcod-error-light);
    border-color: var(--mcod-error);
    color: #991B1B;
}

/* ---- Applied chip --------------------------------------------- */
.mcod-promo-applied {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--mcod-primary-light);
    border: 2px solid var(--mcod-primary-darker);
    border-radius: var(--mcod-radius);
}

/* The chip REPLACES the input row. The script can do that either by
   setting [hidden] on the controls (covered by the rule at the top of
   this block) or by flagging the section - both are supported. */
.mcod-promo.is-applied .mcod-promo-label,
.mcod-promo.is-applied .mcod-promo-controls,
.mcod-promo.has-promo .mcod-promo-label,
.mcod-promo.has-promo .mcod-promo-controls {
    display: none;
}

.mcod-promo-applied-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--mcod-success-light);
    color: #065F46;
}

.mcod-promo-applied-icon svg {
    width: 18px;
    height: 18px;
}

.mcod-promo-applied-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 auto;
    min-width: 0;
}

.mcod-promo-applied-code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--mcod-black);
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcod-promo-applied-saving {
    font-size: 13px;
    font-weight: 800;
    color: #065F46;
}

.mcod-checkout-form .mcod-promo-remove {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 44px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--mcod-border);
    border-radius: 10px;
    color: var(--mcod-gray);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
}

.mcod-promo-remove svg {
    width: 15px;
    height: 15px;
}

.mcod-checkout-form .mcod-promo-remove:hover {
    background: var(--mcod-error-light);
    border-color: var(--mcod-error);
    color: #991B1B;
}

.mcod-checkout-form .mcod-promo-remove:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--mcod-primary), 0 0 0 6px rgba(122, 93, 0, 0.55);
}

/* ---- Discount row in the order summary ------------------------ */
/* Money coming OFF, so it reads in the success ink rather than the
   brand yellow used by the total. */
.mcod-summary-row.mcod-discount-row {
    color: #065F46;
    font-weight: 700;
}

.mcod-discount-label {
    display: flex;
    align-items: center;
    gap: 7px;
}

.mcod-discount-label svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #065F46;
}

.mcod-summary-row.mcod-discount-row #mcod-discount-amount {
    font-weight: 800;
    color: #065F46;
    white-space: nowrap;
}

.mcod-summary-row.mcod-discount-row #mcod-discount-amount .woocommerce-Price-amount,
.mcod-summary-row.mcod-discount-row #mcod-discount-amount bdi {
    color: inherit;
}

/* ---- Motion (opt-in only) ------------------------------------- */
@media (prefers-reduced-motion: no-preference) {

    .mcod-checkout-form .mcod-promo-toggle,
    .mcod-checkout-form .mcod-promo-apply,
    .mcod-checkout-form .mcod-promo-remove,
    .mcod-promo-toggle-icon,
    .mcod-promo-chevron {
        transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    }

    .mcod-promo-message {
        transition: max-height 0.28s ease, opacity 0.2s ease, margin-top 0.28s ease, padding 0.28s ease;
    }

    .mcod-promo-panel:not([hidden]) {
        animation: mcod-promo-expand 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .mcod-promo-applied:not([hidden]) {
        animation: mcod-fadeIn 0.28s ease both;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mcod-promo-apply-spinner {
        animation-duration: 1.6s;
    }
}

@keyframes mcod-promo-expand {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Small screens -------------------------------------------- */
@media (max-width: 380px) {
    .mcod-promo-controls {
        flex-direction: column;
        gap: 8px;
    }

    .mcod-checkout-form .mcod-promo-apply {
        width: 100%;
        min-width: 0;
    }

    .mcod-promo-applied {
        flex-wrap: wrap;
    }

    .mcod-checkout-form .mcod-promo-remove {
        width: 100%;
        justify-content: center;
    }

    .mcod-promo-toggle-text {
        font-size: 14px;
    }
}