/**
 * Golf Post Growth Widgets
 * Popup/Slide-in system for email capture + contest teasers
 *
 * Two variants:
 *   A) Newsletter Signup (email input in popup)
 *   B) Contest Teaser (redirects to landing page)
 *
 * Mobile formats:
 *   - Bottom Sheet (slide-up, 50% height)
 *   - Sticky Bottom Bar (1-line minimal)
 *   - Inline Card (embedded in content)
 */

/* ─── Reset & Container ─────────────────────────── */

.gpgw-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gpgw-overlay.gpgw-visible {
    opacity: 1;
    visibility: visible;
}

.gpgw-popup {
    position: fixed;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

.gpgw-popup *,
.gpgw-popup *::before,
.gpgw-popup *::after {
    box-sizing: border-box;
}

.gpgw-popup.gpgw-visible {
    opacity: 1;
    visibility: visible;
}


/* ─── Desktop: Slide-in from bottom-right ───────── */

@media (min-width: 769px) {
    .gpgw-popup.gpgw-desktop {
        bottom: 24px;
        right: 24px;
        width: 400px;
        max-width: calc(100vw - 48px);
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
        background: #ffffff;
        transform: translateY(20px);
    }

    .gpgw-popup.gpgw-desktop.gpgw-visible {
        transform: translateY(0);
    }
}


/* ─── Mobile: Bottom Sheet ──────────────────────── */

@media (max-width: 768px) {
    .gpgw-popup.gpgw-bottom-sheet {
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 55vh; /* NOT fullscreen - avoid Google penalty */
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
        background: #ffffff;
        transform: translateY(100%);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .gpgw-popup.gpgw-bottom-sheet.gpgw-visible {
        transform: translateY(0);
    }

    .gpgw-popup.gpgw-bottom-sheet .gpgw-drag-handle {
        display: block;
    }
}


/* ─── Mobile: Sticky Bottom Bar ─────────────────── */

.gpgw-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #1a1a2e;
    color: #ffffff;
    padding: 10px 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gpgw-sticky-bar.gpgw-visible {
    display: flex;
    transform: translateY(0);
}

.gpgw-sticky-bar .gpgw-sticky-text {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gpgw-sticky-bar .gpgw-sticky-cta {
    display: inline-block;
    background: #04AE79;
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.gpgw-sticky-bar .gpgw-sticky-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}


/* ─── Inline Card ───────────────────────────────── */

.gpgw-inline-card {
    background: #ffffff;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    text-align: center;
}

.gpgw-inline-card .gpgw-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px 0;
}

.gpgw-inline-card .gpgw-card-text {
    font-size: 14px;
    color: #6c757d;
    margin: 0 0 16px 0;
}


/* ─── Popup Inner Structure ─────────────────────── */

.gpgw-drag-handle {
    display: none;
    width: 40px;
    height: 4px;
    background: #d0d0d0;
    border-radius: 2px;
    margin: 8px auto 0;
}

.gpgw-header {
    position: relative;
    padding: 20px 20px 0;
}

.gpgw-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    line-height: 1;
}

.gpgw-close:hover {
    background: #f0f0f0;
    color: #333;
}

.gpgw-body {
    padding: 12px 20px 20px;
}

.gpgw-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px 0;
    padding-right: 32px;
}

.gpgw-subtitle {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
}


/* ─── Contest Teaser (Variant B) ────────────────── */

.gpgw-contest-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 16px;
}

.gpgw-cta-button {
    display: block;
    width: 100%;
    background: #04AE79;
    color: #ffffff;
    text-align: center;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.gpgw-cta-button:hover {
    background: #039968;
    color: #ffffff;
    text-decoration: none;
}

.gpgw-partner-tag {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-top: 10px;
}


/* ─── Newsletter Signup (Variant A) ─────────────── */

.gpgw-form-group {
    margin-bottom: 12px;
}

.gpgw-email-row {
    display: flex;
    gap: 8px;
}

.gpgw-email-input {
    flex: 1;
    padding: 12px 14px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
    color: #1a1a2e;
}

.gpgw-email-input:focus {
    border-color: #04AE79;
}

.gpgw-email-input::placeholder {
    color: #b0b0b0;
}

.gpgw-submit-btn {
    background: #04AE79;
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    font-family: inherit;
}

.gpgw-submit-btn:hover {
    background: #039968;
}

.gpgw-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.gpgw-frequency-row {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.gpgw-frequency-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
}

.gpgw-frequency-label input[type="radio"] {
    accent-color: #04AE79;
    margin: 0;
}


/* ─── Verification Code Step ────────────────────── */

.gpgw-code-step {
    display: none;
    text-align: center;
}

.gpgw-code-step.gpgw-active {
    display: block;
}

.gpgw-email-step {
    display: block;
}

.gpgw-email-step.gpgw-hidden {
    display: none;
}

.gpgw-code-info {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 16px;
}

.gpgw-code-info strong {
    color: #1a1a2e;
}

.gpgw-code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.gpgw-code-digit {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    font-family: inherit;
    color: #1a1a2e;
    transition: border-color 0.2s;
}

.gpgw-code-digit:focus {
    border-color: #04AE79;
}

.gpgw-code-resend {
    font-size: 12px;
    color: #04AE79;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    margin-top: 8px;
    font-family: inherit;
}

.gpgw-code-resend:disabled {
    color: #999;
    cursor: not-allowed;
    text-decoration: none;
}

.gpgw-verify-btn {
    display: block;
    width: 100%;
    background: #04AE79;
    color: #ffffff;
    border: none;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.gpgw-verify-btn:hover {
    background: #039968;
}

.gpgw-verify-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}


/* ─── Success State ─────────────────────────────── */

.gpgw-success {
    display: none;
    text-align: center;
    padding: 20px;
}

.gpgw-success.gpgw-active {
    display: block;
}

.gpgw-success-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.gpgw-success-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px 0;
}

.gpgw-success-text {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
}


/* ─── Error State ───────────────────────────────── */

.gpgw-error {
    display: none;
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    color: #c62828;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
}

.gpgw-error.gpgw-active {
    display: block;
}


/* ─── Loading Spinner ───────────────────────────── */

.gpgw-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gpgw-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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


/* ─── Privacy Note ──────────────────────────────── */

.gpgw-privacy {
    font-size: 11px;
    color: #999;
    margin-top: 10px;
    text-align: center;
}

.gpgw-privacy a {
    color: #999;
    text-decoration: underline;
}


/* ─── Animation: fade-slide for bottom sheet ────── */

@media (max-width: 768px) {
    .gpgw-popup.gpgw-bottom-sheet {
        will-change: transform;
    }
}

@media (min-width: 769px) {
    .gpgw-popup.gpgw-desktop {
        will-change: transform, opacity;
    }
}


/* ─── Honeypot (hidden from users) ──────────────── */

.gpgw-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}
