﻿/* ============================================
   ADMIN ANIMATIONS 2026 - HARMONIE BYMANON
   60fps mobile (transform/opacity only)
   ============================================ */

/* === VARIABLES TIMING AMÉLI ORÉES === */
:root {
    --anim-fast: 0.15s;
    --anim-normal: 0.25s;
    --anim-slow: 0.35s;
    --ease-out: cubic-bezier(0.4, 0, 0.6, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* === FADE-IN SCROLL (IntersectionObserver) === */
.anim-fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--anim-slow) var(--ease-out),
                transform var(--anim-slow) var(--ease-out);
}

.anim-fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === FADE-IN STAGGER GRID === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-grid > *,
.stats-bar > *,
.clients-grid > *,
.images-grid > *,
.slots-grid > *,
.actions-grid > *,
.files-list > *,
.messages-list > *,
.activity-list > * {
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

.stats-grid > *:nth-child(1), .stats-bar > *:nth-child(1), .clients-grid > *:nth-child(1), .images-grid > *:nth-child(1), .actions-grid > *:nth-child(1) { animation-delay: 0.03s; }
.stats-grid > *:nth-child(2), .stats-bar > *:nth-child(2), .clients-grid > *:nth-child(2), .images-grid > *:nth-child(2), .actions-grid > *:nth-child(2) { animation-delay: 0.06s; }
.stats-grid > *:nth-child(3), .stats-bar > *:nth-child(3), .clients-grid > *:nth-child(3), .images-grid > *:nth-child(3), .actions-grid > *:nth-child(3) { animation-delay: 0.09s; }
.stats-grid > *:nth-child(4), .stats-bar > *:nth-child(4), .clients-grid > *:nth-child(4), .images-grid > *:nth-child(4), .actions-grid > *:nth-child(4) { animation-delay: 0.12s; }
.stats-grid > *:nth-child(5), .clients-grid > *:nth-child(5), .images-grid > *:nth-child(5) { animation-delay: 0.15s; }
.stats-grid > *:nth-child(6), .clients-grid > *:nth-child(6), .images-grid > *:nth-child(6) { animation-delay: 0.18s; }
.clients-grid > *:nth-child(7), .images-grid > *:nth-child(7) { animation-delay: 0.21s; }
.clients-grid > *:nth-child(8), .images-grid > *:nth-child(8) { animation-delay: 0.24s; }
.clients-grid > *:nth-child(9), .images-grid > *:nth-child(9) { animation-delay: 0.27s; }
.clients-grid > *:nth-child(10), .images-grid > *:nth-child(10) { animation-delay: 0.30s; }
.clients-grid > *:nth-child(11), .images-grid > *:nth-child(11) { animation-delay: 0.33s; }
.clients-grid > *:nth-child(12), .images-grid > *:nth-child(12) { animation-delay: 0.36s; }

/* === HOVER SCALE + SHADOW + ROTATE X === */
.stat-card,
.stat-item,
.client-card,
.image-card,
.action-card,
.slot-item,
.file-item,
.message-card,
.category,
.card,
.section-card,
.quick-link {
    transition: all var(--anim-normal) var(--ease-smooth);
    transform-style: preserve-3d;
    will-change: transform, box-shadow;
}

.stat-card:hover,
.stat-item:hover,
.client-card:hover,
.image-card:hover,
.action-card:hover,
.slot-item:hover,
.file-item:hover,
.message-card:hover,
.card:hover,
.section-card:hover,
.quick-link:hover {
    transform: translateY(-5px) rotateX(1deg);
    box-shadow: 0 16px 40px rgba(146, 135, 133, 0.25);
    transition: all var(--anim-normal) var(--ease-smooth);
}

.stat-card:active,
.stat-item:active,
.client-card:active,
.image-card:active,
.action-card:active,
.slot-item:active,
.file-item:active,
.message-card:active,
.card:active,
.section-card:active,
.quick-link:active {
    transform: translateY(-2px) scale(0.99);
}

/* === BUTTON HOVER SCALE + SHADOW AMÉLIORÉ === */
.btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 24px rgba(146, 135, 133, 0.3);
    transition: all var(--anim-fast) var(--ease-bounce);
}

.btn:active {
    transform: scale(0.98) translateY(0);
    box-shadow: 0 2px 8px rgba(146, 135, 133, 0.2);
}

/* === LIENS UNDERLINE #928785 === */
a:not(.btn):not(.nav-btn):not(.action-card):not(.quick-link) {
    position: relative;
    text-decoration: none;
}

a:not(.btn):not(.nav-btn):not(.action-card):not(.quick-link)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #928785;
    transition: width var(--anim-normal) var(--ease-smooth);
}

a:not(.btn):not(.nav-btn):not(.action-card):not(.quick-link):hover::after {
    width: 100%;
}

