/* =====================================
   TUTORIAL SYSTEM - Interactive Onboarding
   ===================================== */

/* Tutorial Overlay System */
.tutorial-system {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    pointer-events: none;
}

.tutorial-system.active {
    pointer-events: auto;
}

/* Spotlight pour élément surligné (inclut le backdrop via box-shadow) */
.tutorial-spotlight {
    position: absolute;
    border-radius: 8px;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.tutorial-spotlight.element-highlight {
    box-shadow: 
        0 0 0 4px rgba(0, 122, 255, 0.3),
        0 0 0 9999px rgba(0, 0, 0, 0.7);
    background: transparent;
}

.tutorial-spotlight.container-highlight {
    box-shadow: 
        0 0 0 2px rgba(0, 122, 255, 0.5),
        0 0 0 9999px rgba(0, 0, 0, 0.7);
    background: rgba(0, 122, 255, 0.05);
}

/* Tooltip */
.tutorial-tooltip {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    min-width: 280px;
    z-index: 10000;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.tutorial-system.active .tutorial-tooltip {
    opacity: 1;
    transform: scale(1);
}

/* Arrow pour pointer vers l'élément */
.tutorial-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 12px solid transparent;
}

.tutorial-tooltip.position-top::before {
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: white;
}

.tutorial-tooltip.position-bottom::before {
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: white;
}

.tutorial-tooltip.position-left::before {
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: white;
}

.tutorial-tooltip.position-right::before {
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: white;
}

.tutorial-tooltip.position-center {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%);
}

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

/* Header du tooltip */
.tutorial-tooltip-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.tutorial-tooltip-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    flex: 1;
}

.tutorial-step-counter {
    background: #f1f3f4;
    color: #6b7280;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Contenu */
.tutorial-tooltip-content {
    padding: 0.75rem 1.5rem;
}

.tutorial-tooltip-content p {
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
    font-size: 1rem;
}

/* Actions */
.tutorial-tooltip-actions {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tutorial-nav-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Boutons */
.tutorial-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tutorial-btn-skip {
    background: transparent;
    color: #6b7280;
    text-decoration: underline;
    padding: 0.5rem 0;
    margin-right: 1rem;
}

.tutorial-btn-skip:hover {
    color: #4a5568;
}

.tutorial-btn-prev {
    background: #f1f3f4;
    color: #4a5568;
    border: 1px solid #e5e7eb;
}

.tutorial-btn-prev:hover {
    background: #e5e7eb;
    color: #374151;
}

.tutorial-btn-next {
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.tutorial-btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
}

.tutorial-btn-next.cta {
    background: linear-gradient(135deg, #34c759 0%, #30b85a 100%);
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

/* Flèche de défilement animée */
.tutorial-scroll-arrow {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    font-size: 5rem;
    animation: bounceDown 2s infinite;
    pointer-events: none;
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 12px rgba(0, 122, 255, 0.4));
}

@keyframes bounceDown {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Bouton flottant de relance - même style que chat-widget */
.tutorial-launcher {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 1000;
}

.tutorial-launch-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #007aff 0%, #0056b3 100%);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-launch-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.tutorial-launch-btn.pulse {
    animation: tutorialPulse 2s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: 300px;
        min-width: 250px;
        margin: 1rem;
    }
    
    .tutorial-tooltip-header,
    .tutorial-tooltip-content,
    .tutorial-tooltip-actions {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .tutorial-tooltip-actions {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .tutorial-nav-buttons {
        order: 2;
        width: 100%;
        justify-content: space-between;
    }
    
    .tutorial-btn-skip {
        order: 1;
        text-align: center;
    }
    
    .tutorial-launcher {
        bottom: 90px;
        right: 20px;
    }
    
    .tutorial-launch-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* Animations */
@keyframes tutorialPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* États de validation */
.tutorial-tooltip.action-completed .tutorial-btn-next {
    background: linear-gradient(135deg, #34c759 0%, #30b85a 100%);
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

/* Animation de transition entre étapes */
.tutorial-tooltip.transitioning {
    opacity: 0.7;
    transform: scale(0.95);
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    .tutorial-tooltip,
    .tutorial-spotlight,
    .tutorial-backdrop {
        transition: none;
    }
    
    .tutorial-launch-btn.pulse {
        animation: none;
    }
}

/* Focus management */
.tutorial-system.active {
    /* Désactiver les interactions avec le reste de la page */
}

.tutorial-system.active .tutorial-tooltip {
    /* S'assurer que le tooltip est focusable */
    pointer-events: auto;
}