/* ============================================================================
 * pro-upgrade.css — MyBest24 Pro upgrade modal
 *
 * D3 modal styles. Kept self-contained so the modal renders correctly even
 * if other CSS files are missing or out of order.
 *
 * Uses the existing `.modal-hidden` class from the app's modal pattern.
 * ========================================================================= */

/* ── Backdrop / container ────────────────────────────────────────────────── */
#pro-upgrade-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
}
#pro-upgrade-modal.modal-hidden { display: none; }

/* ── Modal box ───────────────────────────────────────────────────────────── */
.pro-upgrade-box {
    background: #1a1a1a;
    color: #efefef;
    border-radius: 16px;
    width: 100%;
    max-width: 460px;
    padding: 32px 28px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.pro-upgrade-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.pro-upgrade-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #efefef;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.pro-upgrade-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: #efefef;
}
.pro-upgrade-subtitle {
    font-size: 0.9rem;
    color: #999;
    margin: 0 0 24px;
    line-height: 1.4;
}

/* ── Plan options ────────────────────────────────────────────────────────── */
.pro-plan-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.pro-plan-option {
    display: block;
    cursor: pointer;
    position: relative;
}
.pro-plan-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.pro-plan-card {
    border: 2px solid #333;
    border-radius: 12px;
    padding: 14px 12px;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    background: #222;
}
.pro-plan-option input[type="radio"]:checked + .pro-plan-card {
    border-color: #46a5ce;
    background: rgba(70, 165, 206, 0.08);
}
.pro-plan-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: #efefef;
    margin-bottom: 2px;
}
.pro-plan-meta {
    font-size: 0.75rem;
    color: #999;
}
.pro-plan-save {
    display: block;
    font-size: 0.7rem;
    color: #3cba6c;
    margin-top: 4px;
    font-weight: 600;
}
.pro-plan-tag {
    display: block;
    font-size: 0.7rem;
    color: #e8b53b;
    margin-top: 4px;
    font-weight: 600;
}

/* ── Disclosure text ─────────────────────────────────────────────────────── */
.pro-disclosure {
    font-size: 0.78rem;
    color: #aaa;
    line-height: 1.5;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid #46a5ce;
}

/* ── Consent checkbox ────────────────────────────────────────────────────── */
.pro-consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 18px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #ccc;
}
.pro-consent input[type="checkbox"] {
    margin: 2px 0 0 0;
    width: 18px; height: 18px;
    accent-color: #46a5ce;
    cursor: pointer;
    flex-shrink: 0;
}
.pro-consent a {
    color: #46a5ce;
    text-decoration: underline;
}
.pro-consent a:hover { color: #6cb5d6; }

/* ── Pay button ──────────────────────────────────────────────────────────── */
.pro-pay-btn {
    display: block;
    width: 100%;
    background: #46a5ce;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.pro-pay-btn:hover:not(:disabled) { background: #3a92b8; }
.pro-pay-btn:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ── Error display ───────────────────────────────────────────────────────── */
.pro-pay-error {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(220, 50, 50, 0.12);
    border: 1px solid rgba(220, 50, 50, 0.4);
    border-radius: 8px;
    color: #ff8888;
    font-size: 0.85rem;
    line-height: 1.4;
}
.pro-pay-error.hidden { display: none; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .pro-upgrade-box {
        padding: 24px 20px 20px;
        border-radius: 12px;
    }
    .pro-upgrade-title { font-size: 1.2rem; }
    .pro-plan-card { padding: 12px 8px; }
    .pro-plan-price { font-size: 1rem; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .pro-upgrade-close,
    .pro-plan-card,
    .pro-pay-btn { transition: none; }
}

/* ============================================================================
 * Stripe-return overlay (D5 Step 2)
 *
 * Shown when the user lands back on /app/?stripe_return=success after Checkout.
 * Polls /api/planner/entitlement.php until is_pro flips, then transitions to
 * a success state and auto-closes. Also used for the cancel + timeout paths.
 *
 * Sits on top of the regular pro-upgrade-modal (z-index higher), so even if
 * both somehow show at once the return overlay is dominant.
 * ========================================================================= */
.pro-return-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}
.pro-return-overlay.modal-hidden { display: none; }

.pro-return-box {
    background: #1a1a1a;
    color: #efefef;
    border-radius: 16px;
    padding: 36px 32px 28px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.pro-return-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 18px;
    border: 3px solid rgba(70, 165, 206, 0.2);
    border-top-color: #46a5ce;
    border-radius: 50%;
    animation: pro-return-spin 0.9s linear infinite;
}

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

.pro-return-message {
    font-size: 1rem;
    line-height: 1.45;
    color: #efefef;
    margin: 0 0 4px;
}

.pro-return-close {
    margin-top: 16px;
    background: #46a5ce;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.pro-return-close:hover { background: #3a92b8; }

@media (prefers-reduced-motion: reduce) {
    .pro-return-spinner {
        animation: none;
        border-top-color: rgba(70, 165, 206, 0.5);
    }
    .pro-return-close { transition: none; }
}
