/* ============================================================
   GX Coupons – Offline Popup Modal System
   Works entirely from DOM data – no API required.
   Preserves all existing styles/scripts.
   ============================================================ */

/* ── Overlay ── */
#gx-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 12px;
    animation: gx-fade-in 0.25s ease;
}
#gx-popup-overlay.gx-open {
    display: flex;
}
@keyframes gx-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Modal container ── */
#gx-popup-modal {
    background: #08080a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: gx-slide-up 0.3s cubic-bezier(0.34,1.56,0.64,1);
    scrollbar-width: thin;
    scrollbar-color: #1a1a1a #030303;
}
#gx-popup-modal::-webkit-scrollbar { width: 6px; }
#gx-popup-modal::-webkit-scrollbar-track { background: #030303; }
#gx-popup-modal::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 3px; }

@keyframes gx-slide-up {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Modal Header (banner) ── */
#gx-popup-header {
    position: relative;
    min-height: 130px;
    background-size: cover;
    background-position: center;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    flex-shrink: 0;
}
#gx-popup-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(3,3,3,0.15) 0%, rgba(8,8,10,0.95) 100%);
}
#gx-popup-header-content {
    position: relative;
    z-index: 2;
    padding: 20px 20px 16px;
}
#gx-popup-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px;
    line-height: 1.3;
    padding-right: 36px; /* space for close btn */
}

/* Badges row */
.gx-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.gx-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(255,255,255,0.1);
    color: #fff;
    white-space: nowrap;
}
.gx-badge-verified {
    background: rgba(239,68,68,0.25);
    border: 1px solid rgba(239,68,68,0.5);
    color: #ef4444;
}
.gx-badge svg {
    width: 12px; height: 12px;
    flex-shrink: 0;
}

/* ── Close button ── */
#gx-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ef4444;
    transition: background 0.2s, transform 0.2s;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}
#gx-popup-close:hover {
    background: rgba(239,68,68,0.2);
    transform: rotate(90deg);
}

/* ── Screens ── */
.gx-screen {
    display: none;
    flex-direction: column;
    padding: 20px;
    gap: 18px;
    animation: gx-fade-in 0.25s ease;
}
.gx-screen.gx-active {
    display: flex;
}

/* ── Incentive banner (screen 1) ── */
.gx-incentive-banner {
    background: #0a0a0c;
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.gx-incentive-banner::before,
.gx-incentive-banner::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 18px; height: 18px;
    background: #08080a;
    border-radius: 50%;
    transform: translateY(-50%);
}
.gx-incentive-banner::before { left: -9px; }
.gx-incentive-banner::after  { right: -9px; }
.gx-incentive-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ef4444;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}
.gx-incentive-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
    font-weight: 500;
}

/* ── Stats row ── */
.gx-stats-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.gx-stat-item {
    flex: 1;
    background: #0a0a0c;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
}
.gx-stat-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 1rem;
    font-weight: 700;
    color: #ef4444;
    font-family: 'Orbitron', sans-serif;
}
.gx-stat-value svg {
    width: 16px; height: 16px;
}
.gx-stat-label {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 4px;
}

/* ── Description section ── */
.gx-details-section h4 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ef4444;
    margin: 0 0 8px;
}
.gx-details-section p {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.6;
    margin: 0;
}

/* ── Show Full Code button (screen 1 footer) ── */
.gx-reveal-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0a0a0c;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 4px 4px 4px 16px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.gx-reveal-wrapper:hover {
    border-color: rgba(239,68,68,0.4);
    box-shadow: 0 0 20px rgba(239,68,68,0.1);
}
.gx-partial-code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    color: #64748b;
    letter-spacing: 2px;
    user-select: none;
}
.gx-show-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 4px 15px rgba(239,68,68,0.3);
}
.gx-show-btn:hover {
    background: #dc2626;
    box-shadow: 0 0 25px rgba(239,68,68,0.5);
    transform: translateY(-1px);
}

