/* Flash Deal pop-up (app/Views/partials/flash-deal-popup.php). Look ported from the approved stageshow mockup:
   the band carries the theme (base = the venue's brand colour), the highlight marks the discount, one hot colour is
   kept for scarcity only. All motion sits under prefers-reduced-motion: no-preference; the countdown counts either way. */

.fd {
    /* Base theme: the venue's brand colour. Public pages define --court-green (brandingThemeCSS), the player
       account --brand-ink (brandingChromeCSS); both come with the text colour that reads on them. */
    --fd-band: var(--court-green, var(--brand-ink, #0e3a2f));
    --fd-on: var(--court-green-on, var(--brand-ink-on, #fff));
    --fd-deep: color-mix(in srgb, var(--fd-band) 82%, #000);
    --fd-hi: var(--fd-on);
    --fd-hot: #c2410c;
    --fd-badge-bg: color-mix(in srgb, var(--fd-band) 13%, transparent);
    --fd-badge-ink: var(--fd-band);
    --fd-surface: #fff;
    --fd-ink: #14201b;
    --fd-text: #4f5c56;
    --fd-faint: #6b7670;
    --fd-line: #dfe5e2;
    --fd-sel: #eef2ef;
    --fd-hot-ink: color-mix(in srgb, var(--fd-hot) 85%, #000);
    --fd-hot-soft: color-mix(in srgb, var(--fd-hot) 9%, var(--fd-surface));
}
html[data-theme="dark"] .fd {
    /* the player account's lifted brand shade, as the public pages' dark --court-green */
    --fd-band: var(--court-green, var(--brand-ink-dark, var(--brand-ink, #0e3a2f)));
    --fd-on: var(--court-green-on, var(--brand-ink-dark-on, var(--brand-ink-on, #fff)));
    --fd-hot: #fb923c;
    --fd-badge-bg: color-mix(in srgb, var(--fd-band) 24%, transparent);
    --fd-badge-ink: color-mix(in srgb, var(--fd-band) 50%, #fff);
    --fd-surface: #171d1a;
    --fd-ink: #eef2ef;
    --fd-text: #b9c3be;
    --fd-faint: #96a19b;
    --fd-line: #2c3531;
    --fd-sel: rgb(255 255 255 / 0.07);
    --fd-hot-ink: color-mix(in srgb, var(--fd-hot) 55%, #fff);
    --fd-hot-soft: color-mix(in srgb, var(--fd-hot) 15%, var(--fd-surface));
}

/* ---- Container: a centred card, a bottom sheet on phones, inline in the venue's preview ---- */
dialog.fd {
    width: 100%;
    max-width: min(392px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    overflow: visible;
    background: transparent;
    color: var(--fd-ink);
}
dialog.fd::backdrop { background: rgb(10 22 17 / 0.55); }
html[data-fd-open] .social-proof-widget { display: none !important; }   /* never two pop-ups at once */
.fd--preview { max-width: 392px; color: var(--fd-ink); }

.fd-card {
    overflow: hidden auto;
    max-height: inherit;
    border-radius: 24px;
    background: var(--fd-surface);
    color: var(--fd-ink);
    font-family: inherit;
    letter-spacing: 0;
    text-align: left;
    box-shadow: 0 28px 56px -18px rgb(0 0 0 / 0.5);
}
.fd--preview .fd-card { box-shadow: 0 0 0 1px var(--fd-line); }
.fd-card:focus { outline: none; }   /* focus lands on the card when it opens, so the button starts without a focus ring */

.fd-body { display: grid; padding: 20px 22px 12px; }
.fd-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.fd-ico { flex: none; }

/* ---- The band ---- */
.fd-band { display: grid; padding: 18px 22px 20px; background: var(--fd-band); color: var(--fd-on); }
.fd-band__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fd-band--row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; }
.fd-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--fd-hi); font-size: 14px; font-weight: 700; line-height: 1.3; }
.fd-off { color: var(--fd-hi); font-size: 22px; font-weight: 800; line-height: 1; white-space: nowrap; }

/* ---- Theme graphics behind the band (partial's $fdDeco): faint shapes in the band's text colour, under the words ---- */
.fd-band { position: relative; isolation: isolate; overflow: hidden; }
.fd-deco { position: absolute; inset: 0; z-index: -1; pointer-events: none; color: var(--fd-on); }
.fd-deco > i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); opacity: var(--o); background: currentColor;
    -webkit-mask: var(--fd-shape) center / contain no-repeat; mask: var(--fd-shape) center / contain no-repeat; }
.fd-deco__bolt { --fd-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2 3 14h7l-1 8 10-12h-7z'/%3E%3C/svg%3E"); }
.fd-deco__flake { --fd-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 2v20M3.3 7l17.4 10M3.3 17 20.7 7M9.5 3.5 12 6l2.5-2.5M9.5 20.5 12 18l2.5 2.5'/%3E%3C/svg%3E"); }
.fd-deco__heart { --fd-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.5-9.3C1.2 8.6 3.3 5 6.8 5c2 0 3.6 1.1 5.2 3 1.6-1.9 3.2-3 5.2-3 3.5 0 5.6 3.6 4.3 6.7C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E"); }
.fd-deco__sun { --fd-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cpath stroke='black' stroke-width='1.6' stroke-linecap='round' d='M12 1.5v3M12 19.5v3M1.5 12h3M19.5 12h3M4.6 4.6l2.1 2.1M17.3 17.3l2.1 2.1M4.6 19.4l2.1-2.1M17.3 6.7l2.1-2.1'/%3E%3C/svg%3E"); }
.fd-deco__cloud { --fd-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14'%3E%3Cpath d='M6 14h12.5a4 4 0 0 0 .4-8A6.5 6.5 0 0 0 6.6 7.4 3.4 3.4 0 0 0 6 14z'/%3E%3C/svg%3E"); }
.fd-deco__bill { --fd-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14'%3E%3Cpath fill-rule='evenodd' d='M1.5 0h21A1.5 1.5 0 0 1 24 1.5v11a1.5 1.5 0 0 1-1.5 1.5h-21A1.5 1.5 0 0 1 0 12.5v-11A1.5 1.5 0 0 1 1.5 0zM12 3.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7z'/%3E%3C/svg%3E"); }
.fd-deco__coin { --fd-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 4a6 6 0 1 0 0 12 6 6 0 0 0 0-12z'/%3E%3C/svg%3E"); }
.fd-deco > .fd-deco__cloud, .fd-deco > .fd-deco__bill { height: calc(var(--s) * 0.58); }
.fd-deco > .fd-deco__streak { height: 2px; border-radius: 2px; -webkit-mask: none; mask: none; background: linear-gradient(90deg, transparent, currentColor 45%, transparent); }
.fd-band__ends { margin-top: 14px; color: color-mix(in srgb, var(--fd-on) 75%, transparent); font-size: 13px; font-weight: 600; }

.fd-clock { display: flex; gap: 8px; color: var(--fd-on); }
.fd-clock--lg { margin-top: 8px; }
.fd-clock__cell { display: grid; justify-items: stretch; gap: 4px; text-align: center; }
.fd-clock--lg .fd-clock__cell { flex: 1; }
.fd-clock--sm { gap: 4px; }
.fd-clock--sm .fd-clock__cell { display: flex; align-items: center; gap: 4px; }
.fd-clock__tile {
    display: grid;
    place-items: center;
    overflow: hidden;
    min-width: 64px;
    height: 58px;
    border-radius: 14px;
    background: var(--fd-deep);
    font-size: 32px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.fd-clock__tile > span { display: inline-block; position: relative; }
.fd-clock--sm .fd-clock__tile { min-width: 34px; height: 30px; border-radius: 8px; font-size: 16px; }
.fd-clock__label { color: color-mix(in srgb, var(--fd-on) 70%, transparent); font-size: 11px; font-weight: 600; }
.fd-clock__colon { color: color-mix(in srgb, var(--fd-on) 65%, transparent); font-weight: 700; }

/* ---- The offer ---- */
.fd-title { margin: 0; color: var(--fd-ink); font-size: 23px; font-weight: 700; line-height: 1.22; letter-spacing: -0.01em; text-wrap: balance; }
.fd-fact { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--fd-text); font-size: 14px; line-height: 1.35; }
.fd-fact .fd-ico { color: var(--fd-faint); }

.fd-price { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.fd-amounts { display: grid; gap: 4px; }
.fd-was-line { color: var(--fd-faint); font-size: 14px; line-height: 1.3; }
.fd-amount { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fd-peso { margin-right: 1px; font-size: 0.7em; }
.fd-from { font-size: 0.45em; font-weight: 600; letter-spacing: 0; }
.fd-was { color: var(--fd-faint); font-size: 15px; }
.fd-save {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    margin-left: auto;
    align-self: center;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--fd-badge-bg);
    color: var(--fd-badge-ink);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

/* Scarcity: shown only when it is true (viewers in the last 5 minutes, no other court free) */
.fd-fomo { display: grid; gap: 2px; margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--fd-hot-soft); }
.fd-fomo__t { font-size: 14px; font-weight: 700; line-height: 1.3; }
.fd-fomo__s { display: inline-flex; align-items: center; gap: 4px; color: var(--fd-hot-ink); font-size: 13px; font-weight: 700; line-height: 1.3; }

.fd-left { display: none; gap: 8px; margin-top: 14px; }
.fd-left__row { display: flex; justify-content: space-between; color: var(--fd-text); font-size: 13px; font-weight: 600; }
.fd-left__hot { color: var(--fd-hot-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.fd-bar { position: relative; height: 6px; overflow: hidden; border-radius: 3px; background: var(--fd-line); }
.fd-bar > span { position: relative; display: block; height: 100%; overflow: hidden; border-radius: 3px; background: var(--fd-hot); }

.fd-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 54px;
    margin-top: 16px;
    padding: 0 16px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: var(--fd-band);
    color: var(--fd-on);
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}
.fd-btn:hover { color: var(--fd-on); text-decoration: none; filter: brightness(1.06); }
.fd-btn:focus-visible, .fd-later:focus-visible { outline: 2px solid var(--fd-band); outline-offset: 3px; }
.fd-later { justify-self: center; margin: 0; padding: 12px 16px 6px; border: 0; background: none; color: var(--fd-text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }

/* ---- Picker (2+ offers) ---- */
.fd-list { display: grid; gap: 4px; margin-top: 12px; }
.fd-slot { position: relative; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; border-radius: 14px; cursor: pointer; }
.fd-slot:has(input:checked) { background: var(--fd-sel); }
.fd-slot:has(input:focus-visible) { outline: 2px solid var(--fd-band); outline-offset: 1px; }
.fd-radio { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--fd-line); color: transparent; }
.fd-slot:has(input:checked) .fd-radio { background: var(--fd-band); box-shadow: none; color: var(--fd-on); }
.fd-slot__text, .fd-slot__p { display: grid; gap: 2px; }
.fd-slot__p { justify-items: end; align-self: start; padding-top: 1px; }
.fd-slot__t { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; line-height: 1.3; }
.fd-slot__d { color: var(--fd-text); font-size: 13px; line-height: 1.3; }
.fd-slot__hot { display: inline-flex; align-items: center; gap: 4px; color: var(--fd-hot-ink); font-size: 12px; font-weight: 700; line-height: 1.3; }
.fd-chip { position: relative; overflow: hidden; isolation: isolate; padding: 2px 6px; border-radius: 6px; background: var(--fd-badge-bg); color: var(--fd-badge-ink); font-size: 11px; font-weight: 800; line-height: 1.3; }
.fd-slot__now { font-size: 16px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.fd-slot .fd-was { font-size: 13px; }

/* ---- One offer: card on desktop, sheet on phones ---- */
.fd-card .fd-band__row .fd-clock, .fd-tag__off { display: none; }
.fd-tag__off { white-space: nowrap; }
@media (max-width: 640px) {
    dialog.fd { max-width: 100%; max-height: 92dvh; margin: auto 0 0; }
    .fd-card { border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
    .fd--preview .fd-card { border-radius: 24px; }
    .fd:not(.fd--picker) .fd-band { padding: 16px 20px; }
    .fd:not(.fd--picker) .fd-band__row .fd-clock { display: flex; }
    .fd:not(.fd--picker) .fd-tag__off { display: inline; }
    .fd:not(.fd--picker) .fd-off, .fd:not(.fd--picker) .fd-band__big { display: none; }
    .fd:not(.fd--picker) .fd-left { display: grid; }
    .fd:not(.fd--picker) .fd-title { font-size: 20px; }
    .fd:not(.fd--picker) .fd-price { margin-top: 10px; }
    .fd:not(.fd--picker) .fd-amount { font-size: 34px; }
    .fd-body { padding: 18px 20px 14px; }
}
@media (max-width: 370px) {
    .fd-clock--lg .fd-clock__tile { min-width: 0; }
    .fd-band--row { padding: 12px 16px; }
    .fd-body { padding: 16px 16px 12px; }
}

/* ---- Motion ---- */
@property --fd-a {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}
@media (prefers-reduced-motion: no-preference) {
    dialog.fd[open] .fd-card { animation: fd-in 0.28s ease-out; }

    /* theme graphics: snow, bills and coins fall, hearts float up, clouds and speed streaks drift, the sun turns, bolts flicker */
    .fd-deco__flake, .fd-deco__bill, .fd-deco__coin { animation: fd-fall var(--d) linear var(--w) infinite; }
    .fd-deco__heart { animation: fd-rise var(--d) ease-in-out var(--w) infinite; }
    .fd-deco__cloud, .fd-deco__streak { animation: fd-drift var(--d) linear var(--w) infinite; }
    .fd-deco__sun { animation: fd-spin var(--d) linear infinite; }
    .fd-deco__bolt { animation: fd-zap var(--d) ease-in-out var(--w) infinite; }
    @media (max-width: 640px) { dialog.fd[open] .fd-card { animation: fd-up 0.32s ease-out; } }

    /* the countdown rolls top to bottom: the new number drops in from above, pushing the old one out below */
    .fd-clock__tile > .fd-roll { animation: fd-roll 0.4s cubic-bezier(0.2, 0.8, 0.3, 1); }
    .fd-clock__tile > .fd-roll::after { content: attr(data-prev); position: absolute; left: 0; right: 0; top: 1.5em; }

    /* the flame flickers */
    .fd .fd-ico--flame { transform-origin: 50% 90%; animation: fd-flicker 1.6s ease-in-out infinite; }

    /* the time bar drains smoothly, with a slow sheen */
    .fd-bar > span { transition: width 0.9s linear; }
    .fd-bar > span::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.55), transparent);
        transform: translateX(-100%);
        animation: fd-sheen 2.6s ease-in-out infinite;
    }

    /* a short light runs slowly round the button's border */
    .fd-btn {
        background:
            linear-gradient(var(--fd-band), var(--fd-band)) padding-box,
            conic-gradient(from var(--fd-a), var(--fd-band) 0 62%, var(--fd-hi) 78%, #fff 82%, var(--fd-hi) 86%, var(--fd-band) 100%) border-box;
        animation: fd-orbit 3.2s linear infinite;
    }
    /* in the pop-up players see, and on the admin Themes cards (not the approval/live previews): zoom in and wiggle, zoom out and wiggle, every 6 s */
    dialog.fd[open] .fd-btn,
    #themes .fd--preview .fd-btn { animation: fd-orbit 3.2s linear infinite, fd-wiggle 6s ease-in-out 1.2s infinite; }

    /* what you save catches a slow light */
    .fd-save::after, .fd-chip::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 0.6) 50%, transparent 70%);
        transform: translateX(-120%);
        animation: fd-badge-sheen 4.2s ease-in-out infinite;
    }
    .fd-chip::after { animation-delay: 0.6s; }
}
@keyframes fd-fall { from { top: -16%; transform: translateX(0) rotate(0deg); } to { top: 112%; transform: translateX(16px) rotate(220deg); } }
@keyframes fd-rise { 0% { top: 112%; transform: translateX(0) scale(0.85); } 50% { transform: translateX(10px) scale(1); } 100% { top: -16%; transform: translateX(-6px) scale(1.05); } }
@keyframes fd-drift { from { left: -30%; } to { left: 108%; } }
@keyframes fd-spin { to { transform: rotate(360deg); } }
@keyframes fd-zap { 0%, 100% { opacity: var(--o); transform: scale(1); } 45% { opacity: calc(var(--o) * 2.2); transform: scale(1.08); } 55% { opacity: calc(var(--o) * 0.6); } }

@keyframes fd-wiggle {
    0%, 22%, 100% { transform: none; }
    3% { transform: scale(1.07); }
    5% { transform: scale(1.07) rotate(-3deg); }
    7% { transform: scale(1.07) rotate(3deg); }
    9% { transform: scale(1.07) rotate(-2deg); }
    11% { transform: scale(1.07) rotate(0deg); }
    14% { transform: scale(1); }
    16% { transform: rotate(-2deg); }
    18% { transform: rotate(2deg); }
    20% { transform: rotate(-1deg); }
}
@keyframes fd-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fd-up { from { transform: translateY(100%); } }
@keyframes fd-roll { from { transform: translateY(-1.5em); } }
@keyframes fd-sheen { 0%, 35% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes fd-flicker {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    25% { transform: scale(1.12, 1.18) rotate(-4deg); opacity: 0.9; }
    50% { transform: scale(0.96, 1.04) rotate(3deg); opacity: 1; }
    75% { transform: scale(1.08, 1.12) rotate(-2deg); opacity: 0.85; }
}
@keyframes fd-orbit { to { --fd-a: 360deg; } }
@keyframes fd-badge-sheen { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }

/* Corner button on return visits (the pop-up shows once a day): opens /deals. Brand colour, works in dark mode. */
.fd-chip {
    position: fixed; z-index: 60; left: 16px; bottom: calc(var(--sp-bottom, 0px) + 16px);   /* above a page's own bottom bar */
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 999px;
    background: var(--court-green, var(--brand-ink, #0e3a2f)); color: #fff; font: 600 14px/1 system-ui, -apple-system, 'Segoe UI', sans-serif;
    text-decoration: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
/* The social-proof toast shares the bottom-left corner: while the button is on the page the toast sits above it (48px = button + gap). */
body:has(.fd-chip) .social-proof-widget { bottom: calc(var(--sp-bottom, 0px) + 48px); }
.fd-chip:hover { filter: brightness(1.1); }
.fd-chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
    .fd-chip { animation: fd-in 0.3s ease-out; }
    .fd--inline .fd-btn { animation: fd-orbit 3.2s linear infinite, fd-wiggle 6s ease-in-out 1.2s infinite; }
}
