/**
 * UX ENHANCEMENTS - Animations, Transitions & Visual Feedback
 * TaPrestation - Améliorations de l'expérience utilisateur
 */

/* ============================================
   SECTION 1: ANIMATIONS DE BASE
   ============================================ */

/* Fade In animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

/* Loading animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes progressBar {
    from { width: 0%; }
    to { width: 100%; }
}

/* Success/Error animations */
@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes checkmark {
    0% { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 0; }
}

/* Attention grabbers */
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8); }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   SECTION 2: CLASSES D'ANIMATION UTILITAIRES
   ============================================ */

.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease-out; }
.animate-fade-in-down { animation: fadeInDown 0.4s ease-out; }
.animate-fade-in-left { animation: fadeInLeft 0.4s ease-out; }
.animate-fade-in-right { animation: fadeInRight 0.4s ease-out; }
.animate-scale-in { animation: scaleIn 0.3s ease-out; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-bounce { animation: bounce 1s infinite; }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-wiggle { animation: wiggle 0.5s ease-in-out; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-glow { animation: glow 2s infinite; }

/* Delayed animations */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Staggered children animations */
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }

/* ============================================
   SECTION 3: TOOLTIPS & INFOBULLES
   ============================================ */

/* Tooltip de base */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-trigger {
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    margin-left: 6px;
    transition: all 0.2s ease;
}

.tooltip-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.tooltip-content {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    min-width: 220px;
    max-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #0f172a;
}

.tooltip-wrapper:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* Tooltip positions */
.tooltip-left .tooltip-content {
    left: auto;
    right: calc(100% + 10px);
    bottom: auto;
    top: 50%;
    transform: translateY(-50%) scale(0.95);
}

.tooltip-left .tooltip-content::after {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: #0f172a;
}

.tooltip-left:hover .tooltip-content {
    transform: translateY(-50%) scale(1);
}

.tooltip-right .tooltip-content {
    left: calc(100% + 10px);
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%) scale(0.95);
}

.tooltip-right .tooltip-content::after {
    top: 50%;
    right: 100%;
    left: auto;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-right-color: #0f172a;
}

.tooltip-right:hover .tooltip-content {
    transform: translateY(-50%) scale(1);
}

/* ============================================
   SECTION 4: HELP CARDS & INFO BOXES
   ============================================ */

.help-card {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    position: relative;
    overflow: hidden;
}

.help-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}

.help-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-bottom: 12px;
}

.help-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 8px;
}

.help-card-text {
    font-size: 14px;
    color: #3730a3;
    line-height: 1.6;
}

/* Tip card (green) */
.tip-card {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    position: relative;
    overflow: hidden;
}

.tip-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.tip-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin-bottom: 12px;
}

.tip-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #047857;
    margin-bottom: 8px;
}

.tip-card-text {
    font-size: 14px;
    color: #065f46;
    line-height: 1.6;
}

/* Warning card (orange) */
.warning-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    position: relative;
    overflow: hidden;
}

.warning-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

/* ============================================
   SECTION 5: ONBOARDING & TOUR GUIDES
   ============================================ */

/* Spotlight overlay */
.spotlight-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.spotlight-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Spotlight hole */
.spotlight-hole {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    transition: all 0.4s ease;
}

/* Tour tooltip */
.tour-tooltip {
    position: fixed;
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: scaleIn 0.3s ease-out;
}

.tour-tooltip-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.tour-tooltip-step {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.tour-tooltip-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.tour-tooltip-content {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tour-tooltip-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tour-tooltip-skip {
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

.tour-tooltip-skip:hover {
    color: #64748b;
}

.tour-tooltip-nav {
    display: flex;
    gap: 8px;
}

.tour-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-btn-prev {
    background: #f1f5f9;
    color: #64748b;
    border: none;
}

.tour-btn-prev:hover {
    background: #e2e8f0;
}

.tour-btn-next {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
}

.tour-btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Progress dots */
.tour-progress {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.2s;
}

.tour-dot.active {
    background: #3b82f6;
    width: 24px;
    border-radius: 4px;
}

/* ============================================
   SECTION 6: LOADING STATES
   ============================================ */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
    border-radius: 16px;
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-text {
    margin-top: 16px;
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
}

/* ============================================
   SECTION 7: FEEDBACK & NOTIFICATIONS
   ============================================ */

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: fadeInRight 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast-success::before { background: #10b981; }
.toast-error::before { background: #ef4444; }
.toast-warning::before { background: #f59e0b; }
.toast-info::before { background: #3b82f6; }

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-success .toast-icon { background: #d1fae5; color: #10b981; }
.toast-error .toast-icon { background: #fee2e2; color: #ef4444; }
.toast-warning .toast-icon { background: #fef3c7; color: #f59e0b; }
.toast-info .toast-icon { background: #dbeafe; color: #3b82f6; }

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: #64748b;
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #64748b;
}

/* Progress bar in toast */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: progressBar 5s linear forwards;
}

/* ============================================
   SECTION 8: EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    animation: fadeInUp 0.4s ease-out;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 48px;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    color: #64748b;
    max-width: 400px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

.empty-state-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.empty-state-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

/* ============================================
   SECTION 9: INTERACTIVE ELEMENTS
   ============================================ */

/* Ripple effect */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.ripple-effect:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: transform 0s, opacity 0s;
}

/* Hover lift */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

/* Hover grow */
.hover-grow {
    transition: transform 0.2s ease;
}

.hover-grow:hover {
    transform: scale(1.02);
}

/* Click feedback */
.click-feedback {
    transition: transform 0.1s ease;
}

.click-feedback:active {
    transform: scale(0.97);
}

/* ============================================
   SECTION 10: PROGRESS INDICATORS
   ============================================ */

/* Step progress */
.steps-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e2e8f0;
    z-index: -1;
}

.step-item.completed:not(:last-child)::after {
    background: #10b981;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    background: #f1f5f9;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.step-item.active .step-circle {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    animation: pulse 2s infinite;
}

.step-item.completed .step-circle {
    background: #10b981;
    color: white;
}

.step-label {
    margin-top: 8px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.step-item.active .step-label,
.step-item.completed .step-label {
    color: #1e293b;
}

/* ============================================
   SECTION 11: MOBILE SPECIFIC
   ============================================ */

@media (max-width: 640px) {
    .tooltip-content {
        min-width: 200px;
        max-width: 280px;
        font-size: 12px;
        padding: 10px 14px;
    }
    
    .tour-tooltip {
        max-width: calc(100vw - 40px);
        padding: 20px;
    }
    
    .toast-container {
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 80px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    .empty-state {
        padding: 40px 16px;
    }
    
    .empty-state-icon {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
}
