/**
 * Interactive Tutorial System CSS
 * Comprehensive styling for tutorial overlay, spotlight, tooltips, and animations
 * Supports light/dark themes
 */

/* ==========================================
   1. TUTORIAL OVERLAY
   ========================================== */

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.tutorial-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ==========================================
   2. SPOTLIGHT EFFECT
   ========================================== */

.tutorial-spotlight {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75),
                0 0 50px 15px rgba(59, 130, 246, 0.8),
                inset 0 0 0 3px rgba(59, 130, 246, 0.9);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 9999;
    animation: spotlight-pulse 2s ease-in-out infinite;
    background: transparent;
}

.tutorial-spotlight.circle {
    border-radius: 50%;
}

/* ==========================================
   3. ANIMATED CURSOR
   ========================================== */

.tutorial-cursor {
    position: fixed;
    width: 32px;
    height: 32px;
    pointer-events: none;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.tutorial-cursor::before {
    content: '👆';
    font-size: 32px;
    display: block;
    animation: cursor-pulse 1.5s ease-in-out infinite;
}

.tutorial-cursor.clicking {
    animation: cursor-click 0.3s ease-in-out;
}

.tutorial-cursor.custom-icon::before {
    content: '';
    width: 32px;
    height: 32px;
    display: block;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z"/></svg>') no-repeat center;
    background-size: contain;
}

/* ==========================================
   4. TOOLTIP/CARD
   ========================================== */

.tutorial-tooltip {
    position: fixed;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2),
                0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    padding: 20px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.tutorial-tooltip.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
    animation: fade-in 0.4s ease-out;
}

/* Tooltip Arrow */
.tutorial-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

/* Arrow positions */
.tutorial-tooltip.arrow-top::before {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent #ffffff transparent;
}

.tutorial-tooltip.arrow-bottom::before {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-color: #ffffff transparent transparent transparent;
}

.tutorial-tooltip.arrow-left::before {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-color: transparent #ffffff transparent transparent;
}

.tutorial-tooltip.arrow-right::before {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent #ffffff;
}

.tutorial-tooltip.arrow-center {
    /* No arrow for center position */
}

.tutorial-tooltip.arrow-center::before {
    display: none;
}

/* ==========================================
   5. TOOLTIP COMPONENTS
   ========================================== */

.tutorial-tooltip-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.tutorial-tooltip-description {
    font-size: 1em;
    line-height: 1.5;
    color: #4a4a4a;
    margin: 0 0 16px 0;
}

.tutorial-tooltip-description p {
    margin: 0 0 8px 0;
}

.tutorial-tooltip-description p:last-child {
    margin-bottom: 0;
}

.tutorial-tooltip-description code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.tutorial-tooltip-footer {
    margin-top: 16px;
    border-top: 1px solid #e5e5e5;
    padding-top: 16px;
}

/* ==========================================
   6. STEP COUNTER & PROGRESS
   ========================================== */

.tutorial-step-counter {
    font-size: 0.85em;
    color: #888888;
    margin-bottom: 8px;
    font-weight: 500;
    text-align: center;
}

.tutorial-progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 16px;
}

.tutorial-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 100%);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tutorial-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shimmer 2s infinite;
}

/* ==========================================
   7. BUTTONS
   ========================================== */

.tutorial-buttons {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.tutorial-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.tutorial-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.tutorial-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button (Next) */
.tutorial-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.tutorial-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.tutorial-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

/* Secondary Button (Previous) */
.tutorial-btn-secondary {
    background: #ffffff;
    color: #4a4a4a;
    border: 2px solid #d1d5db;
}

.tutorial-btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.tutorial-btn-secondary:active:not(:disabled) {
    transform: translateY(0);
    background: #f3f4f6;
}

/* Skip Button */
.tutorial-btn-skip {
    position: absolute;
    top: 12px;
    right: 40px;
    padding: 6px 12px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-btn-skip:hover {
    background: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
}

.tutorial-btn-skip:active {
    transform: translateY(0);
}

/* Close Button (X) */
.tutorial-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #888888;
    font-size: 1.2em;
    line-height: 1;
    transition: all 0.2s ease;
}

.tutorial-close::before {
    content: '×';
    font-size: 24px;
    font-weight: 300;
}

.tutorial-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.tutorial-close:active {
    background: #e5e7eb;
}

.tutorial-close:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Button Container Variants */
.tutorial-buttons.justify-end {
    justify-content: flex-end;
}

.tutorial-buttons.justify-start {
    justify-content: flex-start;
}

.tutorial-buttons.justify-center {
    justify-content: center;
}

/* ==========================================
   8. HIGHLIGHTED ELEMENT
   ========================================== */

.tutorial-highlighted {
    position: relative;
    z-index: 9999 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.8),
                0 0 30px rgba(59, 130, 246, 0.6) !important;
    border-radius: 4px;
    animation: element-pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.tutorial-highlighted::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    pointer-events: none;
    animation: border-pulse 2s ease-in-out infinite;
}

