/**
 * REZ Preorder Styles
 * CSS for preorder buttons, messages, and price display
 */

/* Preorder Button */
.rez-preorder-btn {
    display: inline-block;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
    line-height: 1.4;
    min-height: 50px;
}

.rez-preorder-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rez-preorder-btn:active {
    transform: translateY(0);
}

.rez-preorder-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Preorder Message */
.rez-preorder-message {
    line-height: 1.5;
    text-align: center;
}

.rez-preorder-message:empty {
    display: none;
}

/* Price Display */
.rez-price-discounted {
    font-weight: 600;
    font-size: 1.1em;
}

.rez-price-original {
    font-size: 0.9em;
    text-decoration: line-through;
    opacity: 0.6;
    margin-left: 8px;
}

/* Hidden State */
.rez-hidden {
    display: none !important;
}

.rez-hide-buy-it-now-button {
    display: none !important;
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
    .rez-preorder-btn {
        padding: 14px 20px;
        font-size: 15px;
    }

    .rez-preorder-message {
        font-size: 13px;
        margin-top: 10px;
    }
}

/* Animation for button state changes */
@keyframes rezFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rez-preorder-btn.rez-entering {
    animation: rezFadeIn 0.3s ease;
}

/* Loading state */
.rez-preorder-btn.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.rez-preorder-btn.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: rezSpin 0.6s linear infinite;
}

@keyframes rezSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Success state */
.rez-preorder-btn.is-success {
    background-color: #4caf50 !important;
}

/* Ensure proper stacking with notify me button */
.rez-btn + .rez-preorder-btn {
    margin-top: 15px;
}

.rez-preorder-btn + .rez-preorder-message {
    margin-top: 10px;
}

/* Discount badge styling (optional) */
.rez-discount-badge {
    display: inline-block;
    background-color: #f44336;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

/* Payment info styling */
.rez-payment-info {
    font-size: 0.9em;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f5f5f5;
    border-radius: 4px;
    color: #666;
}

/* Inventory message styling */
.rez-inventory-message {
    display: inline-block;
    color: #ff6b6b;
    font-weight: 500;
    margin-top: 4px;
}

/*
 * Payment options ("Full & partial payment" campaigns only).
 * Values come from campaign.design.payment_option_style via the --rez-po-* variables set
 * inline on .rez-payment-options; the fallbacks are the defaults.
 */
.rez-payment-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0 0 12px;
    box-sizing: border-box;
    font-family: inherit;
    text-align: left;
}

.rez-payment-options .rez-payment-option {
    box-sizing: border-box;
    width: 100%;
    padding: 14px 16px;
    background: var(--rez-po-card-bg, #ffffff);
    border: 1px solid var(--rez-po-card-border, #d1d1d1);
    border-radius: var(--rez-po-card-radius, 8px);
    color: var(--rez-po-text, #222222);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.rez-payment-options .rez-payment-option.rez-payment-option--selected {
    /* Same 1px width as the rest state, so selecting never shifts the layout. Doubled class
       for specificity over theme rules that restyle generic [role="radio"] / div borders. */
    border: 1px solid var(--rez-po-card-selected-border, #000000);
}

.rez-payment-options .rez-payment-option:focus-visible {
    outline: 2px solid var(--rez-po-card-selected-border, #000000);
    outline-offset: 2px;
}

.rez-payment-options .rez-payment-option__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rez-payment-options .rez-payment-option__title {
    font-size: var(--rez-po-title-size, 16px);
    font-weight: var(--rez-po-title-weight, 600);
    color: var(--rez-po-text, #222222);
    line-height: 1.3;
}

.rez-payment-options .rez-payment-option__badge {
    flex-shrink: 0;
    padding: 3px 10px;
    background: var(--rez-po-badge-bg, #e8e8e8);
    color: var(--rez-po-badge-color, #333333);
    font-size: var(--rez-po-badge-size, 12px);
    border-radius: var(--rez-po-badge-radius, 99px);
    line-height: 1.5;
    white-space: nowrap;
}

.rez-payment-options .rez-payment-option__row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    font-size: var(--rez-po-secondary-size, 13px);
    color: var(--rez-po-text-secondary, #777777);
    line-height: 1.4;
}

.rez-payment-options .rez-payment-option__amount {
    flex-shrink: 0;
    white-space: nowrap;
}
