/* PayTabs — Popup Modal */

body.pt-popup-open { overflow: hidden; }

#pt-popup-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

#pt-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* ── Shared box ── */
#pt-popup-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}

/* ── IFRAME VIEW ── */
#pt-iframe-view {
    width: min(96vw, 680px);
    height: 82vh;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

#pt-popup-close {
    position: sticky;
    top: 10px;
    margin-left: auto;
    margin-right: 12px;
    margin-top: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
#pt-popup-close:hover { background: #e2e8f0; color: #1e293b; }

#pt-iframe-status {
    margin: 0 14px 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
#pt-iframe-status.is-error { background:#fef2f2; border-color:#fca5a5; color:#b91c1c; }
#pt-iframe-status.is-loading::before {
    content:'';
    display:inline-block;
    width:13px; height:13px;
    border:2px solid #e2e8f0;
    border-top-color:#6366f1;
    border-radius:50%;
    animation: pt-spin 0.7s linear infinite;
    flex-shrink: 0;
}

#pt-popup-frame-wrap {
    flex: none;
    margin: 0 14px 14px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
#pt-popup-iframe {
    display: block;
    width: 100%;
    height: 580px;
    border: 0;
    background: #f8fafc;
}

/* ── NEW TAB WAITING VIEW ── */
#pt-newtab-view {
    width: min(92vw, 460px);
    padding: 36px 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}
#pt-nt-icon { font-size: 40px; line-height: 1; }
#pt-newtab-view h2 { margin:0; font-size:20px; font-weight:700; color:#111827; }
#pt-nt-desc { margin:0; font-size:14px; color:#6b7280; line-height:1.6; }

#pt-nt-spinner {
    width:36px; height:36px;
    border:3px solid #e5e7eb;
    border-top-color:#6366f1;
    border-radius:50%;
    display:none;
    animation: pt-spin 0.8s linear infinite;
}
#pt-nt-spinner.active { display:block; }

#pt-nt-msg {
    font-size:13px; padding:8px 14px;
    border-radius:8px; background:#f8fafc;
    border:1px solid #e2e8f0; color:#374151;
    width:100%; box-sizing:border-box;
}
#pt-nt-msg.is-error   { background:#fef2f2; border-color:#fca5a5; color:#b91c1c; }
#pt-nt-msg.is-success { background:#f0fdf4; border-color:#86efac; color:#15803d; }

#pt-nt-actions { display:flex; flex-direction:column; gap:8px; width:100%; margin-top:4px; }

#pt-nt-check-btn {
    width:100%; padding:13px 20px;
    background:#6366f1; color:#fff;
    border:none; border-radius:10px;
    font-size:15px; font-weight:600;
    cursor:pointer; transition:background 0.15s;
}
#pt-nt-check-btn:hover:not(:disabled) { background:#4f46e5; }
#pt-nt-check-btn:disabled { opacity:0.6; cursor:default; }

#pt-nt-reopen-btn {
    width:100%; padding:10px 20px;
    background:#f1f5f9; color:#374151;
    border:1px solid #e2e8f0; border-radius:10px;
    font-size:14px; font-weight:500;
    cursor:pointer; transition:background 0.15s;
}
#pt-nt-reopen-btn:hover { background:#e2e8f0; }

#pt-nt-cancel-btn {
    background:none; border:none;
    color:#9ca3af; font-size:13px;
    cursor:pointer; text-decoration:underline;
}
#pt-nt-cancel-btn:hover { color:#6b7280; }

@keyframes pt-spin { to { transform:rotate(360deg); } }

@media (max-width: 768px) {
    #pt-iframe-view { height:78vh; max-height:78vh; width:96vw; }
    #pt-popup-iframe { height:620px; }
    #pt-newtab-view { padding:28px 20px 22px; }
    #pt-newtab-view h2 { font-size:17px; }
}
