/* ══════════════════════════════════════════════════════════════
   Rebook.ae — Celebration Experience Layer
   celebration.css  |  Isolated from all other styles
══════════════════════════════════════════════════════════════ */

/* ── Body state ─────────────────────────────────────────────── */
body.is-celebrating {
    overflow: hidden;
}

body.is-celebrating #mainContent,
body.is-celebrating .main-app,
body.is-celebrating .rb-navbar,
body.is-celebrating footer {
    filter: blur(8px) brightness(0.35);
    transition: filter 0.5s ease;
    pointer-events: none;
    user-select: none;
}

/* ── Full-screen overlay ─────────────────────────────────────── */
#celebrationOverlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    overflow: hidden;
}

#celebrationOverlay.cel-visible {
    opacity: 1;
    pointer-events: all;
}

#celebrationOverlay.cel-exiting {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

/* ── Canvas for particle animations ─────────────────────────── */
#celebrationCanvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* ── Lanterns (CSS-only animation) ──────────────────────────── */
.cel-lantern {
    position: absolute;
    width: 22px;
    height: 32px;
    border-radius: 50% 50% 40% 40%;
    z-index: 2;
    animation: lanternFloat 6s ease-in-out infinite;
    opacity: 0.85;
}

@keyframes lanternFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%       { transform: translateY(-45px) rotate(5deg); }
}

/* ── Main content wrapper ────────────────────────────────────── */
.cel-content {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 2rem 1.5rem;
    max-width: 560px;
    width: 100%;
    animation: celContentIn 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s both;
}

@keyframes celContentIn {
    from { transform: translateY(30px) scale(0.9); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Hero (emoji / logo) ─────────────────────────────────────── */
.cel-hero {
    font-size: 5.5rem;
    display: block;
    margin-bottom: 1rem;
    animation: celHeroBounce 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.5s both;
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.35));
    line-height: 1;
}

@keyframes celHeroBounce {
    from { transform: scale(0) rotate(-15deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

/* ── Title & Subtitle ────────────────────────────────────────── */
.cel-title {
    font-size: 2.3rem;
    font-weight: 900;
    margin: 0 0 0.75rem;
    line-height: 1.25;
    text-shadow: 0 3px 14px rgba(0,0,0,0.3);
    animation: celFadeUp 0.5s ease 0.7s both;
}

.cel-subtitle {
    font-size: 1.1rem;
    opacity: 0.88;
    line-height: 1.65;
    margin-bottom: 1.5rem;
    animation: celFadeUp 0.5s ease 0.85s both;
}

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

/* ── Skip button ─────────────────────────────────────────────── */
#celSkipBtn {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10006;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.3);
    color: inherit;
    border-radius: 50px;
    padding: 0.5rem 1.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    animation: celFadeUp 0.5s ease 1.2s both;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#celSkipBtn:hover {
    background: rgba(255,255,255,0.28);
    transform: translateX(-50%) scale(1.04);
}

/* ── Progress bar ────────────────────────────────────────────── */
#celProgressBar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 0;
    background: rgba(255,255,255,0.55);
    z-index: 10006;
    border-radius: 0;
    transition: width 0.05s linear;
}

/* ── Reward toast — true viewport center ─────────────────────── */
#celRewardToast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -44%) scale(0.92);
    z-index: 10002;
    background: #ffffff;
    color: #1a1a2e;
    border-radius: 20px;
    padding: 1.6rem 2rem 1.8rem;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.04);
    width: min(420px, calc(100vw - 2rem));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.38s ease,
                transform 0.42s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#celRewardToast.cel-toast-visible {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.cel-toast-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 0.4rem;
}

