/* ============================================================
   SFI Interactive Walkthrough / Guided Tour System
   ============================================================
   Modular, scalable, theme-aware (light + dark mode)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Overlay ─────────────────────────────────────────────── */
.wt-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
}

.wt-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ── Spotlight (the hole that reveals the target element) ── */
.wt-spotlight {
    position: fixed;
    z-index: 10001;
    border-radius: 12px;
    pointer-events: none;
    transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.55),
        0 0 30px 8px rgba(99, 102, 241, 0.35),
        0 0 60px 16px rgba(99, 102, 241, 0.15),
        inset 0 0 20px 4px rgba(99, 102, 241, 0.10);
    border: 2px solid rgba(99, 102, 241, 0.5);
}

.wt-spotlight::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 14px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    animation: wt-pulse-ring 2s ease-in-out infinite;
}

@keyframes wt-pulse-ring {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.04);
        opacity: 1;
    }
}

/* ── Tooltip ─────────────────────────────────────────────── */
.wt-tooltip {
    position: fixed;
    z-index: 10002;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.18),
        0 8px 24px rgba(0, 0, 0, 0.10),
        0 0 40px rgba(99, 102, 241, 0.08);
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
}

.wt-tooltip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Tooltip arrow */
.wt-tooltip-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.08);
    transform: rotate(45deg);
    z-index: -1;
}

/* Arrow positions */
.wt-tooltip[data-position="bottom"] .wt-tooltip-arrow {
    top: -9px;
    left: 50%;
    margin-left: -8px;
    border-bottom: none;
    border-right: none;
}

.wt-tooltip[data-position="top"] .wt-tooltip-arrow {
    bottom: -9px;
    left: 50%;
    margin-left: -8px;
    border-top: none;
    border-left: none;
}

.wt-tooltip[data-position="left"] .wt-tooltip-arrow {
    right: -9px;
    top: 50%;
    margin-top: -8px;
    border-left: none;
    border-bottom: none;
}

.wt-tooltip[data-position="right"] .wt-tooltip-arrow {
    left: -9px;
    top: 50%;
    margin-top: -8px;
    border-right: none;
    border-top: none;
}

/* ── Tooltip Header ──────────────────────────────────────── */
.wt-tooltip-header {
    padding: 20px 24px 12px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.wt-tooltip-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.wt-tooltip-icon i {
    font-size: 22px;
    color: white;
}

.wt-tooltip-header-text {
    flex: 1;
    min-width: 0;
}

.wt-tooltip-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.wt-tooltip-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    margin: 0;
}

/* ── Tooltip Body ────────────────────────────────────────── */
.wt-tooltip-body {
    padding: 0 24px 16px;
}

.wt-tooltip-description {
    font-size: 14px;
    font-weight: 400;
    color: #64748b;
    line-height: 1.65;
    margin: 0;
}

/* ── Progress Bar ────────────────────────────────────────── */
.wt-progress-container {
    padding: 0 24px 16px;
}

.wt-progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wt-progress-track {
    flex: 1;
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.wt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a78bfa);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.wt-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    width: 8px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.wt-progress-text {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
}

/* ── Step Dots ───────────────────────────────────────────── */
.wt-step-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 24px 16px;
}

