/**
 * Medistock - Animations et effets visuels personnalisés
 * Pour une interface moderne et dynamique
 */

/* ==================== ANIMATIONS DE BASE ==================== */

/* Animation d'apparition fade-in */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animation de pulsation */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Animation de rebond */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Animation de brillance */
@keyframes shine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* Animation du badge notification */
@keyframes notificationPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* Animation de rotation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Animation slide-in depuis la droite */
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Animation de compteur */
@keyframes countUp {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* ==================== WIDGETS STATS ==================== */

/* Cartes de statistiques avec animation d'apparition */
.fi-wi-stats-overview-stat {
    animation: fadeIn 0.5s ease-out;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fi-wi-stats-overview-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* Animation décalée pour chaque carte */
.fi-wi-stats-overview-stat:nth-child(1) { animation-delay: 0.1s; }
.fi-wi-stats-overview-stat:nth-child(2) { animation-delay: 0.2s; }
.fi-wi-stats-overview-stat:nth-child(3) { animation-delay: 0.3s; }
.fi-wi-stats-overview-stat:nth-child(4) { animation-delay: 0.4s; }
.fi-wi-stats-overview-stat:nth-child(5) { animation-delay: 0.5s; }
.fi-wi-stats-overview-stat:nth-child(6) { animation-delay: 0.6s; }
.fi-wi-stats-overview-stat:nth-child(7) { animation-delay: 0.7s; }
.fi-wi-stats-overview-stat:nth-child(8) { animation-delay: 0.8s; }

/* Valeurs des stats avec animation de comptage */
.fi-wi-stats-overview-stat-value {
    animation: countUp 0.8s ease-out;
}

/* Icônes des stats avec effet */
.fi-wi-stats-overview-stat-icon {
    transition: transform 0.3s ease;
}

.fi-wi-stats-overview-stat:hover .fi-wi-stats-overview-stat-icon {
    transform: scale(1.2) rotate(5deg);
}

/* ==================== NAVIGATION ==================== */

/* Liens de navigation avec transition */
.fi-sidebar-item {
    transition: all 0.2s ease;
}

.fi-sidebar-item:hover {
    transform: translateX(4px);
}

/* Animation du logo */
.fi-logo {
    transition: transform 0.3s ease;
}

.fi-logo:hover {
    transform: scale(1.05);
}

/* Contrainte de taille pour les logos et images dans le contenu principal */
.fi-logo img,
.fi-brand img,
.fi-main img:not(.fi-avatar):not(.fi-ta-image img):not(.fi-in-image img) {
    max-width: 200px !important;
    max-height: 80px !important;
    object-fit: contain;
}

/* Réduction des icônes SVG trop grandes dans le contenu */
.fi-main svg:not(.fi-icon):not([class*="w-"]):not([class*="h-"]) {
    max-width: 64px;
    max-height: 64px;
}

/* Limiter la taille des images isolées */
.fi-page > img,
.fi-main > div > img,
body > img {
    max-width: 150px !important;
    max-height: 150px !important;
}

/* ==================== BOUTONS ==================== */

/* Boutons avec effet de ripple et transitions */
.fi-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fi-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Effet ripple au clic */
.fi-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.fi-btn:active::after {
    width: 200px;
    height: 200px;
}

/* ==================== NOTIFICATIONS ==================== */

/* Badge notification animé */
.fi-badge {
    transition: all 0.3s ease;
}

.fi-topbar-database-notifications-btn .fi-badge {
    animation: notificationPulse 2s infinite;
}

/* Dropdown notifications avec animation */
.fi-dropdown-panel {
    animation: slideInRight 0.3s ease-out;
}

/* ==================== TABLEAUX ==================== */

/* Lignes de tableau avec animation au survol */
.fi-ta-row {
    transition: all 0.2s ease;
}

.fi-ta-row:hover {
    background-color: rgba(16, 185, 129, 0.05) !important;
    transform: scale(1.002);
}

/* Animation d'apparition des lignes */
.fi-ta-row {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== MODALES ==================== */

/* Modal avec animation d'ouverture */
.fi-modal-window {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== FORMULAIRES ==================== */

/* Champs de formulaire avec transitions */
.fi-input, .fi-select, .fi-textarea {
    transition: all 0.2s ease;
}

.fi-input:focus, .fi-select:focus, .fi-textarea:focus {
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Labels avec animation */
.fi-fo-field-wrp label {
    transition: color 0.2s ease;
}

/* ==================== CARTES & SECTIONS ==================== */

/* Sections avec animation d'apparition */
.fi-section {
    animation: fadeIn 0.5s ease-out;
}

/* Effet de brillance sur les sections au survol */
.fi-section-header {
    position: relative;
    overflow: hidden;
}

.fi-section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -200%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.fi-section:hover .fi-section-header::before {
    left: 200%;
}

/* ==================== GRAPHIQUES ==================== */

/* Conteneur de graphiques avec animation */
.fi-wi-chart {
    animation: fadeIn 0.8s ease-out;
}

/* ==================== INDICATEURS DE CHARGEMENT ==================== */

/* Spinner personnalisé */
.fi-loading-indicator {
    animation: spin 1s linear infinite;
}

/* Skeleton loading avec effet de brillance */
.fi-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shine 1.5s infinite;
}

/* ==================== BADGES DE STATUT ==================== */

/* Badges avec animation subtile */
.fi-badge[style*="success"], .fi-badge[style*="green"] {
    animation: pulse 2s infinite;
}

.fi-badge[style*="danger"], .fi-badge[style*="red"] {
    animation: notificationPulse 1.5s infinite;
}

/* ==================== ALERTES ==================== */

/* Alertes avec animation d'entrée */
.fi-notification {
    animation: slideInRight 0.4s ease-out;
}

/* ==================== EFFETS DARK MODE ==================== */

.dark .fi-wi-stats-overview-stat:hover {
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
}

.dark .fi-ta-row:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

/* ==================== EFFETS SPÉCIAUX ==================== */

/* Effet de gradient animé pour les titres importants */
.animated-gradient {
    background: linear-gradient(270deg, #10b981, #3b82f6, #8b5cf6, #10b981);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Effet glow pour éléments importants */
.glow-effect {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    transition: box-shadow 0.3s ease;
}

.glow-effect:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
}

/* ==================== TRANSITIONS DE PAGE ==================== */

/* Transition smooth pour le contenu principal */
.fi-main {
    animation: fadeIn 0.4s ease-out;
}

/* ==================== COMPTEUR ANIMÉ ==================== */

.counter-animate {
    display: inline-block;
    animation: countUp 0.5s ease-out;
}

/* ==================== RESPONSIVE ANIMATIONS ==================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== SCROLLBAR PERSONNALISÉE ==================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #10b981, #059669);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #059669, #047857);
}

.dark ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}
