/* ============================================
   PARADIGMA Interactive Tour — Styles
   Hardcoded colors — no dependency on design-tokens.css.
   Works with both Admin (dark) and Business (light) themes.
   ============================================ */

/* === Overlay === */
/* z-index 10000+ to guarantee tour is above ALL Filament elements (dropdowns are z-999) */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002;
    pointer-events: auto;
}

/* Darkened backdrop with hole for highlighted element */
.tour-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1;
    transition: opacity 200ms ease;
}

/* === Highlight: class added directly to target element === */
/* box-shadow 4000px spread creates the dark overlay with a "hole" around the element.
   outline draws the blue ring. No coordinate calculations needed — always pixel-perfect. */
.tour-highlighted {
    position: relative !important;
    z-index: 10001 !important;
    overflow: visible !important;
    border-radius: 12px;
    outline: 3px solid #3b82f6;
    outline-offset: 4px;
    box-shadow:
        0 0 0 4000px rgba(0, 0, 0, 0.55),
        0 0 20px rgba(59, 130, 246, 0.3);
    transition: box-shadow 300ms ease, outline 300ms ease;
}

/* Page headings (h1) are block-level — collapse to text width so the blue
   frame hugs the text instead of stretching to full container width. */
h1.tour-highlighted {
    display: inline-block !important;
    width: fit-content !important;
    max-width: 100%;
}

/* Elements that are already fixed (e.g. bottom dock) — JS adds this modifier */
.tour-highlighted--fixed {
    position: fixed !important;
}

/* Elements that are sticky (e.g. .fi-header) — keep sticky during highlight */
.tour-highlighted--sticky {
    position: sticky !important;
}

/* === Tooltip === */
/* Positioned absolute inside .tour-overlay which is fixed; inset:0 (= full viewport).
   top/left 50% + translate(-50%,-50%) = always centered regardless of Filament layout. */
.tour-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10003;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 20px;
    max-width: 360px;
    min-width: 280px;
    width: 360px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    animation: tourFadeIn 300ms ease-out;
    pointer-events: auto;
}

@keyframes tourFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* === Tooltip content === */
.tour-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 8px;
    line-height: 1.2;
}

.tour-text {
    font-size: 0.875rem;
    color: #424245;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* === Progress bar === */
.tour-progress {
    height: 3px;
    background: #f0f0f2;
    border-radius: 9999px;
    margin-bottom: 16px;
    overflow: hidden;
}

.tour-progress-bar {
    height: 100%;
    background: #3b82f6;
    border-radius: 9999px;
    transition: width 300ms ease;
}

/* === Step counter === */
.tour-counter {
    font-size: 0.75rem;
    color: #aeaeb2;
    margin-bottom: 4px;
    font-weight: 500;
}

/* === Footer buttons === */
.tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tour-btn {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    border: none;
    outline: none;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tour-btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

.tour-btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.tour-btn-secondary {
    background: #f0f0f2;
    color: #6b7280;
}

.tour-btn-secondary:hover {
    background: #e5e7eb;
    color: #1d1d1f;
}

.tour-btn-skip {
    background: transparent;
    color: #aeaeb2;
    padding: 8px;
    font-size: 0.75rem;
}

.tour-btn-skip:hover {
    color: #6b7280;
}

/* === "?" Help button in topbar === */
.tour-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: #3b82f6;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 200ms ease;
    flex-shrink: 0;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.tour-trigger-btn:hover {
    background: #2563eb;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    transform: scale(1.05);
}

/* Admin dark theme overrides */
[data-theme="admin"] .tour-tooltip,
.dark .tour-tooltip {
    background: #1a1f2e;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="admin"] .tour-title,
.dark .tour-title {
    color: #e6edf3;
}

[data-theme="admin"] .tour-text,
.dark .tour-text {
    color: #9ca3af;
}

[data-theme="admin"] .tour-counter,
.dark .tour-counter {
    color: #6e7681;
}

[data-theme="admin"] .tour-progress,
.dark .tour-progress {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="admin"] .tour-btn-secondary,
.dark .tour-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #9ca3af;
}

[data-theme="admin"] .tour-btn-secondary:hover,
.dark .tour-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e6edf3;
}

[data-theme="admin"] .tour-btn-skip,
.dark .tour-btn-skip {
    color: #6e7681;
}

[data-theme="admin"] .tour-btn-skip:hover,
.dark .tour-btn-skip:hover {
    color: #9ca3af;
}

/* === Responsive === */
@media (max-width: 480px) {
    .tour-tooltip {
        width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px);
        min-width: 220px;
    }

    .tour-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .tour-title {
        font-size: 0.9rem;
    }

    .tour-footer {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* On mobile, make buttons full-width for easy tapping */
    .tour-btn-skip {
        order: 3;
        width: 100%;
        text-align: center;
    }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    .tour-tooltip {
        animation: none;
    }

    .tour-highlighted,
    .tour-progress-bar {
        transition: none;
    }
}
