/* --- Modular Quick Checkout Form --- */
.opsim-modular-checkout-wrapper {
    margin-top: 10px;
    width: 100%;
    border: 1px solid var(--opsim-brand, #355872);
    border-radius: 12px;
    padding: 15px 15px 8px 15px;
    background: #fff;
}

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

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

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

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

/* Individual Input Group Box */
.opsim-modular-checkout-wrapper .opsim-checkout-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    height: 42px;
    transition: border-color 0.2s;
}

.opsim-modular-checkout-wrapper .opsim-checkout-input-group:focus-within {
    border-color: var(--opsim-brand, #355872);
}

/* Icon / Left Section */
.opsim-modular-checkout-wrapper .opsim-icon-section {
    width: 42px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.opsim-modular-checkout-wrapper .opsim-icon-section svg {
    width: 16px;
    height: 16px;
    stroke: var(--opsim-brand, #355872);
    fill: none;
}

/* Flag Section (Compact) */
.opsim-modular-checkout-wrapper .opsim-flag-section {
    width: 95px;
    gap: 6px;
    padding: 0 8px;
}

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

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

/* The actual input */
.opsim-modular-checkout-wrapper .opsim-checkout-input-group input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 0 10px !important;
    font-size: 16px !important;
    color: #111827 !important;
    outline: none !important;
    height: 100% !important;
    margin: 0 !important;
}

.opsim-modular-checkout-wrapper .opsim-checkout-input-group input::placeholder {
    color: #9ca3af;
}

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

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

.opsim-modular-checkout-wrapper .opsim-quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    height: 32px;
    overflow: hidden;
}

.opsim-modular-checkout-wrapper .opsim-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;
}

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

.opsim-modular-checkout-wrapper .opsim-qty-input {
    width: 35px;
    height: 100%;
    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;
}

/* --- Product Variations & Swatches --- */
.opsim-modular-checkout-wrapper .opsim-product-variations-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 5px 0;
}

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

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

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

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

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

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

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

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

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

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

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

.opsim-modular-checkout-wrapper .opsim-swatch-item.active .opsim-swatch-text {
    background: rgba(var(--opsim-brand-rgb, 53, 88, 114), 0.1);
    color: var(--opsim-brand, #355872);
}

/* Out of Stock Style */
.opsim-modular-checkout-wrapper .opsim-swatch-item.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f1f5f9;
    border-style: solid;
    border-color: #e2e8f0;
}

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

/* Order Summary Box */
.opsim-modular-checkout-wrapper .opsim-order-summary-box {
    background: rgba(var(--opsim-brand-rgb, 53, 88, 114), 0.04);
    border: 1px solid rgba(var(--opsim-brand-rgb, 53, 88, 114), 0.1);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
}

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

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

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

/* Confirm Button */
.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn {
    background-color: var(--opsim-brand, #355872);
    color: #fff;
    border: none;
    border-radius: var(--btn-radius, 8px);
    padding: 10px;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 4px;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn:hover {
    opacity: 0.95;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.is-out-of-stock {
    background-color: #9ca3af !important;
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn .opsim-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    fill: none;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn .opsim-btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn .opsim-main-text {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn .opsim-sub-text {
    font-size: 0.7rem;
    opacity: 0.9;
    font-weight: 400;
    margin-top: 1px;
}

.opsim-modular-checkout-wrapper .opsim-form-message {
    font-size: 0.8rem;
    text-align: center;
    font-weight: 600;
}
.opsim-modular-checkout-wrapper .opsim-form-message:empty {
    display: none;
}
.opsim-modular-checkout-wrapper .opsim-form-message:not(:empty) {
    margin-top: 5px;
}
.opsim-modular-checkout-wrapper .opsim-form-message.error { color: #dc2626; }
.opsim-modular-checkout-wrapper .opsim-form-message.success { color: #16a34a; }

/* --- Button Loading State --- */
.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.loading {
    position: relative;
    cursor: not-allowed;
}

.opsim-modular-checkout-wrapper .opsim-confirm-checkout-btn.loading .opsim-btn-content {
    visibility: hidden;
    opacity: 0;
}

.opsim-modular-checkout-wrapper .opsim-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: opsim-spin 0.6s linear infinite;
}

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

/* --- Form Validation Styles --- */
.opsim-modular-checkout-wrapper .opsim-checkout-input-group.has-error {
    border-color: #dc2626 !important;
}

.opsim-modular-checkout-wrapper .opsim-field-error-message {
    color: #dc2626;
    font-size: 0.65rem;
    font-weight: 700;
    margin-top: 4px;
    margin-bottom: 6px;
    margin-left: 10px;
    display: block !important;
    text-align: left;
    width: 100%;
}

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

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

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

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

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

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