/**
 * FiresideSender Tooltip Tour System
 *
 * Usage:
 *   Tour.run({
 *     key: 'dashboard-tour',   // unique key — tour shown once per key per user
 *     steps: [
 *       {
 *         target: '#element-id',      // CSS selector for element to highlight
 *         title: 'Step Title',
 *         body: 'Explanation text.',
 *         placement: 'bottom',        // 'top' | 'bottom' | 'left' | 'right' | 'center'
 *         spotlightRadius: 8,         // px border-radius of spotlight hole
 *       },
 *     ]
 *   });
 *
 * Placement 'center' renders a modal card centered on screen (use for first/last step).
 */

/* ─── Overlay + Spotlight ─────────────────────────────────── */
.tour-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    animation: tour-fade-in 0.2s ease;
}

.tour-spotlight {
    position: fixed;
    z-index: 9999;
    border-radius: 8px;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.45),
        0 0 0 3px rgba(249, 115, 22, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    animation: tour-pulse 2s ease-in-out infinite;
}

/* ─── Tooltip Bubble ──────────────────────────────────────── */
.tour-tooltip {
    position: fixed;
    z-index: 10000;
    width: 300px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0,0,0,0.05);
    padding: 20px;
    animation: tour-card-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark .tour-tooltip {
    background: #1f2937;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.08);
}

.tour-tooltip::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 2px;
    transform: rotate(45deg);
}
html.dark .tour-tooltip::before {
    background: #1f2937;
}

.tour-tooltip.tour-placement-top::before    { bottom: -6px; left: 24px; }
.tour-tooltip.tour-placement-bottom::before { top: -6px;  left: 24px; }
.tour-tooltip.tour-placement-left::before   { right: -6px; top: 24px; }
.tour-tooltip.tour-placement-right::before  { left: -6px;  top: 24px; }

.tour-tooltip.tour-placement-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: calc(100vw - 32px);
}
.tour-tooltip.tour-placement-center::before { display: none; }

/* ─── Tooltip Content ─────────────────────────────────────── */
.tour-step-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.tour-step-pip {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.2s;
}
html.dark .tour-step-pip { background: #374151; }
.tour-step-pip.active {
    background: #f97316;
    width: 18px;
    border-radius: 3px;
}

.tour-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
    line-height: 1.3;
}
html.dark .tour-title { color: #f9fafb; }

.tour-body {
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;
    margin-bottom: 16px;
}
html.dark .tour-body { color: #9ca3af; }

/* ─── Tooltip Footer ──────────────────────────────────────── */
.tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}
html.dark .tour-footer { border-top-color: #374151; }

.tour-skip {
    font-size: 12px;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.tour-skip:hover { color: #6b7280; background: #f9fafb; }
html.dark .tour-skip:hover { color: #d1d5db; background: #374151; }

.tour-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.tour-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}
.tour-btn-secondary:hover { background: #e5e7eb; }
html.dark .tour-btn-secondary { background: #374151; color: #d1d5db; }
html.dark .tour-btn-secondary:hover { background: #4b5563; }

.tour-btn-primary {
    background: #f97316;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(249, 115, 22, 0.4);
}
.tour-btn-primary:hover { background: #ea580c; box-shadow: 0 2px 6px rgba(249, 115, 22, 0.5); }

/* ─── Animations ───────────────────────────────────────────── */
@keyframes tour-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes tour-card-in {
    from { opacity: 0; transform: scale(0.92) translateY(6px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}
@keyframes tour-pulse {
    0%, 100% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.45), 0 0 0 3px rgba(249,115,22,0.5); }
    50%       { box-shadow: 0 0 0 9999px rgba(0,0,0,0.45), 0 0 0 5px rgba(249,115,22,0.25); }
}

/* ─── Tour highlight pulse animation on element ───────────── */
.tour-target-highlight {
    position: relative;
    z-index: 10001;
    animation: tour-target-glow 1.5s ease-in-out infinite;
}
@keyframes tour-target-glow {
    0%, 100% { outline: 3px solid rgba(249, 115, 22, 0.7); outline-offset: 2px; }
    50%       { outline: 3px solid rgba(249, 115, 22, 0.3); outline-offset: 4px; }
}

/* ─── Dark mode spotlight adjustment ──────────────────────── */
html.dark .tour-spotlight {
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.7),
        0 0 0 3px rgba(249, 115, 22, 0.7);
}

/* ─── Tour active progress dot bar ────────────────────────── */
.tour-progress-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}
