/* Checkout bottom-sheet popup — slides up from bottom */

.checkout-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 24, 0.55);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.checkout-popup-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.checkout-popup {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: 1100px;
    height: 92vh;
    max-height: 92vh;
    background: #FAF7F0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.25), 0 -4px 12px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    transition: transform 0.42s cubic-bezier(0.22, 0.9, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    will-change: transform;
}
.checkout-popup.active {
    transform: translate(-50%, 0);
}

.checkout-popup-header {
    flex: 0 0 auto;
    position: relative;
    padding: 10px 14px 12px;
    background: #FFFFFF;
    border-bottom: 1px solid #E5DECB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.checkout-popup-header:active { cursor: grabbing; }

.checkout-popup-drag-handle {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    background: #D5CCB4;
    border-radius: 10px;
    pointer-events: none;
}

.checkout-popup-title {
    margin-top: 6px;
    font-family: 'Noto Sans Thai', system-ui, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1C1A17;
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkout-popup-title::before {
    content: "";
    width: 8px;
    height: 8px;
    background: #B5342F;
    border-radius: 50%;
    display: inline-block;
}

.checkout-popup-close {
    margin-top: 6px;
    width: 38px;
    height: 38px;
    border: 1px solid #E5DECB;
    background: #FFFFFF;
    color: #5C564C;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    font-family: sans-serif;
}
.checkout-popup-close:hover {
    background: #F3EFE4;
    color: #1C1A17;
    transform: rotate(90deg);
}

.checkout-popup-iframe {
    flex: 1;
    width: 100%;
    border: 0;
    display: block;
    background: #FAF7F0;
}

.checkout-popup-loading {
    position: absolute;
    inset: 48px 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    color: #5C564C;
    font-family: 'Noto Sans Thai', sans-serif;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
}
.checkout-popup-loading.hidden { opacity: 0; }
.checkout-popup-loading-ring {
    width: 42px;
    height: 42px;
    border: 3px solid #E5DECB;
    border-top-color: #B5342F;
    border-radius: 50%;
    animation: checkoutSpin 0.8s linear infinite;
}
@keyframes checkoutSpin {
    to { transform: rotate(360deg); }
}

body.checkout-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .checkout-popup {
        height: 95vh;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }
    .checkout-popup-title { font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
    .checkout-popup,
    .checkout-popup-backdrop {
        transition: none;
    }
}
