:root {
    --ostore-brand: var(--color-primary, #cc0000);
    --ostore-brand-rgb: 204, 0, 0;
    --ostore-confirm-btn-bg: var(--ostore-checkout-confirm-bg, var(--ostore-brand, #355872));
    --ostore-cart-btn-bg: var(--ostore-checkout-cart-bg, #6b7280);
}

.ostore-modular-checkout-wrapper {
    margin-top: 10px;
    width: 100%;
    border: 1px solid var(--ostore-brand, #355872);
    border-radius: 12px;
    padding: 15px 15px 8px 15px;
    background: #fff;
}
.ostore-modular-checkout-wrapper[data-checkout-type="single"] {
    border: none;
    border-radius: 0;
    padding-left: 0;
    padding-right: 0;
}
.ostore-modular-checkout-wrapper .ostore-checkout-header {
    text-align: right;
    margin-bottom: 12px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.ostore-modular-checkout-wrapper .ostore-checkout-header h3 {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    color: var(--color-text-main, #111111);
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0 0 2px 0;
}
.ostore-modular-checkout-wrapper .ostore-checkout-header-bar {
    display: inline-block;
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: var(--ostore-confirm-btn-bg);
}
.ostore-modular-checkout-wrapper .ostore-checkout-header p {
    color: #6B7280;
    font-size: 0.8rem;
    margin: 0;
}
.ostore-modular-checkout-wrapper .ostore-quick-checkout-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ostore-modular-checkout-wrapper .ostore-checkout-fields-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
@media (min-width: 768px) {
    .ostore-modular-checkout-wrapper .ostore-checkout-fields-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}
.ostore-modular-checkout-wrapper .ostore-checkout-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--color-border, #d6d6d6);
    border-radius: 12px;
    background: #ffffff;
    height: 46px;
    padding: 0;
    overflow: hidden;
    transition: border-color var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
    box-sizing: border-box;
}

.ostore-modular-checkout-wrapper .ostore-checkout-input-group:focus-within {
    border-color: var(--ostore-confirm-btn-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ostore-confirm-btn-bg) 15%, transparent);
}

.ostore-modular-checkout-wrapper .ostore-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    flex-shrink: 0;
    margin: 0;
    background: color-mix(in srgb, var(--ostore-confirm-btn-bg) 8%, transparent);
    color: var(--ostore-confirm-btn-bg);
}

.ostore-modular-checkout-wrapper .ostore-field-icon svg {
    stroke: currentColor;
    fill: none;
    width: 18px;
    height: 18px;
}

.ostore-modular-checkout-wrapper .ostore-checkout-input-group input {
    flex-grow: 1;
    border: none !important;
    background: transparent !important;
    padding: 0 16px !important;
    margin: 0 !important;
    height: 100% !important;
    font-family: inherit;
    font-size: 16px !important; /* iOS Safari zooms the page in on focus if a text input is under 16px */
    color: var(--color-text-main, #111111) !important;
    outline: none !important;
    box-shadow: none !important;
    text-align: right;
    direction: rtl;
}

.ostore-modular-checkout-wrapper .ostore-checkout-input-group input::placeholder {
    color: var(--color-text-light, #767676);
    opacity: 0.8;
}
.ostore-modular-checkout-wrapper .ostore-quantity-selector-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: #fdfdfd;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 10px 15px;
    margin-top: 2px;
    box-sizing: border-box;
    width: 100%;
}
.ostore-modular-checkout-wrapper .ostore-qty-label {
    font-weight: 800;
    font-size: 0.8rem;
    color: #111827;
    text-transform: uppercase;
}
.ostore-modular-checkout-wrapper .ostore-quantity-control {
    display: flex;
    align-items: stretch;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    height: 32px;
    overflow: hidden;
    flex-shrink: 0;
}
.ostore-modular-checkout-wrapper .ostore-qty-btn {
    width: 32px;
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #111827;
    font-weight: 700;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.ostore-modular-checkout-wrapper .ostore-qty-input {
    width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    border-left: 1px solid #e5e7eb !important;
    border-right: 1px solid #e5e7eb !important;
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #111827;
    background: #fff;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: textfield;
}
.ostore-modular-checkout-wrapper .ostore-qty-input::-webkit-outer-spin-button,
.ostore-modular-checkout-wrapper .ostore-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* Swatches styling */
.ostore-modular-checkout-wrapper .ostore-product-variations-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 5px 0;
}
.ostore-modular-checkout-wrapper .ostore-variation-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ostore-modular-checkout-wrapper .ostore-variation-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.ostore-modular-checkout-wrapper .ostore-variation-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #4b5563;
    text-transform: uppercase;
}
.ostore-modular-checkout-wrapper .ostore-selected-variation-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #111827;
}
.ostore-modular-checkout-wrapper .ostore-swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.ostore-modular-checkout-wrapper .ostore-swatch-item {
    min-width: 36px;
    height: 36px;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fff;
    padding: 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}
.ostore-modular-checkout-wrapper .ostore-swatch-item.active {
    border: 1.5px solid var(--ostore-confirm-btn-bg);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ostore-confirm-btn-bg) 18%, transparent);
}
.ostore-modular-checkout-wrapper .ostore-swatch-item.ostore-swatch-unavailable {
    opacity: 0.4;
    cursor: not-allowed;
}
.ostore-modular-checkout-wrapper .ostore-swatch-item.ostore-swatch-unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 4%;
    width: 92%;
    height: 1.5px;
    background: #dc2626;
    transform: translateY(-50%) rotate(-25deg);
    pointer-events: none;
}
.ostore-modular-checkout-wrapper .ostore-swatch-item img,
.ostore-modular-checkout-wrapper .ostore-swatch-color {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}
.ostore-modular-checkout-wrapper .ostore-swatch-text {
    font-size: 0.7rem;
    font-weight: 800;
    color: #111827;
    padding: 0 9px;
    white-space: nowrap;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 5px;
}
.ostore-modular-checkout-wrapper .ostore-swatch-item.active .ostore-swatch-text {
    background: color-mix(in srgb, var(--ostore-confirm-btn-bg) 10%, transparent);
    color: var(--ostore-confirm-btn-bg);
}
.ostore-modular-checkout-wrapper .ostore-order-summary-box {
    background: color-mix(in srgb, var(--ostore-confirm-btn-bg) 4%, transparent);
    border: 1px solid color-mix(in srgb, var(--ostore-confirm-btn-bg) 10%, transparent);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 16px;
}
.ostore-modular-checkout-wrapper .ostore-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #4b5563;
    font-weight: 500;
}
/* These values are plain "amount Dhs" text written by JS on every quantity/
   shipping recalculation (not wc_price(), which isolates it via <bdi>) — force
   the same LTR isolation here so "Dhs" doesn't jump to the wrong side in RTL. */