/* ==========================================
   9. ANIMATIONS
   ========================================== */

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes cursor-click {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes cursor-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spotlight-pulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75),
                    0 0 50px 15px rgba(59, 130, 246, 0.8),
                    inset 0 0 0 3px rgba(59, 130, 246, 0.9);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75),
                    0 0 70px 20px rgba(59, 130, 246, 0.9),
                    inset 0 0 0 3px rgba(59, 130, 246, 1.0);
    }
}

@keyframes element-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.8),
                    0 0 30px rgba(59, 130, 246, 0.6);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 1.0),
                    0 0 40px rgba(59, 130, 246, 0.8);
    }
}

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

@keyframes progress-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ==========================================
   10. DARK THEME SUPPORT
   ========================================== */

body.dark-theme .tutorial-overlay {
    background: transparent;
}

body.dark-theme .tutorial-tooltip {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #333333;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5),
                0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-theme .tutorial-tooltip-title {
    color: #ffffff;
}

body.dark-theme .tutorial-tooltip-description {
    color: #d1d5db;
}

body.dark-theme .tutorial-tooltip-description code {
    background: #2a2a2a;
    color: #e5e5e5;
}

body.dark-theme .tutorial-tooltip-footer {
    border-top-color: #333333;
}

body.dark-theme .tutorial-step-counter {
    color: #9ca3af;
}

body.dark-theme .tutorial-progress-bar {
    background: #2a2a2a;
}

body.dark-theme .tutorial-btn-secondary {
    background: #2a2a2a;
    color: #e5e5e5;
    border-color: #4a4a4a;
}

body.dark-theme .tutorial-btn-secondary:hover:not(:disabled) {
    background: #333333;
    border-color: #666666;
}

body.dark-theme .tutorial-btn-secondary:active:not(:disabled) {
    background: #3a3a3a;
}

body.dark-theme .tutorial-close {
    color: #9ca3af;
}

body.dark-theme .tutorial-close:hover {
    background: #2a2a2a;
    color: #ffffff;
}

body.dark-theme .tutorial-close:active {
    background: #333333;
}

/* Dark theme arrow colors */
body.dark-theme .tutorial-tooltip.arrow-top::before {
    border-color: transparent transparent #1a1a1a transparent;
}

body.dark-theme .tutorial-tooltip.arrow-bottom::before {
    border-color: #1a1a1a transparent transparent transparent;
}

body.dark-theme .tutorial-tooltip.arrow-left::before {
    border-color: transparent #1a1a1a transparent transparent;
}

body.dark-theme .tutorial-tooltip.arrow-right::before {
    border-color: transparent transparent transparent #1a1a1a;
}

/* ==========================================
   12. ACCESSIBILITY
   ========================================== */

/* Focus indicators */
.tutorial-tooltip:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tutorial-overlay {
        background: rgba(0, 0, 0, 0.9);
    }

    .tutorial-tooltip {
        border: 2px solid #000000;
    }

    .tutorial-btn-primary {
        background: #0066cc;
        border: 2px solid #000000;
    }

    .tutorial-btn-secondary {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tutorial-overlay,
    .tutorial-tooltip,
    .tutorial-spotlight,
    .tutorial-cursor,
    .tutorial-highlighted,
    .tutorial-btn,
    .tutorial-progress-fill {
        transition: none;
        animation: none;
    }

    .tutorial-cursor::before {
        animation: none;
    }

    .tutorial-highlighted::after {
        animation: none;
    }
}

/* Screen reader only content */
.tutorial-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Keyboard navigation highlight */
.tutorial-btn:focus-visible,
.tutorial-close:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* ==========================================
   13. UTILITY CLASSES
   ========================================== */

.tutorial-hidden {
    display: none !important;
}

.tutorial-visible {
    display: block !important;
}

.tutorial-fade-out {
    opacity: 0 !important;
    pointer-events: none !important;
}

.tutorial-no-pointer {
    pointer-events: none !important;
}

.tutorial-pointer {
    pointer-events: all !important;
}

/* Text alignment utilities */
.tutorial-text-center {
    text-align: center;
}

.tutorial-text-left {
    text-align: left;
}

.tutorial-text-right {
    text-align: right;
}

/* ==========================================
   14. OPTIONAL: STEP DOTS (Breadcrumb)
   ========================================== */

.tutorial-step-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.tutorial-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.3s ease;
}

.tutorial-step-dot.active {
    background: #3b82f6;
    transform: scale(1.2);
}

.tutorial-step-dot.completed {
    background: #10b981;
}

body.dark-theme .tutorial-step-dot {
    background: #4a4a4a;
}

body.dark-theme .tutorial-step-dot.active {
    background: #3b82f6;
}

body.dark-theme .tutorial-step-dot.completed {
    background: #10b981;
}

/* ==========================================
   15. OPTIONAL: TOAST NOTIFICATIONS
   ========================================== */

.tutorial-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10002;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.tutorial-toast.active {
    opacity: 1;
    transform: translateY(0);
}

.tutorial-toast.success {
    border-left: 4px solid #10b981;
}

.tutorial-toast.error {
    border-left: 4px solid #ef4444;
}

.tutorial-toast.info {
    border-left: 4px solid #3b82f6;
}

body.dark-theme .tutorial-toast {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #333333;
}

/* ==========================================
   END OF INTERACTIVE TUTORIAL CSS
   ========================================== */
