/* ============================================
   UX Enhancements - Optimisations d'interface
   Conserve le style existant (#9CC21C)
   ============================================ */

/* Variables CSS */
:root {
    --primary: #9CC21C;
    --primary-hover: #8AB019;
    --primary-light: rgba(156, 194, 28, 0.1);
    --primary-shadow: rgba(156, 194, 28, 0.25);
    
    --transition-fast: 0.15s;
    --transition-base: 0.3s;
    --transition-slow: 0.5s;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Animations & Transitions
   ============================================ */

/* Card hover effects */
.card {
    transition: transform var(--transition-base) ease, 
                box-shadow var(--transition-base) ease !important;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-light) !important;
}

/* Button ripple effect */
.btn {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base) ease !important;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.btn:active::before {
    width: 300px;
    height: 300px;
    transition: width 0.1s, height 0.1s;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-in-fast {
    animation: fadeIn 0.2s ease;
}

/* Pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 var(--primary-shadow);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(156, 194, 28, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(156, 194, 28, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Shimmer loading effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

/* Skeleton elements */
.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 16px;
    width: 100%;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    padding: 20px;
}

/* ============================================
   Loading States
   ============================================ */

/* Progress bar */
.ux-progress-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.ux-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ADC82E);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ux-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* Spinner élégant */
.ux-spinner {
    border: 3px solid rgba(156, 194, 28, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ux-spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ============================================
   Micro-Interactions
   ============================================ */

/* Success feedback */
.success-feedback {
    position: relative;
}

.success-feedback::after {
    content: '✓';
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    color: #28a745;
    font-size: 20px;
    font-weight: bold;
    animation: checkmark 0.5s ease forwards;
}

@keyframes checkmark {
    0% {
        transform: translateY(-50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translateY(-50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

/* Input focus */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    transition: all var(--transition-fast);
}

/* ============================================
   Empty States
   ============================================ */

.empty-state {
    animation: fadeIn 0.5s ease;
    padding: 3rem 1rem;
}

.empty-state-icon {
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.empty-state-title {
    margin-top: 1rem;
    color: #28084b;
}

/* ============================================
   Responsive & Touch
   ============================================ */

/* Zones touch plus grandes */
.btn, 
.nav-link, 
.dropdown-item {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Hover uniquement sur desktop */
@media (hover: hover) {
    .card:hover {
        transform: translateY(-2px);
    }
    
    .btn:hover {
        transform: translateY(-1px);
    }
}

/* Touch feedback mobile */
@media (hover: none) {
    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    .card:active {
        transform: scale(0.99);
        transition: transform 0.1s;
    }
}

/* ============================================
   Scrollbar Custom
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* ============================================
   Accessibilité
   ============================================ */

/* Focus visible */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--primary-shadow);
}

/* Skip to content */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    z-index: 9999;
}

.toast {
    backdrop-filter: blur(10px);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.smooth-transition {
    transition: all var(--transition-base) ease;
}

.no-transition {
    transition: none !important;
}

.shadow-primary {
    box-shadow: 0 4px 12px var(--primary-light) !important;
}

.border-primary-light {
    border-color: var(--primary-light) !important;
}

/* Badge avec animation */
.badge-pulse {
    animation: pulse 2s infinite;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

/* Disabled state améliioré */
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Modal Transitions
   ============================================ */

.modal.fade .modal-dialog {
    transform: scale(0.9) translateY(-50px);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
}
