/* ============================================
   🎓 SISTEMA DE TUTORIALES INTERACTIVOS
   ============================================ */

/* Overlay oscuro que cubre toda la pantalla */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    animation: fadeIn 0.3s ease;
}

.tutorial-overlay.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Spotlight - Resalta el elemento actual */
.tutorial-spotlight {
    position: relative;
    z-index: 10001 !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85),
                0 0 60px rgba(6, 182, 212, 0.8),
                0 0 100px rgba(6, 182, 212, 0.4),
                inset 0 0 30px rgba(6, 182, 212, 0.2);
    border-radius: 12px;
    animation: spotlightPulse 2s ease-in-out infinite;
    pointer-events: auto !important;
}

@keyframes spotlightPulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85),
                    0 0 60px rgba(6, 182, 212, 0.8),
                    0 0 100px rgba(6, 182, 212, 0.4),
                    inset 0 0 30px rgba(6, 182, 212, 0.2);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85),
                    0 0 80px rgba(6, 182, 212, 1),
                    0 0 120px rgba(6, 182, 212, 0.6),
                    inset 0 0 40px rgba(6, 182, 212, 0.3);
    }
}

/* Tooltip con instrucciones */
.tutorial-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #141414, #1a1a1a);
    border: 2px solid var(--accent-cyan);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    min-width: 320px;
    z-index: 10002;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9),
                0 0 40px rgba(6, 182, 212, 0.4);
    animation: tooltipSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Flecha del tooltip */
.tutorial-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 12px solid transparent;
}

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

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

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

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

/* Header del tooltip */
.tutorial-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.tutorial-step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 13px;
}

.tutorial-step-indicator i {
    font-size: 16px;
}

.tutorial-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.tutorial-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Título del paso */
.tutorial-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tutorial-title i {
    color: var(--accent-cyan);
    font-size: 24px;
}

/* Mensaje del paso */
.tutorial-message {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Barra de progreso */
.tutorial-progress {
    margin-bottom: 20px;
}

.tutorial-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-body);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.tutorial-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.tutorial-progress-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

/* Botones de navegación */
.tutorial-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.tutorial-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tutorial-btn-next {
    background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
    color: white;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
}

.tutorial-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(6, 182, 212, 0.6), 0 0 40px rgba(6, 182, 212, 0.3);
}

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

.tutorial-btn-prev {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}

.tutorial-btn-prev:hover {
    background: var(--bg-elevated);
    color: var(--accent);
    border-color: var(--accent);
}

.tutorial-btn-skip {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    padding: 10px 16px;
    font-size: 13px;
}

.tutorial-btn-skip:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

/* Botón de ayuda flotante */
.tutorial-help-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-help-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 40px rgba(6, 182, 212, 0.6), 0 0 40px rgba(6, 182, 212, 0.4);
}

.tutorial-help-btn i {
    animation: helpPulse 2s ease-in-out infinite;
}

@keyframes helpPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Badge de "Nuevo" */
.tutorial-new-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, var(--accent-pink), #db2777);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.5);
    animation: badgeBounce 2s ease-in-out infinite;
}

@keyframes badgeBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Indicador de acción requerida */
.tutorial-required-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid var(--accent-yellow);
    border-radius: 8px;
    color: var(--accent-yellow);
    font-size: 13px;
    font-weight: 600;
    margin-top: 12px;
}

.tutorial-required-indicator i {
    animation: warningBlink 1.5s ease-in-out infinite;
}

@keyframes warningBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: calc(100vw - 32px);
        min-width: auto;
        left: 16px !important;
        right: 16px !important;
        top: auto !important;
        bottom: 16px !important;
    }

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

    .tutorial-help-btn {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* Animación de completado */
.tutorial-complete-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10003;
    text-align: center;
    animation: completeZoomIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes completeZoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.tutorial-complete-icon {
    font-size: 80px;
    color: var(--accent-neon);
    margin-bottom: 20px;
    animation: checkmarkDraw 0.8s ease-in-out;
}

@keyframes checkmarkDraw {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.tutorial-complete-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
}

.tutorial-complete-message {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 24px;
}
