/* ============================================================
   theme.css — Shared Design System for Goodies by Qlubase
   Used by: openhouseraffle, prizewheel, superbowlsquares, pdfcombi
   ============================================================ */

/* ── Google Font ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;600;700;800&display=swap');

/* ── Design Tokens ── */
:root {
    /* --sky, --sky-hover, --sky-dim, --sky-glow* are injected by apply-theme.js
       with the user-chosen color. DO NOT define them here — static values
       would override the JS setProperty calls and break theme color sync. */
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --radius: 24px;
    --radius-sm: 12px;
    --radius-lg: 24px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --winner-text: #000000;
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.1);
    --danger-border: rgba(239, 68, 68, 0.3);
    --gold-bg: rgba(251, 191, 36, 0.1);
    --gold-text: #d97706;
    --gold-border: #fbbf24;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --border-strong: #475569;
    /* --sky-dim handled by apply-theme.js with dark-mode alpha (0x59 suffix) */
    --winner-text: #ffffff;
    --danger: #f87171;
    --danger-dim: rgba(248, 113, 113, 0.15);
    --danger-border: rgba(248, 113, 113, 0.3);
    --gold-bg: rgba(251, 191, 36, 0.15);
    --gold-text: #fcd34d;
    --gold-border: #f59e0b;
}

/* ── Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
}

/* ── Theme Toggle Switch ── */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--sky);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* ── Buttons ── */
.btn-main,
.btn-primary {
    background: var(--sky);
    color: white;
    border: none;
    padding: 18px 32px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: inherit;
    box-shadow: var(--sky-glow);
    margin-top: 12px;
}

.btn-main:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--sky-hover);
    box-shadow: var(--sky-glow);
}

.btn-main:active,
.btn-primary:active {
    transform: translateY(0);
}

.btn-main:disabled,
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Wide CTA variant — for modal/overlay primary actions */
.btn-main--wide {
    width: auto;
    padding: 14px 48px;
}

/* Compact ghost — for tight toolbar/inline actions */
.btn-ghost--sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Ghost outline — sky tint (e.g. Export CSV) */
.btn-export {
    background: transparent;
    border: 1px solid var(--sky-dim);
    color: var(--sky);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    width: 100%;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-export:hover {
    border-color: var(--sky);
    background: var(--sky-dim);
}

/* Ghost outline — danger/red tint (e.g. Clear All) */
.btn-clear {
    background: transparent;
    border: 1px solid var(--danger-border);
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    width: 100%;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-clear:hover {
    background: var(--danger-dim);
    border-color: var(--danger);
}

/* Ghost outline — neutral (e.g. Add More, Back) */
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-ghost:hover {
    background: var(--sky-dim);
    color: var(--sky);
    border-color: var(--sky);
}

/* Danger filled (e.g. Remove Selected) */
.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid var(--danger-border);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

/* ── ATTN! Badge ── */
#attn-badge {
    cursor: pointer;
    background: var(--sky);
    color: white;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 99px;
    box-shadow: 0 0 0 3px var(--surface), var(--sky-glow);
    animation: attn-dance 1.6s ease-in-out infinite;
    user-select: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#attn-badge.danced {
    animation: none;
    transform: none;
}

@keyframes attn-dance {

    0%,
    100% {
        transform: rotate(-4deg) scale(1);
    }

    25% {
        transform: translateY(-3px) rotate(3deg) scale(1.08);
    }

    50% {
        transform: rotate(-2deg) scale(1.03);
    }

    75% {
        transform: translateY(3px) rotate(4deg) scale(1.08);
    }
}

/* ── ATTN! Overlay ── */
#attn-overlay {
    position: fixed;
    inset: 0;
    width: 100%;       /* escape body > * { max-width } constraints */
    max-width: none;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

#attn-overlay.open {
    display: flex;
}

#attn-overlay-inner {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px 40px 40px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    width: 90%;
    max-width: 560px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.attn-close-btn {
    margin-top: 8px;
    align-self: stretch;
    background: var(--sky);
    color: white;
    border: none;
    padding: 18px 32px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--sky-glow);
}

.attn-close-btn:hover {
    transform: translateY(-2px);
    background: var(--sky-hover);
    box-shadow: var(--sky-glow);
}

/* ── Buy me a Coffee button (inside attn-overlay) ── */
.attn-coffee-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--sky-dim);
    color: var(--sky);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: auto;
    flex-shrink: 0;
}

.attn-coffee-btn:hover {
    border-color: var(--sky);
    background: var(--sky-dim);
}

/* ── Credit Cards ── */
.credit-cards {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.credit-card {
    flex: 1;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.credit-card:hover {
    border-color: var(--sky);
    box-shadow: var(--sky-glow);
    transform: translateY(-2px);
}

.credit-card-image {
    width: 100%;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
    object-position: center top;
    display: block;
    background: var(--bg);
}

.credit-card-image.logo-img {
    object-fit: scale-down;
    object-position: center;
    background: #f8fafc;
}

.credit-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-top: 1px solid var(--border);
}

.credit-card-eyebrow {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.credit-card-name {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text);
}

.credit-card-desc {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.4;
    margin-top: 2px;
}

.credit-card-url {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--sky);
    margin-top: 4px;
}

/* ── Buy Me a Coffee (btn-tip) ── */
.btn-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--sky);
    color: white;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
    overflow: hidden;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.btn-tip:hover {
    width: 160px;
}

