/* =========================================================================
   CUSTOM SELECTION OVERLAY MODAL LAYOUT STYLES (Requirement 1b)
   ========================================================================= */
.sct-custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 999999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.sct-custom-modal-box {
    background-color: #ffffff;
    border-radius: 14px;
    width: 92%;
    max-width: 660px;
    padding: 35px 30px 25px 30px;
    position: relative;
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.3);
    text-align: center;
    box-sizing: border-box;
    animation: sctPopupAnim 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.sct-custom-modal-close-x {
    position: absolute;
    top: 12px;
    right: 18px;
    background: none;
    border: none;
    font-size: 34px;
    font-weight: bold;
    color: #b0b0b0;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.sct-custom-modal-close-x:hover {
    color: #222222;
}

.sct-custom-modal-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 30px 0;
    color: #2c3e50;
    letter-spacing: -0.3px;
}

.sct-custom-modal-grid {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 25px;
}

.sct-custom-method-card {
    flex: 1;
    border: 2px solid #eaeaea;
    border-radius: 12px;
    padding: 25px 15px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.sct-custom-method-card:hover {
    border-color: #108ee9;
    background-color: #f7fbff;
    transform: translateY(-3px);
}

.sct-card-visual-wrapper {
    height: 210px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    width: 100%;
}

.sct-flex-center {
    justify-content: center;
}

.sct-desktop-banner-brand-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 12px;
}

.sct-qr-code-frame-holder-large {
    width: 165px;
    height: 165px;
    border: 1px solid #ddd;
    padding: 6px;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

.sct-live-qr-asset {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sct-payment-methods-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.sct-pm-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
}

.sct-pm-image-wrapper {
    width: 75px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    padding: 4px 6px;
}

.sct-pm-svg-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    max-height: 24px;
}

.sct-custom-method-card h4 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #333333;
}

.sct-card-subtext-description {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
    line-height: 1.45;
    padding: 0 10px;
}

.sct-custom-modal-footer {
    border-top: 1px solid #eeeeee;
    padding-top: 15px;
    display: flex;
    justify-content: center;
}

.sct-custom-modal-footer-close-btn {
    background-color: #f5f5f5;
    color: #666666;
    border: 1px solid #dddddd;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sct-custom-modal-footer-close-btn:hover {
    background-color: #e0e0e0;
    color: #333333;
}

.sct-view-desktop-only {
    display: block;
    width: 100%;
}

.sct-view-mobile-only {
    display: none;
    width: 100%;
}

@keyframes sctPopupAnim {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* =========================================================================
   Responsive Mobile Layout Adaptations (Production Unified Mobile & Emulator Fix)
   ========================================================================= */
@media (max-width: 768px) {
    /* FIX: Removed the forced display rule so jQuery show/hide logic functions properly */
    .sct-custom-modal-overlay {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 20px 10px !important;
        box-sizing: border-box !important;
    }

    /* FIX: Standardized positioning settings to avoid viewport clipping on emulators */
    .sct-custom-modal-box {
        padding: 40px 15px 20px 15px !important;
        width: 100% !important;
        max-width: 360px !important;
        margin: auto !important; 
        border-radius: 12px !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
    }

    .sct-custom-modal-title {
        font-size: 18px !important;
        line-height: 1.4 !important;
        margin: 0 0 20px 0 !important;
        padding: 0 25px !important; 
        white-space: normal !important;
    }

    .sct-custom-modal-close-x {
        position: absolute !important;
        top: 8px !important;
        right: 12px !important;
        font-size: 28px !important;
        color: #888888 !important;
        line-height: 1 !important;
        z-index: 1000000000 !important;
    }

    .sct-custom-modal-grid {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 20px;
    }

    .sct-custom-method-card {
        padding: 20px 12px !important;
        width: 100% !important;
    }

    .sct-card-visual-wrapper {
        height: auto;
        min-height: 50px;
        margin-bottom: 10px;
    }

    .sct-view-desktop-only {
        display: none;
    }

    .sct-view-mobile-only {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .sct-mobile-brand-box {
        height: 75px;
        margin-bottom: 5px;
    }

    .sct-mobile-round-app-icon {
        width: 64px;
        height: 64px;
        object-fit: contain;
        border-radius: 14px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .sct-card-subtext-description-mobile {
        font-size: 13px;
        color: #7f8c8d;
        margin: 0 0 15px 0;
        line-height: 1.45;
        padding: 0 10px;
    }

    .sct-custom-mobile-alipay-cta-btn {
        display: block;
        width: 100%;
        max-width: 220px;
        background-color: #108ee9;
        color: #ffffff !important;
        padding: 10px 16px;
        font-size: 14px;
        font-weight: bold;
        border-radius: 6px;
        text-decoration: none !important;
        box-shadow: 0 2px 6px rgba(16, 142, 233, 0.3);
        text-align: center;
        box-sizing: border-box;
        transition: background-color 0.2s;
    }

    .sct-custom-mobile-alipay-cta-btn:active {
        background-color: #0076ce;
    }

    .sct-payment-methods-grid {
        gap: 8px !important;
    }

    .sct-pm-image-wrapper {
        width: 68px !important;
        height: 28px !important;
        padding: 2px 4px !important;
    }

    .sct-custom-modal-footer {
        border-top: 1px solid #eeeeee !important;
        padding-top: 15px !important;
        margin-top: 5px !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    .sct-custom-modal-footer-close-btn {
        display: block !important;
        width: 100% !important;
        max-width: 220px !important;
        padding: 10px 0 !important;
        font-size: 14px !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }
}
