
:root {
    --checkout-bg: #0d0d12;
    --checkout-surface: #151520;
    --checkout-surface-2: #1a1a28;
    --checkout-border: rgba(255, 255, 255, 0.1);
    --checkout-accent: #9B8BFF;
    --checkout-accent-hover: #7B6BDF;
    --checkout-success: #22c55e;
    --checkout-error: #ef4444;
    --checkout-text: #ffffff;
    --checkout-text-muted: #9ca3af;
    --checkout-text-dim: rgba(255, 255, 255, 0.5);
    --checkout-radius: 12px;
    --checkout-radius-sm: 8px;
}

/* Modal Overlay */
.checkout-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.checkout-overlay.active {
    display: flex;
}

/* Modal Container */
.checkout-modal {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--checkout-bg);
    border: 1px solid var(--checkout-border);
    border-radius: var(--checkout-radius);
}

/* Close Button */
.checkout-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--checkout-text-muted);
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-close:hover {
    color: var(--checkout-text);
    background: rgba(255, 255, 255, 0.1);
}

/* Product Header */
.checkout-product {
    display: flex;
    gap: 16px;
    padding: 24px;
    border-bottom: 1px solid var(--checkout-border);
}

.checkout-product-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--checkout-surface);
}

.checkout-product-info {
    flex: 1;
}

.checkout-product-name {
    margin: 0 0 4px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--checkout-accent);
}

.checkout-product-price {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--checkout-text);
}

/* Quantity Selector */
.checkout-quantity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkout-qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--checkout-text);
    background: var(--checkout-accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.checkout-qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkout-qty-value {
    min-width: 40px;
    padding: 6px 12px;
    text-align: center;
    font-size: 1rem;
    color: var(--checkout-text);
    background: var(--checkout-surface);
    border: 1px solid var(--checkout-border);
    border-radius: 6px;
}

.checkout-qty-available {
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--checkout-text-muted);
}

/* Form Body */
.checkout-body {
    padding: 24px;
}

/* Email Field */
.checkout-field {
    margin-bottom: 20px;
}

.checkout-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--checkout-text);
}

.checkout-input-wrap {
    position: relative;
}

.checkout-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--checkout-text-muted);
}

.checkout-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    font-size: 0.9375rem;
    color: var(--checkout-text);
    background: var(--checkout-surface);
    border: 1px solid var(--checkout-border);
    border-radius: var(--checkout-radius-sm);
    outline: none;
    transition: border-color 0.2s;
}

.checkout-input:focus {
    border-color: var(--checkout-accent);
}

.checkout-input::placeholder {
    color: var(--checkout-text-dim);
}

/* Payment Type Tabs */
.checkout-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.checkout-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--checkout-text-muted);
    background: var(--checkout-surface);
    border: 1px solid var(--checkout-border);
    border-radius: var(--checkout-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-tab:hover {
    color: var(--checkout-text);
}

.checkout-tab.active {
    color: var(--checkout-text);
    background: var(--checkout-surface-2);
    border-color: var(--checkout-accent);
}

/* Payment Methods */
.checkout-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.checkout-method {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--checkout-surface);
    border: 2px solid var(--checkout-border);
    border-radius: var(--checkout-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-method:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.checkout-method.selected {
    border-color: var(--checkout-accent);
    box-shadow: 0 0 0 1px var(--checkout-accent);
}

.checkout-method input {
    display: none;
}

.checkout-method-icon {
    width: 48px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkout-method-icon img {
    max-width: 100%;
    max-height: 100%;
}

.checkout-method-name {
    font-size: 0.9375rem;
    color: var(--checkout-text);
}

/* Coupon Link */
.checkout-coupon-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    padding: 0;
    font-size: 0.875rem;
    color: var(--checkout-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.checkout-coupon-link:hover {
    color: var(--checkout-text);
}

/* Coupon Field */
.checkout-coupon-field {
    display: none;
    margin-bottom: 20px;
}

.checkout-coupon-field.visible {
    display: flex;
    gap: 8px;
}

.checkout-coupon-field .checkout-input {
    padding-left: 12px;
}

.checkout-apply-btn {
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--checkout-text);
    background: var(--checkout-surface-2);
    border: 1px solid var(--checkout-border);
    border-radius: var(--checkout-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-apply-btn:hover {
    background: var(--checkout-accent);
    border-color: var(--checkout-accent);
}

/* Buy Now Button */
.checkout-buy-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--checkout-accent);
    border: none;
    border-radius: var(--checkout-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-buy-btn:hover {
    background: var(--checkout-accent-hover);
}

.checkout-buy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   STEP 2: ORDER OVERVIEW
   ======================================== */

.checkout-overview {
    display: none;
    padding: 24px;
}

.checkout-overview.active {
    display: block;
}

.checkout-overview-title {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
    font-style: italic;
    color: var(--checkout-text);
    text-align: center;
}

.checkout-overview-subtitle {
    margin: 0 0 24px 0;
    font-size: 0.875rem;
    color: var(--checkout-text-muted);
    text-align: center;
}

.checkout-overview-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 0.9375rem;
    color: var(--checkout-text);
}

.checkout-overview-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--checkout-surface);
    border-radius: var(--checkout-radius-sm);
    margin-bottom: 8px;
}

.checkout-overview-total {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--checkout-text);
    border-top: 1px solid var(--checkout-border);
}

.checkout-terms {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font-size: 0.875rem;
    color: var(--checkout-text-muted);
}

.checkout-terms input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--checkout-accent);
}

