/*
 * Live demo — the Demo guide (templates/demo/_guide.html, static/js/demo/guide.js)
 * and the first-visit note (templates/demo/_first_visit_tooltip.html).
 * Loaded on demo dashboard pages only (dashboard/base.html, demo_live).
 * Scoped under .demo-guide / .demo-first-visit so nothing leaks to real tenants.
 *
 * Desktop: a floating pill bottom-right that opens a side panel on the right.
 * Phones (≤600px): the same pill, and the panel becomes a bottom sheet.
 * --demo-guide-lift (set by guide.js) pushes the pill above a page's own fixed
 * bottom bar (page editor save button, reservation page actions…).
 */

.demo-guide {
    --dg-ink: #0f172a;
    --dg-muted: #64748b;
    --dg-line: #e2e8f0;
    --dg-live: #f59e0b;
    --dg-accent: #B8742E;
    --dg-accent-ink: #8A5420;
    --dg-lift: var(--demo-guide-lift, 0px);
    --dg-bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--dg-lift));
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--dg-ink);
}

/* ── The pill ── */
.demo-guide__btn {
    position: fixed;
    right: 16px;
    bottom: var(--dg-bottom);
    z-index: 1150; /* above the sidebar (100) and the top bar, below modals (9999) */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--dg-ink);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transition: transform 0.15s ease, box-shadow 0.15s ease, bottom 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.demo-guide__btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.32); }
.demo-guide__btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.demo-guide__btn[aria-expanded="true"] { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2); }
.demo-guide__btn-count[hidden] { display: none !important; }
.demo-guide__btn-count {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.demo-guide--done .demo-guide__btn-count { background: #15803d; }
/* The first-visit note points at the pill: a soft ring around it meanwhile. */
.demo-guide__btn--hint { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28), 0 0 0 4px rgba(245, 158, 11, 0.35); }
body.pe-full-open .demo-guide__btn,
body.pe-full-open .demo-guide__exit { display: none; } /* the page editor's full-screen preview */

/* ── Computers: guide button in the middle of the top bar, Exit bottom-right ──
   guide.js adds html.demo-guide-top (and --dg-top-x / --dg-top-y) only from
   1024px wide AND when the gap between the top bar's left and right groups is
   big enough; otherwise everything stays as on phones. */
.demo-guide__exit { display: none; }
html.demo-guide-top .demo-guide__btn {
    top: var(--dg-top-y, 10px);
    bottom: auto;
    right: auto;
    left: var(--dg-top-x, 50%);
    transform: translateX(-50%);
    min-height: 40px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
}
html.demo-guide-top .demo-guide__btn:hover { transform: translateX(-50%) translateY(-1px); }
html.demo-guide-top .demo-guide__exit {
    position: fixed;
    right: 16px;
    bottom: var(--dg-bottom);
    z-index: 1150;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    /* Same dark pill as the Demo guide button (owner, 2026-10-11). */
    background: var(--dg-ink);
    color: #fff;
    border: 0;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transition: bottom 0.2s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
html.demo-guide-top .demo-guide__exit:visited { color: #fff; }
html.demo-guide-top .demo-guide__exit:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.32); color: #fff; }
html.demo-guide-top .demo-guide__exit:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* The LIVE DEMO dot (pill + panel chip) */
.demo-guide__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dg-live);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
    animation: demoGuideDot 2s ease-in-out infinite;
    flex: 0 0 auto;
}
@keyframes demoGuideDot {
    0%, 100% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.1); }
}

/* ── Backdrop + panel ── */
.demo-guide__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1290;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.demo-guide__backdrop[hidden] { display: none; }
.demo-guide--open .demo-guide__backdrop { opacity: 1; }