/* === BUTTON PRESS === */
.btn {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background 0.2s ease-in-out;
}

.btn:active {
    transform: scale(0.98);
}

.nav-btn,
.tab,
.tab-btn,
.filter-btn {
    transition: transform 0.2s ease-in-out, background 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.nav-btn:active,
.tab:active,
.tab-btn:active,
.filter-btn:active {
    transform: scale(0.98);
}

/* === MODAL SLIDE-UP === */
@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal {
    animation: modalFadeIn 0.2s ease-out;
}

.modal .modal-content {
    animation: modalSlideUp 0.25s ease-out;
}

/* === TOAST ANIMATION === */
@keyframes toastSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.show {
    animation: toastSlide 0.25s ease-out;
}

/* === LOADING PULSE === */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading {
    animation: pulse 1.2s ease-in-out infinite;
}

/* === CATEGORY ACCORDION === */
.category-header .toggle {
    transition: transform 0.2s ease-in-out;
}

.category.collapsed .category-header .toggle {
    transform: rotate(-90deg);
}

.category-body {
    transition: max-height 0.2s ease-in-out, opacity 0.2s ease-in-out, padding 0.2s ease-in-out;
    overflow: hidden;
}

/* === UPLOAD AREA === */
.upload-area {
    transition: border-color 0.2s ease-in-out, background 0.2s ease-in-out;
}

.upload-area.dragover {
    border-color: #a47551;
    background: rgba(164, 117, 81, 0.05);
}

/* === INPUT FOCUS AMÉLIORÉ === */
input, textarea, select {
    transition:
        border-color var(--anim-fast) var(--ease-smooth),
        box-shadow var(--anim-fast) var(--ease-smooth),
        transform var(--anim-fast) var(--ease-smooth);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--col-gold, #d4a373) !important;
    box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.2) !important;
    outline: none !important;
    transform: scale(1.01);
    transition: all var(--anim-normal) var(--ease-smooth);
}

/* === PAGE LOAD === */
@keyframes pageLoad {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.main-container {
    animation: pageLoad 0.3s ease-out;
}

/* === HEADER NAV INDICATOR === */
.nav-btn.active {
    position: relative;
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

/* === SIDEBAR SLIDE X === */
.admin-header {
    transition: transform var(--anim-normal) var(--ease-smooth),
                left var(--anim-normal) var(--ease-smooth);
}

@media (max-width: 768px) {
    .admin-header {
        transform: translateX(0);
    }
}

/* === THEME TRANSITIONS OPTIMISÉES === */
body {
    transition: background var(--anim-normal) var(--ease-smooth),
                color var(--anim-normal) var(--ease-smooth);
}

/* Remplacer wildcard par classes spécifiques (performance) */
.card, .stat-card, .section-card, .btn, .nav-btn,
input, textarea, select, .modal, .toast,
.client-card, .image-card, .action-card, .file-item {
    transition:
        background-color var(--anim-normal) var(--ease-smooth),
        border-color var(--anim-normal) var(--ease-smooth),
        color var(--anim-normal) var(--ease-smooth),
        box-shadow var(--anim-fast) var(--ease-smooth);
}

/* === LOADER FADE-OUT === */
@keyframes loaderFadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

.loader-hide {
    animation: loaderFadeOut 0.3s var(--ease-out) forwards;
}

/* === IMAGE SKELETON → BLUR-IN === */
.img-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.img-blur-in {
    filter: blur(10px);
    transition: filter 0.4s var(--ease-out);
}

.img-blur-in.loaded {
    filter: blur(0);
}

/* === STAGGER DELAY UTILITY === */
.stagger-1 { animation-delay: 0.1s !important; }
.stagger-2 { animation-delay: 0.2s !important; }
.stagger-3 { animation-delay: 0.3s !important; }
.stagger-4 { animation-delay: 0.4s !important; }
.stagger-5 { animation-delay: 0.5s !important; }

/* === GRAPH ANIMATIONS (Chart.js) === */
.chart-container {
    opacity: 0;
    animation: fadeInUp 0.5s var(--ease-out) 0.2s forwards;
}

.chart-container canvas {
    transition: transform 0.3s var(--ease-smooth);
}

.chart-container:hover canvas {
    transform: scale(1.01);
}

/* === SMOOTH SCROLL GLOBAL === */
html {
    scroll-behavior: smooth;
}

/* === PERFORMANCE 60FPS === */
@media (hover: hover) and (pointer: fine) {
    /* Activer will-change seulement sur desktop */
    .stat-card,
    .btn,
    .nav-btn,
    .card,
    .client-card,
    .image-card {
        will-change: transform;
    }
}

/* === LOADER SKELETON AMÉLIORATION === */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading, .img-skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

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