/* ============================================================================
   Interactive Canvas Tutorial - Spotlight + Coach Mark System
   ============================================================================ */

/* Overlay: visual container only - pointer-events stay none so clicks reach real elements */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 28000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Spotlight cutout: positioned element with massive box-shadow to dim everything else */
.tutorial-spotlight {
    position: fixed;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(4, 8, 18, 0.52);
    pointer-events: none;
    transition: top 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                left 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 28001;
}

/* Pulsing ring around the spotlight */
.tutorial-spotlight::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 14px;
    border: 2px solid var(--accent, #6366f1);
    opacity: 0.7;
    animation: tutorial-spotlight-pulse 1.8s ease-in-out infinite;
}

@keyframes tutorial-spotlight-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.03); }
}

/* Coach tooltip card */
.tutorial-tooltip {
    position: fixed;
    z-index: 28003;
    width: 280px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-radius: 14px;
    padding: 18px 20px 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Tooltip arrow */
.tutorial-tooltip::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    transform: rotate(45deg);
    z-index: -1;
}

/* Arrow positions */
.tutorial-tooltip[data-position="below"]::before {
    top: -7px;
    left: 50%;
    margin-left: -6px;
    border-right: none;
    border-bottom: none;
}
.tutorial-tooltip[data-position="above"]::before {
    bottom: -7px;
    left: 50%;
    margin-left: -6px;
    border-left: none;
    border-top: none;
}
.tutorial-tooltip[data-position="right"]::before {
    left: -7px;
    top: 50%;
    margin-top: -6px;
    border-right: none;
    border-top: none;
}
.tutorial-tooltip[data-position="left"]::before {
    right: -7px;
    top: 50%;
    margin-top: -6px;
    border-left: none;
    border-bottom: none;
}

/* Tooltip content */
.tutorial-tooltip-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a2e);
    margin-bottom: 6px;
    line-height: 1.3;
}

.tutorial-tooltip-body {
    font-size: 0.82rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.45;
    margin-bottom: 12px;
}

/* Footer with step counter and skip */
.tutorial-tooltip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color, rgba(0,0,0,0.08));
    padding-top: 10px;
    margin-top: 2px;
}

.tutorial-step-counter {
    font-size: 0.72rem;
    color: var(--text-tertiary, #94a3b8);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tutorial-skip-btn {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.tutorial-skip-btn:hover {
    color: var(--text-primary, #1a1a2e);
    background: var(--bg-hover, rgba(0,0,0,0.05));
}

/* Final completion toast */
.tutorial-complete-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 28010;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-radius: 12px;
    padding: 14px 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary, #1a1a2e);
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}
.tutorial-complete-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Next / OK button in tooltip footer */
.tutorial-tooltip-footer-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tutorial-next-btn {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent, #6366f1);
    border: none;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 6px;
    transition: background 0.15s, transform 0.1s;
}
.tutorial-next-btn:hover {
    background: var(--accent-hover, #4f46e5);
}
.tutorial-next-btn:active {
    transform: scale(0.96);
}

/* Confetti canvas */
.tutorial-confetti {
    position: fixed;
    inset: 0;
    z-index: 28005;
    pointer-events: none;
}

/* Centered "canvas is yours" message card */
.tutorial-canvas-message {
    position: fixed;
    z-index: 28006;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: 340px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-radius: 18px;
    padding: 32px 28px 24px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.22), 0 4px 12px rgba(0,0,0,0.08);
    text-align: center;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.tutorial-canvas-message.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.tutorial-canvas-message-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a2e);
    margin-bottom: 8px;
    line-height: 1.3;
}

.tutorial-canvas-message-body {
    font-size: 0.88rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.5;
    margin-bottom: 20px;
}

.tutorial-canvas-message-btn {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent, #6366f1);
    border: none;
    cursor: pointer;
    padding: 8px 28px;
    border-radius: 10px;
    transition: background 0.15s, transform 0.1s;
}
.tutorial-canvas-message-btn:hover {
    background: var(--accent-hover, #4f46e5);
}
.tutorial-canvas-message-btn:active {
    transform: scale(0.96);
}

/* Dismiss animation */
.tutorial-overlay.dismissing {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .tutorial-spotlight,
    .tutorial-tooltip,
    .tutorial-complete-toast,
    .tutorial-canvas-message {
        transition-duration: 0.01ms !important;
    }
    .tutorial-spotlight::after {
        animation: none;
    }
    .tutorial-confetti {
        display: none;
    }
}
body.animations-disabled .tutorial-spotlight::after {
    animation: none;
}