.cel-toast-label {
    font-size: 0.82rem;
    opacity: 0.6;
    margin-bottom: 0.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cel-toast-code {
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #4ea03c;
    margin-bottom: 0.85rem;
    font-family: 'Courier New', monospace;
}

.cel-toast-msg {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.85rem;
    color: #1a1a2e;
}

.cel-toast-copy {
    background: #4ea03c;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.45rem 1.4rem;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.cel-toast-copy:hover { background: #3d8a30; }

.cel-toast-close {
    position: absolute;
    top: 0.6rem;
    inset-inline-end: 0.6rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.4;
    line-height: 1;
    padding: 0;
}

.cel-toast-close:hover { opacity: 0.75; }

/* ── Reward toast image ───────────────────────────────────── */
.cel-toast-img {
    display: block;
    margin: 0.55rem auto 0.75rem;
    max-width: 190px;
    max-height: 110px;
    width: 100%;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.13);
}

/* ── Reward CTA button ────────────────────────────────────── */
.cel-toast-cta {
    display: inline-block;
    margin-top: 0.8rem;
    background: linear-gradient(135deg, #4ea03c 0%, #3d8a30 100%);
    color: #fff !important;
    border: none;
    border-radius: 10px;
    padding: 0.52rem 1.55rem;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(78,160,60,0.35);
    letter-spacing: 0.01em;
}

.cel-toast-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(78,160,60,0.45);
}

/* ── AppBar (Celebration) ────────────────────────────────────── */
#celAppBar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* above Bootstrap fixed navbar (1030) and all other UI layers */
    z-index: 1500;
    height: 44px;
    max-height: 44px;
    overflow: hidden;           /* never grow taller than 44px */
    display: flex;
    align-items: center;
    transform: translateY(-110%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.4s ease;
    will-change: transform;
}

#celAppBar.cel-appbar-visible {
    transform: translateY(0);
    opacity: 1;
}

#celAppBar.cel-appbar-hidden {
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
}

.cel-appbar__inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    height: 44px;
    padding: 0 2.8rem 0 0.85rem;   /* right room for close btn */
    position: relative;
    overflow: hidden;              /* single row, never wrap */
}

.cel-appbar__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
}

.cel-appbar__text {
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.cel-appbar__marquee {
    display: flex;              /* two spans side by side for seamless loop */
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

/* Each span = one "tile" of the infinite ticker.
   padding-inline-end is the visual gap between repetitions AND is
   included in translateX(-100%) so the loop is perfectly seamless. */
.cel-appbar__marquee span {
    display: block;
    flex-shrink: 0;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.88rem;
    padding-inline-end: 4rem;
    animation: celMarqueeLtr 32s linear infinite;
    will-change: transform;
}

/* RTL: text scrolls rightward */
[dir="rtl"] .cel-appbar__marquee span,
html[lang="ar"] .cel-appbar__marquee span {
    animation: celMarqueeRtl 32s linear infinite;
}

@keyframes celMarqueeLtr {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }   /* -own-width (text + padding) */
}

@keyframes celMarqueeRtl {
    0%   { transform: translateX(0); }
    100% { transform: translateX(100%); }    /* +own-width for rightward flow */
}

#celAppBar.cel-appbar--pulse .cel-appbar__text,
#celAppBar.cel-appbar--pulse .cel-appbar__marquee span {
    animation: celPulse 2.8s ease-in-out infinite;
}

@keyframes celPulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: 0.8; transform: scale(1.015); }
}

.cel-appbar__close {
    position: absolute;
    inset-inline-end: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    font-size: 0.72rem;
    transition: background 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.cel-appbar__close:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-50%) scale(1.1);
}

/* ── Static text: centered when animation ≠ marquee ──────────── */
#celAppBar:not(.cel-appbar--marquee) .cel-appbar__inner {
    justify-content: center;
}

#celAppBar:not(.cel-appbar--marquee) .cel-appbar__text {
    flex: unset;
    text-align: center;
    line-height: 3;
    overflow: visible;
    text-overflow: clip;
}

/* Push the fixed navbar DOWN when AppBar is visible */
body.has-cel-appbar .fixed-top,
body.has-cel-appbar .rb-navbar,
body.has-cel-appbar nav.rb-navbar {
    top: 44px !important;
    transition: top 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 575px) {
    .cel-title   { font-size: 1.75rem; }
    .cel-hero    { font-size: 3.8rem; }
    .cel-content { padding: 1.5rem 1rem; }

    /* AppBar: tighter on mobile but still single row */
    #celAppBar {
        height: 40px;
        max-height: 40px;
    }
    .cel-appbar__inner {
        height: 40px;
        padding: 0 2.4rem 0 0.65rem;
    }
    .cel-appbar__marquee span {
        font-size: 0.82rem;
    }

    /* Reward toast: a bit more padding room on small screens */
    #celRewardToast {
        padding: 1.4rem 1.5rem 1.6rem;
        border-radius: 16px;
    }

    /* Push navbar down by exact AppBar height on mobile */
    body.has-cel-appbar .fixed-top,
    body.has-cel-appbar .rb-navbar,
    body.has-cel-appbar nav.rb-navbar {
        top: 40px !important;
    }
}
