/**
 * Multi Payment Gateway — Modal Stylesheet v3.0
 *
 * NEW DESIGN (v3):
 *  - Fully redesigned to match the reference screenshots.
 *  - Mobile-first: Single-column layout on all screen sizes.
 *  - Screen A (Method List): Clean list of payment methods with ">" chevron.
 *    Header shows title + amount + order number. Red × close button.
 *  - Screen B (Method Detail): Header shows method name + red ×.
 *    Full detail cards below. "Change payment method" link at bottom.
 *  - Desktop: Same single-column layout, max-width constrained, centered.
 *  - Color tokens via CSS custom properties for easy theming.
 *
 * @package Multi_Payment_Gateway
 * @version 3.0.0
 */

/* =============================================================================
   0. COLOR TOKENS
   ============================================================================= */

:root {
    --mpg-accent:           #1a1a1a;
    --mpg-accent-hover:     #333333;
    --mpg-accent-text:      #ffffff;
    --mpg-secondary-color:  #555555;
    --mpg-close-color:      #cc2200;   /* red × */
    --mpg-border:           #e8e8e8;
    --mpg-bg-list:          #f2f2f2;   /* light grey list rows */
    --mpg-radius:           12px;
}

/* =============================================================================
   1. OVERLAY
   ============================================================================= */

#mpg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.22s ease;
}

#mpg-overlay.mpg-visible { opacity: 1; }

/* =============================================================================
   2. MODAL WRAPPER
   ============================================================================= */

#mpg-modal {
    position: fixed;
    /* Always centered */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    /* Responsive sizing */
    width: min(480px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar but allow scroll */
    scrollbar-width: none;
    background: #ffffff;
    border-radius: var(--mpg-radius);
    box-shadow: 0 16px 56px rgba(0, 0, 0, 0.24);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: #1a1a1a;
}

#mpg-modal::-webkit-scrollbar { display: none; }

#mpg-modal.mpg-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* =============================================================================
   3. SCREEN — generic wrapper for each view
   ============================================================================= */

.mpg-screen {
    display: none;
    flex-direction: column;
    min-height: 100%;
}

.mpg-screen.mpg-active { display: flex; }

/* =============================================================================
   4. SHARED HEADER BAR
   ============================================================================= */

.mpg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 16px;
    border-bottom: 1.5px solid var(--mpg-border);
    flex-shrink: 0;
}

/* Title area (left side) */
.mpg-header-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    flex: 1;
    min-width: 0;
    padding-right: 12px;
}

/* Red × close button (right side) */
.mpg-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0 2px 8px;
    line-height: 1;
    flex-shrink: 0;
}

.mpg-close-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* =============================================================================
   5. SCREEN A — METHOD LIST
   Matches "Sample.jpg": intro text + grey list rows with chevron
   ============================================================================= */

/* Intro text block below the header */
.mpg-list-intro {
    padding: 18px 20px 14px;
    font-size: 15px;
    color: #333;
    line-height: 1.55;
    text-align: center;
    border-bottom: 1px solid var(--mpg-border);
}

.mpg-list-intro strong {
    font-weight: 700;
}

/* The list itself */
.mpg-methods-list {
    flex: 1;
}

/* Individual method row */
.mpg-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--mpg-bg-list);
    border-bottom: 1px solid var(--mpg-border);
    cursor: pointer;
    transition: background 0.12s;
    gap: 12px;
    text-align: left;
    width: 100%;
    border-left: none;
    border-right: none;
    border-top: none;
}

/* First row — slight top rounding continuation */
.mpg-list-row:first-child { border-top: none; }

.mpg-list-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.mpg-list-row:hover,
.mpg-list-row:focus {
    background: #e6e6e6;
    outline: none;
}

/* Left: icon + name */
.mpg-list-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.mpg-list-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

.mpg-list-name {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right: chevron > */
.mpg-list-chevron {
    flex-shrink: 0;
    color: #aaa;
    font-size: 18px;
    line-height: 1;
}

/* =============================================================================
   6. SCREEN B — METHOD DETAIL
   Matches "Image 2 (2.jpg)": method name in header, detail cards, CTA button
   ============================================================================= */

.mpg-detail-body {
    padding: 20px 20px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Instruction line above the cards */
.mpg-instruction-text {
    font-size: 15px;
    color: #333;
    text-align: center;
    line-height: 1.55;
    margin: 0 0 18px;
}

/* Cards container */
.mpg-detail-cards {
    border: 1.5px dashed #ccc;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.mpg-detail-card {
    padding: 12px 16px;
    border-bottom: 1px solid #ebebeb;
    position: relative;
}

.mpg-detail-card:last-child { border-bottom: none; }

.mpg-detail-card-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #aaa;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.mpg-detail-card-value {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
    word-break: break-all;
    padding-right: 4px;
}

/* Copy button */
.mpg-copy-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #d0d0d0;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    padding: 0;
    color: #444;
}