.wt-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.wt-step-dot.active {
    width: 24px;
    border-radius: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.wt-step-dot.completed {
    background: rgba(99, 102, 241, 0.3);
}

/* ── Tooltip Footer ──────────────────────────────────────── */
.wt-tooltip-footer {
    padding: 12px 24px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.wt-btn:active {
    transform: scale(0.96);
}

.wt-btn-skip {
    background: transparent;
    color: #94a3b8;
    padding: 10px 14px;
}

.wt-btn-skip:hover {
    color: #64748b;
    background: rgba(0, 0, 0, 0.04);
}

.wt-btn-back {
    background: rgba(0, 0, 0, 0.05);
    color: #475569;
}

.wt-btn-back:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1e293b;
}

.wt-btn-next {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.wt-btn-next:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.wt-btn-next:active {
    transform: translateY(0) scale(0.96);
}

.wt-btn-finish {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.wt-btn-finish:hover {
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}

.wt-btn i {
    font-size: 16px;
}

.wt-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wt-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Welcome Modal ───────────────────────────────────────── */
.wt-welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.wt-welcome-modal.active {
    opacity: 1;
    visibility: visible;
}

.wt-welcome-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.wt-welcome-card {
    position: relative;
    width: 420px;
    max-width: calc(100vw - 32px);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    padding: 40px 32px;
    text-align: center;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.wt-welcome-modal.active .wt-welcome-card {
    transform: translateY(0) scale(1);
}

.wt-welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899, #f43f5e);
}

.wt-welcome-emoji {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
    animation: wt-bounce 2s ease-in-out infinite;
}

@keyframes wt-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.wt-welcome-title {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 8px;
    font-family: 'Inter', sans-serif;
}

.wt-welcome-subtitle {
    font-size: 15px;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 28px;
    font-family: 'Inter', sans-serif;
}

.wt-welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wt-welcome-start {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wt-welcome-start:hover {
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.wt-welcome-dismiss {
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    border-radius: 12px;
}

.wt-welcome-dismiss:hover {
    color: #64748b;
    background: rgba(0, 0, 0, 0.04);
}

/* ── Completion Modal ────────────────────────────────────── */
.wt-complete-card {
    position: relative;
    width: 420px;
    max-width: calc(100vw - 32px);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    padding: 40px 32px;
    text-align: center;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.wt-welcome-modal.active .wt-complete-card {
    transform: translateY(0) scale(1);
}

.wt-complete-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #059669, #06b6d4, #3b82f6);
}

.wt-confetti-burst {
    font-size: 56px;
    display: block;
    margin-bottom: 16px;
    animation: wt-celebrate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wt-celebrate {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.wt-complete-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 8px;
    font-family: 'Inter', sans-serif;
}

.wt-complete-subtitle {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 24px;
    font-family: 'Inter', sans-serif;
}

.wt-complete-close {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.35);
}

.wt-complete-close:hover {
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

/* ── Target element highlight state ──────────────────────── */
.wt-highlight {
    position: relative;
    z-index: 10001 !important;
    pointer-events: auto !important;
}

/* ── Floating restart button ─────────────────────────────── */
.wt-restart-btn {
    position: fixed;
    bottom: 90px;
    right: 30px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.wt-restart-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.wt-restart-btn:hover {
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.55);
    transform: scale(1.08);
}

.wt-restart-btn:active {
    transform: scale(0.95);
}

.wt-restart-tooltip {
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.wt-restart-btn:hover .wt-restart-tooltip {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   DARK MODE SUPPORT
   ============================================================ */
[data-theme="dark"] .wt-overlay {
    background: transparent;
}

[data-theme="dark"] .wt-spotlight {
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.7),
        0 0 40px 10px rgba(139, 92, 246, 0.35),
        0 0 80px 20px rgba(139, 92, 246, 0.15),
        inset 0 0 20px 4px rgba(139, 92, 246, 0.10);
    border-color: rgba(139, 92, 246, 0.5);
}

[data-theme="dark"] .wt-tooltip {
    background: rgba(30, 41, 59, 0.97);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(139, 92, 246, 0.1);
}

[data-theme="dark"] .wt-tooltip-arrow {
    background: rgba(30, 41, 59, 0.97);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .wt-tooltip-title {
    color: #f1f5f9;
}

[data-theme="dark"] .wt-tooltip-description {
    color: #94a3b8;
}

[data-theme="dark"] .wt-tooltip-step-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    color: #a78bfa;
}

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

[data-theme="dark"] .wt-progress-text {
    color: #64748b;
}

[data-theme="dark"] .wt-step-dot {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .wt-step-dot.completed {
    background: rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .wt-btn-skip {
    color: #64748b;
}

[data-theme="dark"] .wt-btn-skip:hover {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .wt-btn-back {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

[data-theme="dark"] .wt-btn-back:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
}

/* Welcome & Complete modals – dark */
[data-theme="dark"] .wt-welcome-card,
[data-theme="dark"] .wt-complete-card {
    background: rgba(30, 41, 59, 0.97);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .wt-welcome-title,
[data-theme="dark"] .wt-complete-title {
    color: #f1f5f9;
}

[data-theme="dark"] .wt-welcome-subtitle,
[data-theme="dark"] .wt-complete-subtitle {
    color: #94a3b8;
}

[data-theme="dark"] .wt-welcome-dismiss {
    color: #64748b;
}

[data-theme="dark"] .wt-welcome-dismiss:hover {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .wt-welcome-backdrop {
    background: rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .wt-restart-tooltip {
    background: #f1f5f9;
    color: #1e293b;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .wt-tooltip {
        width: calc(100vw - 24px);
        border-radius: 16px;
    }

    .wt-tooltip-header {
        padding: 16px 18px 10px;
    }

    .wt-tooltip-icon {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .wt-tooltip-icon i {
        font-size: 18px;
    }

    .wt-tooltip-title {
        font-size: 15px;
    }

    .wt-tooltip-body {
        padding: 0 18px 12px;
    }

    .wt-tooltip-description {
        font-size: 13px;
        line-height: 1.5;
    }

    .wt-tooltip-footer {
        padding: 12px 18px 16px;
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 12px;
    }

    .wt-footer-left, 
    .wt-footer-right {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }

    .wt-footer-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .wt-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 14px;
        font-size: 13px;
    }

    .wt-btn-skip {
        padding: 10px;
    }

    .wt-progress-container,
    .wt-step-dots {
        padding: 0 18px 12px;
    }

    .wt-welcome-card,
    .wt-complete-card {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .wt-welcome-emoji,
    .wt-confetti-burst {
        font-size: 48px;
    }

    .wt-welcome-title,
    .wt-complete-title {
        font-size: 20px;
    }

    .wt-welcome-subtitle,
    .wt-complete-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .wt-welcome-actions {
        gap: 8px;
    }

    .wt-restart-btn {
        bottom: 24px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

@media (max-width: 640px) {
    .wt-tooltip {
        width: calc(100vw - 32px);
    }
}

/* ── Mobile Menu Walkthrough Integration ─────────────────── */

/* When walkthrough targets items inside the mobile drawer,
   boost the drawer above the tour overlay so the spotlight
   and tooltip can highlight items correctly. */
.mobile-menu.wt-mobile-menu-elevated {
    z-index: 10001 !important;
}

/* The overlay behind the mobile drawer also needs to stay visible */
.wt-overlay.active ~ .mobile-menu-overlay.active {
    z-index: 9999;
}

/* On mobile, ensure the tooltip doesn't clash with the mobile menu */
@media (max-width: 1200px) {
    .wt-tooltip {
        max-width: calc(100vw - 24px);
        width: 320px;
    }

    .wt-tooltip-header {
        padding: 16px 18px 10px;
        gap: 10px;
    }

    .wt-tooltip-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .wt-tooltip-icon i {
        font-size: 18px;
    }

    .wt-tooltip-title {
        font-size: 15px;
    }

    .wt-tooltip-body {
        padding: 0 18px 12px;
    }

    .wt-tooltip-description {
        font-size: 13px;
    }

    .wt-progress-container,
    .wt-step-dots {
        padding: 0 18px 10px;
    }

    .wt-tooltip-footer {
        padding: 10px 18px 14px;
    }

    .wt-spotlight {
        border-radius: 8px;
    }

    .wt-restart-btn {
        bottom: 24px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* ── Keyboard focus styles ───────────────────────────────── */
.wt-btn:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.5);
    outline-offset: 2px;
}

.wt-welcome-start:focus-visible,
.wt-welcome-dismiss:focus-visible,
.wt-complete-close:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.5);
    outline-offset: 2px;
}