.btn-tip-label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.875rem;
    transition: max-width 0.25s, opacity 0.2s;
    order: -1;
}

.btn-tip:hover .btn-tip-label {
    max-width: 120px;
    opacity: 1;
}

/* ── Shared Close Button for Toasts / Modals ── */
.btn-close-toast {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.2rem;
    font-weight: 800;
    transition: all 0.2s;
    z-index: 10;
}

.btn-close-toast:hover {
    background: var(--sky-dim);
    color: var(--sky);
    border-color: var(--sky);
}

/* ── Breathe Animation ── */
@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px var(--sky)) drop-shadow(0 0 20px var(--sky-dim));
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 25px var(--sky)) drop-shadow(0 0 50px var(--sky));
    }
}
/* ── Mobile Block Overlay (shown at ≤767px on non-mobile apps) ── */
.suite-mobile-block {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 99999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 32px;
    gap: 20px;
}
.suite-mobile-block svg { width: 64px; height: 64px; color: var(--sky); flex-shrink: 0; }
.suite-mobile-block h2 { font-size: 1.5rem; font-weight: 800; margin: 0; color: var(--text); letter-spacing: -0.5px; }
.suite-mobile-block p { color: var(--muted); font-weight: 600; font-size: 0.95rem; line-height: 1.6; margin: 0; max-width: 300px; }
.suite-mobile-block a {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}
.suite-mobile-block .btn-main {
    font-size: 1rem !important;
    padding: 18px 32px !important;
}
@media (max-width: 767px) {
    .suite-mobile-block { display: flex; }
    .suite-desktop-only { display: none !important; }
}

/* ── Winner Modal — shared between prizewheel and openhouseraffle ── */
#overlay,
#final-podium {
    position: fixed;
    inset: 0;
    width: 100%;       /* escape body > * { max-width } constraints */
    max-width: none;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#overlay.active,
#final-podium.active {
    display: flex;
}

.winner-modal {
    background: var(--surface);
    color: var(--text);
    padding: 48px 40px 40px;
    border-radius: var(--radius);
    text-align: center;
    transform: scale(0.88);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    opacity: 0;
    width: 95%;
    max-width: 520px;
    position: relative;
    border: 1px solid var(--border);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.5);
}

#overlay.active .winner-modal,
#final-podium.active .winner-modal {
    transform: scale(1);
    opacity: 1;
}

.winner-rank {
    font-size: 1.4rem;
    text-transform: uppercase;
    color: var(--sky);
    letter-spacing: 0.15em;
    font-weight: 900;
    animation: breathe 2s ease-in-out infinite;
    margin: 0 0 8px;
}

.winner-name {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    color: var(--winner-text);
    margin: 16px 0 32px;
    letter-spacing: -1px;
    line-height: 1.1;
    word-break: break-word;
}

.summary-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--sky);
    animation: breathe 2s ease-in-out infinite;
    margin: 0 0 24px;
    letter-spacing: -0.5px;
}

.podium-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    margin: 8px 0;
    border-radius: var(--radius-sm);
    font-weight: 700;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.podium-item .podium-rank {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.podium-item.gold {
    border-color: var(--gold-border);
    color: var(--gold-text);
    background: var(--gold-bg);
}

.podium-item.gold .podium-rank { color: var(--gold-text); opacity: 0.8; }

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn-main {
    flex: 1;
    padding: 16px 0;
    font-size: 0.85rem;
}

.btn-modal-secondary {
    background: var(--muted) !important;
}

/* ── Confetti ── */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 2000;
    pointer-events: none;
}

@keyframes firework-burst {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--tr)) scale(0);
        opacity: 0;
    }
}

/* ── Hub Return Tab — floating "back to hub" tab, docked to left edge ── */
.hub-return-tab {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%) translateX(calc(-100% + 12px));
    z-index: 9999;
    width: auto !important;
    min-height: 100px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 28px 22px 28px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-left: none;
    border-radius: 0 24px 24px 0;
    box-shadow: 5px 0 24px rgba(0,0,0,0.14);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1),
                color 0.18s ease,
                border-color 0.18s ease,
                box-shadow 0.18s ease;
    white-space: nowrap;
}

/* Invisible hover-detection slab extending right of the visible sliver */
.hub-return-tab::before {
    content: '';
    position: absolute;
    top: -20px;
    bottom: -20px;
    left: 0;
    right: -24px;
}

/* Sliver state — already set by default transform above */
.hub-return-tab:not(:hover) {
    transform: translateY(-50%) translateX(calc(-100% + 12px));
}

/* Sky accent line on the right edge — the visible 8px sliver */
.hub-return-tab::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 70px;
    background: var(--sky);
    border-radius: 0 6px 6px 0;
    transition: opacity 0.2s;
}

/* Full reveal on hover — slides right */
.hub-return-tab:hover {
    transform: translateY(-50%) translateX(0);
    color: var(--sky);
    border-color: var(--sky);
    box-shadow: 4px 0 28px rgba(0,0,0,0.16), var(--sky-glow);
}

.hub-return-tab svg {
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.hub-return-tab:hover svg {
    transform: translateX(-3px);
}

[data-theme="dark"] .hub-return-tab {
    box-shadow: 4px 0 20px rgba(0,0,0,0.35);
}
