/* ================================================================
   Rankbeta Email — Welcome Discount Popup
   Light premium UI — matches lavender/violet promo image
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&display=swap');

:root {
    --rbe-bg:      #f5f0fa;
    --rbe-surface: #ffffff;
    --rbe-border:  rgba(124, 58, 237, 0.1);
    --rbe-text:    #1a1a2e;
    --rbe-muted:   #8e8e9f;
    --rbe-accent:  #a78bfa;
    --rbe-accent2: #7c3aed;
    --rbe-glow:    rgba(167, 139, 250, 0.12);
}

/* ================================================================
   Overlay
   ================================================================ */

.rbe-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s, visibility 0.35s;
    padding: 16px;
}

.rbe-overlay.rbe-active {
    opacity: 1;
    visibility: visible;
}

/* ================================================================
   Popup Card
   ================================================================ */

.rbe-popup {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--rbe-bg);
    border: 1px solid rgba(167, 139, 250, 0.15);
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.25),
        0 0 60px rgba(167, 139, 250, 0.08);
    animation: rbePopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    max-height: 96vh;
}

@keyframes rbePopIn {
    from { opacity: 0; transform: scale(0.92) translateY(24px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Accent gradient top line */
.rbe-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 5;
    background: linear-gradient(90deg, #e879f9, var(--rbe-accent), var(--rbe-accent2));
}

/* ---- Close ---- */

.rbe-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    color: #555;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rbe-close:hover {
    background: #fff;
    color: #1a1a2e;
    transform: scale(1.05);
}

/* ================================================================
   Hero Image
   ================================================================ */

.rbe-hero {
    position: relative;
    width: 100%;
    flex: 4;
    min-height: 0;
    line-height: 0;
    background: var(--rbe-bg);
    overflow: hidden;
}

.rbe-hero img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* Gradient fade — image blends into form strip */
.rbe-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--rbe-bg));
    pointer-events: none;
}

/* Placeholder state */
.rbe-hero--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    line-height: 1.4;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(167, 139, 250, 0.08), transparent 60%),
        var(--rbe-bg);
}

.rbe-hero--empty span {
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    color: var(--rbe-muted);
    letter-spacing: 0.5px;
}

/* ================================================================
   Form Strip
   ================================================================ */

.rbe-form-strip {
    flex-shrink: 0;
    padding: 14px 20px 18px;
    background: var(--rbe-bg);
    position: relative;
}

.rbe-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.rbe-form input[type="email"],
.rbe-form .rbe-error,
.rbe-form .rbe-submit,
.rbe-form button.rbe-submit {
    grid-column: 1 / -1;
}

.rbe-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 12px;
    background: #ffffff;
    color: var(--rbe-text);
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rbe-form input::placeholder {
    color: #b0b0c0;
    font-size: 12px;
}

.rbe-form input:focus {
    border-color: var(--rbe-accent);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.12);
}

.rbe-form input.rbe-input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ---- Error ---- */

.rbe-error {
    font-family: 'Sora', sans-serif;
    font-size: 11px;
    color: #ef4444;
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}

.rbe-error.rbe-visible {
    opacity: 1;
    min-height: 16px;
}

/* ---- Submit Button ---- */

.rbe-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--rbe-accent2), var(--rbe-accent), #e879f9);
    background-size: 200% 200%;
    color: #fff;
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-position 0.4s ease;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    animation: rbePulseGlow 2.5s ease-in-out infinite;
}

/* Shimmer sweep across button */
.rbe-submit::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
}

.rbe-submit:hover::after {
    left: 100%;
}

/* Subtle breathing glow */
@keyframes rbePulseGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2); }
    50%      { box-shadow: 0 4px 25px rgba(167, 139, 250, 0.4); }
}

.rbe-submit:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.45);
    background-position: 100% 50%;
}

.rbe-submit:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

.rbe-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    animation: none;
    box-shadow: none;
}

/* ---- Spinner ---- */

.rbe-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: rbeSpin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

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

/* ---- Dismiss ---- */

.rbe-dismiss {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 0;
    border: none;
    background: none;
    color: var(--rbe-muted);
    font-family: 'Sora', sans-serif;
    font-size: 11px;
    cursor: pointer;
    text-align: center;
    transition: color 0.2s;
}

.rbe-dismiss:hover {
    color: var(--rbe-text);
}

/* ================================================================
   Success State
   ================================================================ */

.rbe-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 28px 36px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 30%, rgba(167, 139, 250, 0.08), transparent 60%),
        var(--rbe-bg);
}

.rbe-success.rbe-visible {
    display: flex;
}

.rbe-form-strip.rbe-submitted { display: none; }
.rbe-popup.rbe-done .rbe-hero { display: none; }

.rbe-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rbe-accent2), var(--rbe-accent));
    color: #fff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.25);
}

.rbe-success-heading {
    font-family: 'Sora', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--rbe-text);
    margin: 0 0 8px;
}

.rbe-success-msg {
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    color: var(--rbe-muted);
    margin: 0 0 24px;
    line-height: 1.6;
}

.rbe-success-close {
    padding: 11px 32px;
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 12px;
    background: rgba(124, 58, 237, 0.06);
    color: var(--rbe-text);
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: all 0.2s;
}

.rbe-success-close:hover {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}

/* ================================================================
   Mobile — bottom sheet
   ================================================================ */

@media (max-width: 480px) {
    .rbe-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .rbe-popup {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        animation: rbeSheetUp 0.35s ease-out;
    }

    @keyframes rbeSheetUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .rbe-form-strip {
        padding: 12px 16px 16px;
    }

    .rbe-form {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .rbe-form input {
        padding: 12px 14px;
        font-size: 13px;
    }

    .rbe-submit {
        padding: 14px;
        font-size: 13px;
    }
}

/* Very short screens */
@media (max-height: 600px) {
    .rbe-hero {
        flex: 3;
    }

    .rbe-form-strip {
        padding: 8px 14px 10px;
    }

    .rbe-form {
        gap: 5px;
    }

    .rbe-form input {
        padding: 9px 12px;
    }

    .rbe-submit {
        padding: 11px;
    }
}

/* ================================================================
   Reduced motion
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    .rbe-popup      { animation: none; }
    .rbe-submit::after { animation: none; }
    .rbe-spinner    { animation: none; }
    .rbe-overlay    { transition: none; }
}