.checkout-overview-btns {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.checkout-back-btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--checkout-text);
    background: var(--checkout-surface-2);
    border: 1px solid var(--checkout-border);
    border-radius: var(--checkout-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-back-btn:hover {
    border-color: var(--checkout-text-muted);
}

.checkout-pay-btn {
    flex: 1.5;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--checkout-accent);
    border: none;
    border-radius: var(--checkout-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.checkout-pay-btn:hover {
    background: var(--checkout-accent-hover);
}

.checkout-pay-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   STEP 3: ORDER CREATED (WAITING)
   ======================================== */

.checkout-waiting {
    display: none;
    padding: 40px 24px;
    text-align: center;
}

.checkout-waiting.active {
    display: block;
}

.checkout-waiting-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--checkout-success);
    border-radius: 50%;
}

.checkout-waiting-icon svg {
    width: 40px;
    height: 40px;
    color: var(--checkout-success);
}

.checkout-waiting-title {
    margin: 0 0 16px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--checkout-text);
}

.checkout-waiting-msg {
    margin: 0 0 8px 0;
    padding: 16px;
    font-size: 0.9375rem;
    color: var(--checkout-text);
    background: var(--checkout-surface);
    border-radius: var(--checkout-radius-sm);
    line-height: 1.5;
}

.checkout-waiting-link {
    color: var(--checkout-text);
    text-decoration: underline;
    cursor: pointer;
}

.checkout-waiting-link:hover {
    color: var(--checkout-accent);
}

/* What's Next Section */
.checkout-next {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--checkout-border);
}

.checkout-next-title {
    margin: 0 0 16px 0;
    font-size: 1.25rem;
    font-weight: 700;
    font-style: italic;
    color: var(--checkout-text);
}

.checkout-next-msg {
    padding: 16px;
    font-size: 0.9375rem;
    color: var(--checkout-text);
    background: var(--checkout-surface);
    border-radius: var(--checkout-radius-sm);
    line-height: 1.5;
}

.checkout-next-note {
    margin-top: 12px;
    font-size: 0.8125rem;
    color: var(--checkout-accent);
}

/* ========================================
   STEP 4: SUCCESS
   ======================================== */

.checkout-success {
    display: none;
    padding: 40px 24px;
    text-align: center;
}

.checkout-success.active {
    display: block;
}

.checkout-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--checkout-success);
    border-radius: 50%;
    animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.checkout-success-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.checkout-success-title {
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--checkout-text);
}

.checkout-success-msg {
    margin: 0;
    font-size: 1rem;
    color: var(--checkout-text-muted);
}

/* Hide steps */
.checkout-step {
    display: none;
}

.checkout-step.active {
    display: block;
}

/* Error message */
.checkout-error {
    margin-top: 8px;
    font-size: 0.8125rem;
    color: var(--checkout-error);
}

/* Responsive */
@media (max-width: 540px) {
    .checkout-modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .checkout-overlay {
        padding: 0;
    }
}
