/* ✅ Styling hanya untuk wrapper dan iframe - tidak affect elemen lain */

.topup-iframe-wrapper {
    /* Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Background */
    background-color: #f2f3f5;
    
    /* Reset hanya untuk wrapper ini */
    margin: 0;
    margin-bottom: 40px;
    padding: 10px;
    box-sizing: border-box;
    
    /* Prevent interference */
    overflow: hidden;
}

/* ✅ Styling iframe dengan class spesifik */
.topup-iframe-wrapper .topup-iframe {
    /* Size - Desktop */
    width: 90vw;
    max-width: 1400px;
    height: 50vh;
    max-height: 500px;
    
    /* Style */
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    
    /* Reset properties */
    display: block;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: white;
    
    /* Smooth transitions */
    transition: all 0.3s ease;
}

/* 🎨 MODAL FULLSCREEN OVERLAY */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: block;
    opacity: 1;
}

/* 🎨 MODAL CONTAINER */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: none;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-container.active {
    display: block;
    opacity: 1;
    transform: scale(1);
}

/* 🎨 MODAL IFRAME - FULLSCREEN DI SEMUA DEVICE */
.modal-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    z-index: 9999;
}

/* 🎨 CLOSE BUTTON */
.modal-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    touch-action: manipulation;
}

.modal-close-btn:hover {
    background: rgba(237, 28, 36, 0.9);
    transform: rotate(90deg) scale(1.1);
}

.modal-close-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.modal-close-btn svg {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

/* ✅ Responsive untuk tablet */
@media (max-width: 1024px) {
    .topup-iframe-wrapper {
        padding: 12px;
    }
    
    .topup-iframe-wrapper .topup-iframe {
        width: 92vw;
        height: 70vh;
        border-radius: 10px;
    }
    
    /* ⚠️ MODAL TETAP FULLSCREEN */
    .modal-iframe {
        width: 100vw !important;
        height: 100vh !important;
    }
}

/* ✅ Responsive untuk mobile - PERBAIKAN UTAMA */
@media (max-width: 768px) {
    .topup-iframe-wrapper {
        padding: 8px;
    }
    
    .topup-iframe-wrapper .topup-iframe {
        width: 96vw;
        height: 96vh;
        border-radius: 8px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }
    
    /* 🔥 MODAL FULLSCREEN DI MOBILE */
    .modal-container {
        width: 100vw !important;
        height: 100vh !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .modal-iframe {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    .modal-close-btn {
        width: 44px;
        height: 44px;
        top: 16px;
        right: 16px;
        z-index: 10001;
    }
    
    .modal-close-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* ✅ Responsive untuk mobile kecil */
@media (max-width: 480px) {
    .topup-iframe-wrapper {
        padding: 4px;
    }
    
    .topup-iframe-wrapper .topup-iframe {
        width: 98vw;
        height: 50vh;
        border-radius: 6px;
    }
    
    /* 🔥 ENFORCE FULLSCREEN */
    .modal-container,
    .modal-iframe {
        width: 100vw !important;
        height: 100vh !important;
    }
}

/* ✅ Landscape mode untuk mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .topup-iframe-wrapper .topup-iframe {
        width: 98vw;
        height: 96vh;
    }
    
    /* 🔥 MODAL FULLSCREEN LANDSCAPE */
    .modal-container,
    .modal-iframe {
        width: 100vw !important;
        height: 100vh !important;
    }
}

/* ✅ Safe area untuk notch (iPhone X dan sejenisnya) */
@supports (padding-top: env(safe-area-inset-top)) {
    .topup-iframe-wrapper {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    @media (max-width: 768px) {
        .topup-iframe-wrapper {
            padding-top: max(8px, env(safe-area-inset-top));
            padding-bottom: max(8px, env(safe-area-inset-bottom));
            padding-left: max(8px, env(safe-area-inset-left));
            padding-right: max(8px, env(safe-area-inset-right));
        }
    }
    
    .modal-close-btn {
        top: max(20px, env(safe-area-inset-top));
        right: max(20px, env(safe-area-inset-right));
    }
}

/* 🎨 PREVENT BODY SCROLL WHEN MODAL ACTIVE */
body.modal-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}