.ostore-modular-checkout-wrapper .ostore-summary-row span:last-child {
    direction: ltr;
    unicode-bidi: isolate;
}
.ostore-modular-checkout-wrapper .ostore-total-row {
    margin-top: 2px;
    padding-top: 6px;
    border-top: 1px solid color-mix(in srgb, var(--ostore-confirm-btn-bg) 10%, transparent);
    font-size: 0.95rem;
    font-weight: 800;
    color: #111827;
}
.ostore-modular-checkout-wrapper .ostore-total-row span:last-child {
    color: var(--ostore-confirm-btn-bg);
}
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn {
    background-color: var(--ostore-confirm-btn-bg, var(--color-primary, #355872)) !important;
    color: #fff !important;
    border: 1px solid color-mix(in srgb, var(--ostore-confirm-btn-bg, var(--color-primary, #355872)) 70%, transparent) !important;
    outline: none !important;
    box-shadow: inset 0 0.75px 0 rgb(255 255 255 / 0.2), 0 1px 2px rgb(0 0 0 / 0.16) !important;
    border-radius: var(--theme-radius, 8px) !important;
    padding: 15px;
    width: 100%;
    cursor: pointer;
    transition: background-color var(--transition-fast, 0.15s ease), border-color var(--transition-fast, 0.15s ease) !important;
    margin-top: 4px;
}
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn:hover {
    background-color: var(--color-primary-hover, #b30000) !important;
    border: 1px solid color-mix(in srgb, var(--color-primary-hover, #b30000) 70%, transparent) !important;
    outline: none !important;
    box-shadow: inset 0 0.75px 0 rgb(255 255 255 / 0.2), 0 1px 2px rgb(0 0 0 / 0.16) !important;
}
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn .ostore-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn .ostore-main-text {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
}
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.ostore-modular-checkout-wrapper .ostore-form-message {
    font-size: 0.8rem;
    text-align: center;
    font-weight: 600;
}
.ostore-modular-checkout-wrapper .ostore-form-message.error { color: #dc2626; }
.ostore-modular-checkout-wrapper .ostore-form-message.success { color: #16a34a; }
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.loading {
    position: relative;
    cursor: not-allowed;
}
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.loading .ostore-btn-content {
    visibility: hidden;
    opacity: 0;
}
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: calc(50% - 10px);
    left: calc(50% - 10px);
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: ostore-spin 0.6s linear infinite;
}
@keyframes ostore-spin {
    to { transform: rotate(360deg); }
}
.ostore-modular-checkout-wrapper .ostore-checkout-input-group.has-error {
    border-color: #dc2626 !important;
}
.ostore-modular-checkout-wrapper .ostore-field-error-message {
    color: #dc2626;
    font-size: 0.6rem;
    font-weight: 700;
    margin-top: -8px;
    margin-bottom: 0;
    margin-right: 10px;
    display: block !important;
    text-align: right;
    width: 100%;
}
/* Shimmer Animation */
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.anim-shimmer {
    position: relative;
    overflow: hidden;
}
.ostore-modular-checkout-wrapper .ostore-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: ostore-shimmer 4s infinite linear;
}
@keyframes ostore-shimmer {
    0% { left: -150%; }
    40%, 100% { left: 150%; }
}

/* Pulse Animation */
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.anim-pulse {
    animation: ostore-btn-pulse 1.8s ease-in-out infinite;
}
@keyframes ostore-btn-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.035); }
}

/* Glow Animation */
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.anim-glow {
    animation: ostore-btn-glow 1.8s ease-in-out infinite;
}
@keyframes ostore-btn-glow {
    0%, 100% {
        box-shadow: inset 0 0.75px 0 rgb(255 255 255 / 0.2), 0 1px 2px rgb(0 0 0 / 0.16),
            0 0 0 0 color-mix(in srgb, var(--ostore-confirm-btn-bg, var(--color-primary, #355872)) 55%, transparent);
    }
    50% {
        box-shadow: inset 0 0.75px 0 rgb(255 255 255 / 0.2), 0 1px 2px rgb(0 0 0 / 0.16),
            0 0 16px 4px color-mix(in srgb, var(--ostore-confirm-btn-bg, var(--color-primary, #355872)) 55%, transparent);
    }
}

/* Bounce Animation */
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.anim-bounce {
    animation: ostore-btn-bounce 1.4s ease-in-out infinite;
}
@keyframes ostore-btn-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Gradient Wave Animation */
.ostore-modular-checkout-wrapper .ostore-confirm-checkout-btn.anim-wave {
    background-image: linear-gradient(
        90deg,
        var(--ostore-confirm-btn-bg, var(--color-primary, #355872)) 0%,
        color-mix(in srgb, var(--ostore-confirm-btn-bg, var(--color-primary, #355872)) 45%, white) 50%,
        var(--ostore-confirm-btn-bg, var(--color-primary, #355872)) 100%
    ) !important;
    background-size: 220% 100%;
    animation: ostore-btn-wave 3s ease-in-out infinite;
}
@keyframes ostore-btn-wave {
    0% { background-position: 0% 0; }
    50% { background-position: 100% 0; }
    100% { background-position: 0% 0; }
}