/* ── Screen 2: Progress ── */
#gx-screen-2 {
    align-items: center;
    min-height: 220px;
    justify-content: center;
}
.gx-progress-ring-wrap {
    position: relative;
    width: 120px;
    height: 120px;
}
.gx-progress-ring {
    transform: rotate(-90deg);
}
.gx-ring-bg { fill: none; stroke: #1a1a1a; }
.gx-ring-fill {
    fill: none;
    stroke: #ef4444;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.15s linear;
}
.gx-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ef4444;
}
.gx-ring-checkmark {
    width: 32px; height: 32px;
    color: #ef4444;
}
.gx-progress-msg {
    font-size: 0.82rem;
    color: #94a3b8;
    text-align: center;
    min-height: 20px;
    animation: gx-fade-in 0.3s ease;
}
.gx-progress-bar-track {
    width: 100%;
    height: 3px;
    background: #1a1a1a;
    border-radius: 2px;
}
.gx-progress-bar-fill {
    height: 100%;
    background: #ef4444;
    border-radius: 2px;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px rgba(239,68,68,0.6);
}

/* ── Screen 3: Code reveal ── */
#gx-screen-3 {
    text-align: center;
    align-items: center;
}
.gx-ready-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}
.gx-ready-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
}
/* Coupon code box */
.gx-code-box {
    width: 100%;
    background: #0a0a0c;
    border: 1.5px dashed rgba(239,68,68,0.35);
    border-radius: 12px;
    padding: 16px;
    position: relative;
}
.gx-code-box-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.gx-code-label-text {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #94a3b8;
}
.gx-locked-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    background: rgba(255,255,255,0.05);
    padding: 3px 8px;
    border-radius: 20px;
}
.gx-locked-badge svg { width: 10px; height: 10px; }
.gx-unlocked-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #10b981;
    background: rgba(16,185,129,0.1);
    padding: 3px 8px;
    border-radius: 20px;
}
.gx-unlocked-badge svg { width: 10px; height: 10px; }
.gx-code-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    letter-spacing: 3px;
    text-align: center;
}
.gx-code-blurred {
    color: #64748b;
    filter: blur(4px);
    user-select: none;
    transition: filter 0.4s ease, color 0.4s ease;
}
.gx-code-revealed {
    color: #ef4444;
    filter: none;
    font-weight: 700;
    animation: gx-bounce-in 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes gx-bounce-in {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
/* Copy button */
.gx-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s, border-color 0.2s;
    font-family: 'Inter', sans-serif;
}
.gx-copy-btn:hover {
    background: rgba(239,68,68,0.2);
    border-color: #ef4444;
}
.gx-copy-btn.gx-copied {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.4);
    color: #10b981;
}
/* Full Code button */
.gx-get-full-btn {
    width: 100%;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(239,68,68,0.35);
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    animation: gx-btn-pulse 2s ease-in-out infinite;
}
@keyframes gx-btn-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(239,68,68,0.35); }
    50%       { box-shadow: 0 0 30px rgba(239,68,68,0.7), 0 0 60px rgba(239,68,68,0.3); }
}
.gx-get-full-btn:hover {
    background: #dc2626;
    box-shadow: 0 0 35px rgba(239,68,68,0.65);
    transform: translateY(-1px);
    animation: none;
}
.gx-get-full-btn:disabled {
    background: #374151;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    color: #6b7280;
    animation: none;
}
/* Spinner inside button */
.gx-btn-spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gx-spin 0.7s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes gx-spin {
    to { transform: rotate(360deg); }
}
/* Success state */
.gx-success-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #10b981;
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: 8px;
    padding: 10px 14px;
    width: 100%;
    animation: gx-fade-in 0.3s ease;
}
.gx-success-msg svg { width: 16px; height: 16px; }

/* ── Rating section ── */
.gx-rating-section {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.gx-rating-title {
    font-size: 0.78rem;
    color: #64748b;
}
.gx-rating-btns {
    display: flex;
    gap: 12px;
}
.gx-rate-btn {
    background: #0a0a0c;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}
.gx-rate-btn svg { width: 18px; height: 18px; }
.gx-rate-btn.gx-liked  { border-color: rgba(239,68,68,0.5); color: #ef4444; background: rgba(239,68,68,0.08); }
.gx-rate-btn.gx-disliked { border-color: rgba(100,116,139,0.5); color: #94a3b8; background: rgba(100,116,139,0.08); }

/* ── Mobile ── */
@media (max-width: 576px) {
    #gx-popup-modal {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }
    #gx-popup-overlay {
        align-items: flex-end;
        padding: 0;
    }
    #gx-popup-title { font-size: 0.88rem; }
    .gx-show-btn { padding: 10px 12px; font-size: 0.68rem; }
    .gx-code-display { font-size: 0.95rem; letter-spacing: 2px; }
}