.mpg-copy-btn:hover { background: #bbb; }

.mpg-copy-btn svg { width: 16px; height: 16px; }

/* Reminder paragraph */
.mpg-reminder-text {
    font-size: 13.5px;
    color: #666;
    text-align: center;
    line-height: 1.6;
    margin: 4px 0 20px;
    flex: 1;
}

/* =============================================================================
   7. SCREEN C — UPLOAD (step 2)
   ============================================================================= */

.mpg-upload-body {
    padding: 20px 20px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mpg-upload-instruction {
    font-size: 15px;
    color: #444;
    text-align: center;
    line-height: 1.55;
    margin: 0 0 18px;
}

.mpg-upload-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    width: 80px;
    height: 80px;
    cursor: pointer;
}

.mpg-upload-icon-wrap svg {
    width: 72px;
    height: 72px;
    opacity: 0.38;
    transition: opacity 0.15s;
}

.mpg-upload-icon-wrap:hover svg { opacity: 0.65; }

.mpg-file-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    padding: 11px 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.15s;
    gap: 8px;
}

.mpg-file-input-row:hover { border-color: #999; }

.mpg-file-input-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #555;
    font-size: 14px;
    flex: 1;
}

.mpg-max-size {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}

.mpg-file-name-preview {
    font-size: 12.5px;
    color: #27ae60;
    text-align: center;
    margin-bottom: 8px;
    min-height: 18px;
    font-weight: 600;
    word-break: break-all;
}

.mpg-error-msg {
    background: #fff0f0;
    border: 1px solid #f5c6cb;
    color: #c0392b;
    font-size: 13.5px;
    border-radius: 5px;
    padding: 10px 14px;
    margin-bottom: 10px;
    text-align: center;
    animation: mpgFadeIn 0.15s ease;
}

/* =============================================================================
   8. SCREEN D — SUCCESS (step 3)
   ============================================================================= */

.mpg-success-body {
    padding: 30px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.mpg-success-icon {
    width: 58px;
    height: 58px;
    background: var(--mpg-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.mpg-success-icon svg {
    width: 30px;
    height: 30px;
}

.mpg-success-heading {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px;
    line-height: 1.3;
}

.mpg-success-description {
    font-size: 14px;
    color: #666;
    line-height: 1.65;
    margin: 0 0 24px;
    max-width: 340px;
}

.mpg-success-description a { color: #6699cc; text-decoration: none; }
.mpg-success-description a:hover { text-decoration: underline; }

.mpg-countdown-text {
    font-size: 12.5px;
    color: #aaa;
    margin-top: 8px;
    text-align: center;
}

/* =============================================================================
   9. FOOTER BUTTONS (shared)
   ============================================================================= */

.mpg-footer {
    padding: 0 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

/* Primary CTA */
.mpg-btn-primary {
    width: 100%;
    padding: 15px 20px;
    background: var(--mpg-accent);
    color: var(--mpg-accent-text);
    border: none;
    border-radius: 6px;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.15s, opacity 0.15s;
    text-align: center;
}

.mpg-btn-primary:hover  { background: var(--mpg-accent-hover); }
.mpg-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Loading spinner on primary */
.mpg-btn-primary.mpg-loading::after {
    content: '';
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: var(--mpg-accent-text);
    border-radius: 50%;
    animation: mpgSpin 0.65s linear infinite;
    margin-left: 9px;
    vertical-align: middle;
}

@keyframes mpgSpin { to { transform: rotate(360deg); } }

/* "Change payment method" / secondary link button */
.mpg-btn-change {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 12px 20px;
    background: none;
    color: var(--mpg-secondary-color);
    border: 1.5px solid var(--mpg-border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.mpg-btn-change:hover {
    background: #f4f4f4;
    border-color: #bbb;
    color: #1a1a1a;
}

.mpg-btn-change svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
}

/* "Close Window" button (step 3) */
.mpg-btn-close-window {
    width: 100%;
    padding: 14px 20px;
    background: #fff;
    color: #333;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.mpg-btn-close-window:hover { background: #f5f5f5; border-color: #bbb; }

/* =============================================================================
   10. ANIMATIONS
   ============================================================================= */

@keyframes mpgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mpg-screen.mpg-active {
    animation: mpgFadeIn 0.18s ease;
}

/* =============================================================================
   11. BODY SCROLL LOCK
   ============================================================================= */

body.mpg-modal-open { overflow: hidden !important; }
