/* ==========================================================================
   Interactive Cross-Page Workflow Tour & Animated Simulation Engine
   ========================================================================== */

:root {
    --hp-tour-primary: #4f46e5;
    --hp-tour-primary-glow: rgba(79, 70, 229, 0.4);
    --hp-tour-accent: #10b981;
    --hp-tour-warning: #f59e0b;
    --hp-tour-bg: #1e1b4b;
    --hp-tour-card-bg: rgba(255, 255, 255, 0.98);
    --hp-tour-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* --- Backdrop Overlay & Spotlight Cutout --- */
.hp-tour-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.20);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 99990;
    pointer-events: auto;
    transition: opacity 0.25s ease;
    opacity: 0;
}
.hp-tour-backdrop.active {
    opacity: 1;
}

/* Highlighted Target Spotlight Box */
.hp-tour-spotlight {
    position: absolute;
    z-index: 99992;
    border-radius: 10px;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.28),
                0 0 20px 4px var(--hp-tour-primary-glow),
                inset 0 0 0 2.5px var(--hp-tour-primary);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: hpTourPulse 2s infinite;
}

@keyframes hpTourPulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.28),
                    0 0 16px 3px var(--hp-tour-primary-glow),
                    inset 0 0 0 2.5px var(--hp-tour-primary);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.28),
                    0 0 28px 6px rgba(79, 70, 229, 0.55),
                    inset 0 0 0 3px #818cf8;
    }
}

/* Active Highlight Element */
.hp-tour-target-active {
    position: relative !important;
    z-index: 99994 !important;
    pointer-events: auto !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.45) !important;
    background-color: #ffffff !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* --- Floating Tooltip Card --- */
.hp-tour-card {
    position: absolute;
    z-index: 99995;
    width: 390px;
    max-width: calc(100vw - 32px);
    background: var(--hp-tour-card-bg);
    border-radius: 16px;
    box-shadow: var(--hp-tour-shadow);
    border: 1px solid rgba(226, 232, 240, 0.95);
    padding: 20px;
    font-family: inherit;
    transition: top 0.35s cubic-bezier(0.4, 0, 0.2, 1), left 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: auto;
}
.hp-tour-card.active {
    opacity: 1;
    transform: translateY(0);
}

.hp-tour-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hp-tour-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.hp-tour-step-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.hp-tour-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.hp-tour-close-btn:hover {
    color: #ef4444;
    background: #fee2e2;
}

.hp-tour-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.35;
}

.hp-tour-description {
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Progress bar inside tooltip */
.hp-tour-progress-bar-container {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}
.hp-tour-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #06b6d4);
    transition: width 0.3s ease;
}

/* Card Action Buttons */
.hp-tour-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.hp-tour-btn {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hp-tour-btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}
.hp-tour-btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.hp-tour-btn-demo {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}
.hp-tour-btn-demo:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.hp-tour-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}
.hp-tour-btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* --- Virtual Animated Pointer / Cursor --- */
.hp-tour-virtual-cursor {
    position: fixed;
    width: 28px;
    height: 28px;
    z-index: 99999;
    pointer-events: none;
    transition: top 0.6s cubic-bezier(0.25, 1, 0.5, 1), left 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
}
.hp-tour-virtual-cursor.active {
    opacity: 1;
}

.hp-tour-virtual-cursor svg {
    width: 100%;
    height: 100%;
    fill: #4f46e5;
    stroke: #ffffff;
    stroke-width: 1.5px;
}

.hp-tour-click-ripple {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #6366f1;
    background: rgba(99, 102, 241, 0.3);
    top: -6px;
    left: -6px;
    animation: hpRipple 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes hpRipple {
    0% {
        transform: scale(0.2);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* --- Persistent Floating Controller Pill --- */
.hp-tour-control-pill {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99996;
    background: #1e1b4b;
    color: #ffffff;
    border-radius: 999px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    font-size: 0.82rem;
    font-weight: 600;
    animation: hpPillPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes hpPillPop {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.hp-tour-control-pill .pill-title {
    color: #a5b4fc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hp-tour-control-pill button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.hp-tour-control-pill button:hover {
    background: rgba(255, 255, 255, 0.3);
}
.hp-tour-control-pill button.btn-exit {
    background: rgba(239, 68, 68, 0.8);
}
.hp-tour-control-pill button.btn-exit:hover {
    background: rgba(239, 68, 68, 1);
}

/* Typing simulation text effect */
.hp-tour-typing-preview {
    font-family: monospace;
    color: #4f46e5;
    background: #eef2ff;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px dashed #c7d2fe;
    display: inline-block;
    margin: 4px 0;
}

/* --- Interactive Test / Quiz Mode Feedback --- */
.hp-tour-test-box {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    transition: all 0.3s ease;
}
.hp-tour-test-box.passed {
    background: #f0fdf4;
    border-color: #22c55e;
    border-style: solid;
}
.hp-tour-test-box.failed {
    background: #fef2f2;
    border-color: #ef4444;
    border-style: solid;
}

.hp-tour-test-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 6px;
}
.hp-tour-test-status.pending {
    background: #fef3c7;
    color: #d97706;
}
.hp-tour-test-status.pass {
    background: #dcfce7;
    color: #15803d;
    animation: hpBadgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.hp-tour-test-status.not-pass {
    background: #fee2e2;
    color: #b91c1c;
    animation: hpBadgeShake 0.4s ease-in-out;
}

@keyframes hpBadgePop {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes hpBadgeShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.hp-tour-btn-test {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
}
.hp-tour-btn-test:hover {
    background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
    box-shadow: 0 6px 14px rgba(14, 165, 233, 0.4);
    transform: translateY(-1px);
}