.demo-guide__panel {
    position: fixed;
    top: var(--dash-top, 0px);
    right: 0;
    bottom: 0;
    z-index: 1300;
    width: min(400px, 100vw);
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
    transform: translateX(24px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    overscroll-behavior: contain;
}
.demo-guide__panel[hidden] { display: none; }
.demo-guide--open .demo-guide__panel { transform: none; opacity: 1; }

.demo-guide__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 12px 20px;
    border-bottom: 1px solid var(--dg-line);
}
.demo-guide__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 7px;
    border: 1px solid #fcd9a4;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    white-space: nowrap;
}
.demo-guide__title { margin: 0; font-size: 16px; font-weight: 700; flex: 1 1 auto; }
.demo-guide__close {
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--dg-muted);
    cursor: pointer;
}
.demo-guide__close:hover { background: #f1f5f9; color: var(--dg-ink); }
.demo-guide__close:focus-visible { outline: 3px solid #93c5fd; outline-offset: -2px; }

.demo-guide__body { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px 20px; }
.demo-guide__intro, .demo-guide__copy-note { margin: 0 0 16px; color: #475569; font-size: 13.5px; }
.demo-guide__copy-note strong { display: block; color: var(--dg-ink); margin-bottom: 2px; }
/* Copy offer after a change was refused on the shared demo (guide.js offerCopy) */
.demo-guide__offer { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #fcd34d; border-radius: 12px; background: #fffbeb; color: #78350f; font-size: 13.5px; line-height: 1.5; }
.demo-guide__offer[hidden] { display: none; }
.demo-guide__offer strong { display: block; margin-bottom: 2px; color: #78350f; }
.demo-guide__action--pulse { animation: dgCopyPulse 1.2s ease-out 2; }
@keyframes dgCopyPulse { 0% { box-shadow: 0 0 0 0 rgba(43, 92, 255, 0.45); } 100% { box-shadow: 0 0 0 12px rgba(43, 92, 255, 0); } }
@media (prefers-reduced-motion: reduce) { .demo-guide__action--pulse { animation: none; } }

/* Things to try */
.demo-guide__try-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.demo-guide__try-head h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dg-muted); }
.demo-guide__progress { font-size: 12.5px; font-weight: 600; color: var(--dg-muted); font-variant-numeric: tabular-nums; }
.demo-guide--done .demo-guide__progress { color: #15803d; }
.demo-guide__list { list-style: none; margin: 0 0 14px; padding: 0; border: 1px solid var(--dg-line); border-radius: 12px; overflow: hidden; }
.demo-guide__item + .demo-guide__item { border-top: 1px solid var(--dg-line); }
.demo-guide__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 6px 12px;
    color: var(--dg-ink);
    text-decoration: none;
    font-weight: 500;
}
.demo-guide__link:hover { background: #f8fafc; text-decoration: none; }
.demo-guide__link:focus-visible { outline: 3px solid #93c5fd; outline-offset: -3px; }
.demo-guide__tick {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
    color: var(--dg-muted);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.demo-guide__tick-check { display: none; }
.demo-guide__item--tried .demo-guide__tick { background: #15803d; border-color: #15803d; color: #fff; }
.demo-guide__item--tried .demo-guide__tick-n { display: none; }
.demo-guide__item--tried .demo-guide__tick-check { display: block; }
.demo-guide__item--tried .demo-guide__label { color: var(--dg-muted); }
.demo-guide__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.demo-guide__done { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: #f0fdf4; color: #166534; font-size: 13.5px; }
.demo-guide__done[hidden] { display: none; }
.demo-guide__done strong { display: block; margin-bottom: 2px; }

/* Actions */
.demo-guide__actions { display: grid; gap: 8px; margin: 0 0 16px; }
.demo-guide__copy-form { margin: 0; display: grid; }
.demo-guide__action,
.demo-guide .demo-guest-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1.5px solid var(--dg-accent);
    border-radius: 10px;
    background: #fff;
    color: var(--dg-accent-ink);
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    white-space: normal;
    text-align: center;
    box-sizing: border-box;
}
.demo-guide .demo-guest-link { white-space: normal; }
.demo-guide .demo-guest-link span { display: inline; }
.demo-guide__action:hover, .demo-guide .demo-guest-link:hover { background: #FBF3EA; text-decoration: none; }
.demo-guide__action--primary { background: var(--dg-accent); border-color: var(--dg-accent); color: #fff; }
.demo-guide__action--primary:hover { background: #8E5720; border-color: #8E5720; color: #fff; }
.demo-guide__action--quiet { border-color: #cbd5e1; color: #475569; }
.demo-guide__action--quiet:hover { background: #f8fafc; }
.demo-guide__action:focus-visible, .demo-guide .demo-guest-link:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.demo-guide--done .demo-guide__action--primary { box-shadow: 0 0 0 4px rgba(184, 116, 46, 0.18); }

.demo-guide__notice { display: flex; align-items: flex-start; gap: 7px; margin: 0; color: var(--dg-muted); font-size: 12.5px; }
.demo-guide__notice svg { flex: 0 0 auto; margin-top: 2px; }

.demo-guide__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--dg-line);
    background: #f8fafc;
}
.demo-guide__foot-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 8px;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
}
.demo-guide__foot-link:hover { color: var(--dg-ink); background: #eef2f7; text-decoration: none; }
.demo-guide__foot-link:focus-visible { outline: 3px solid #93c5fd; outline-offset: -2px; }

/* ── Phones: bottom sheet ── */
@media (max-width: 600px) {
    .demo-guide__btn { right: 12px; padding: 0 14px 0 12px; font-size: 13.5px; }
    .demo-guide__panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 88vh;
        max-height: 88dvh;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.25);
        transform: translateY(24px);
    }
    .demo-guide__head { padding: 12px 10px 10px 16px; }
    .demo-guide__body { padding: 14px 16px 16px; }
    body.demo-guide-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .demo-guide__btn, .demo-guide__backdrop, .demo-guide__panel { transition: none !important; }
    .demo-guide__dot { animation: none; }
}

/* ── First-visit note (templates/demo/_first_visit_tooltip.html) ──
   One note, bottom-right, pointing at the Demo guide pill. */
.demo-first-visit {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--demo-guide-lift, 0px) + 56px);
    z-index: 1160;
    width: min(380px, calc(100vw - 32px));
    background: linear-gradient(135deg, #1A160D 0%, #2A2316 100%);
    color: #F4EFE4;
    padding: 20px 22px 18px;
    border-radius: 14px;
    box-shadow: 0 24px 72px rgba(21, 17, 10, 0.42), 0 2px 8px rgba(21, 17, 10, 0.2);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.24s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.demo-first-visit--in { opacity: 1; transform: none; }
/* Guide button in the top bar: the note hangs under it, arrow on top. */
html.demo-guide-top .demo-first-visit {
    top: calc(var(--dg-top-y, 10px) + 54px);
    bottom: auto;
    right: auto;
    left: clamp(16px, calc(var(--dg-top-x, 50%) - 190px), calc(100vw - 396px));
}
html.demo-guide-top .demo-first-visit__arrow {
    top: -7px;
    bottom: auto;
    right: auto;
    left: calc(var(--dg-top-x, 50%) - clamp(16px, calc(var(--dg-top-x, 50%) - 190px), calc(100vw - 396px)) - 7px);
    border-radius: 3px 0 0 0;
    background: #1A160D;
}
.demo-first-visit--out { opacity: 0; transform: translateY(6px); }
.demo-first-visit__arrow {
    position: absolute;
    bottom: -7px;
    right: 44px;
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    background: #2A2316;
    border-radius: 0 0 3px 0;
}
.demo-first-visit__close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #B9AC8F;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.demo-first-visit__close:hover { background: rgba(255, 255, 255, 0.08); color: #F4EFE4; }
.demo-first-visit__icon { font-size: 22px; margin-bottom: 6px; }
.demo-first-visit h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: #F4EFE4; letter-spacing: -0.01em; padding-right: 24px; }
.demo-first-visit p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.5; color: #D9CDB0; }
.demo-first-visit p[hidden] { display: none; }
.demo-first-visit__list { margin: 4px 0 10px; padding-left: 18px; color: #D9CDB0; font-size: 13.5px; }
.demo-first-visit__list li { margin: 4px 0; }
.demo-first-visit__list a { color: #F4C27A; text-decoration: underline; text-underline-offset: 2px; }
.demo-first-visit__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-first-visit__got-it,
.demo-first-visit__open {
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
}
.demo-first-visit__got-it { background: #E9A860; color: #15110A; }
.demo-first-visit__got-it:hover { background: #F3B870; }
.demo-first-visit__open { background: rgba(255, 255, 255, 0.1); color: #F4EFE4; }
.demo-first-visit__open:hover { background: rgba(255, 255, 255, 0.16); }
.demo-first-visit__got-it:focus-visible, .demo-first-visit__open:focus-visible, .demo-first-visit__close:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
@media (max-width: 600px) {
    .demo-first-visit { right: 12px; padding: 18px 18px 16px; }
    .demo-first-visit__arrow { right: 40px; }
}
@media (prefers-reduced-motion: reduce) {
    .demo-first-visit { transition: none !important; }
}
