/* ═══════════════════════════════════════════════════════════════════
   ZenFi Enhance CSS v1 — Micro-interactions & Modern UI Patterns
   Compatible avec le design system existant (admin.css tokens)
   À inclure APRES admin.css ou le <style> inline de la page
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Scroll-Reveal ─── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s cubic-bezier(.22,1,.36,1),
              transform .6s cubic-bezier(.22,1,.36,1);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal="left"]  { transform: translateX(-24px); }
[data-reveal="right"] { transform: translateX(24px); }
[data-reveal="scale"] { transform: scale(.94); }
[data-reveal="left"].revealed,
[data-reveal="right"].revealed { transform: translateX(0); }
[data-reveal="scale"].revealed { transform: scale(1); }

/* Stagger delays */
[data-reveal-stagger] > [data-reveal]:nth-child(1) { transition-delay: 0s; }
[data-reveal-stagger] > [data-reveal]:nth-child(2) { transition-delay: .08s; }
[data-reveal-stagger] > [data-reveal]:nth-child(3) { transition-delay: .16s; }
[data-reveal-stagger] > [data-reveal]:nth-child(4) { transition-delay: .24s; }
[data-reveal-stagger] > [data-reveal]:nth-child(5) { transition-delay: .32s; }
[data-reveal-stagger] > [data-reveal]:nth-child(6) { transition-delay: .40s; }

/* ─── Glass Morphism ─── */
.glass {
  background: rgba(255,255,255,.06) !important;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255,255,255,.1) !important;
}
body.dark .glass,
.dark .glass {
  background: rgba(255,255,255,.04) !important;
  border-color: rgba(255,255,255,.06) !important;
}
.glass-strong {
  background: rgba(255,255,255,.1) !important;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,.14) !important;
}
.glass-subtle {
  background: rgba(255,255,255,.03) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ─── Sticky Nav avec backdrop-blur ─── */
.sticky-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,17,23,.82);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: background .3s, box-shadow .3s;
}
.sticky-nav.scrolled {
  background: rgba(13,17,23,.94);
  box-shadow: 0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.15);
}

/* ─── Enhanced Button Hover ─── */
.btn-glow {
  position: relative;
  overflow: hidden;
}
.btn-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%),
              rgba(255,255,255,.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .3s;
}
.btn-glow:hover::after { opacity: 1; }

.btn-pulse {
  animation: btnPulse 2s ease-in-out infinite;
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
}

/* ─── Skeleton Loaders ─── */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface2,#1c1c2e) 25%,
    var(--surface3,#2d2d44) 50%,
    var(--surface2,#1c1c2e) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm, 6px);
}
@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}
.skeleton-text:last-child { width: 60%; }
.skeleton-title {
  height: 20px;
  width: 40%;
  margin-bottom: 12px;
  border-radius: 6px;
}
.skeleton-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}
.skeleton-card {
  padding: 20px;
  border-radius: var(--radius, 10px);
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
}
.skeleton-stat {
  height: 64px;
  border-radius: var(--radius, 10px);
}

/* ─── Toast Notification System ─── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius, 10px);
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text, #e6edf3);
  pointer-events: auto;
  animation: toastIn .4s cubic-bezier(.22,1,.36,1);
  max-width: 400px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast.removing {
  animation: toastOut .3s cubic-bezier(.55,0,1,.45) forwards;
}
.toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.toast-success { border-left: 3px solid var(--green, #34d399); }
.toast-success .toast-icon { background: var(--green-dim, rgba(52,211,153,.15)); color: var(--green, #34d399); }
.toast-error   { border-left: 3px solid var(--red, #f87171); }
.toast-error .toast-icon   { background: var(--red-dim, rgba(248,113,113,.15)); color: var(--red, #f87171); }
.toast-warning { border-left: 3px solid var(--orange, #fbbf24); }
.toast-warning .toast-icon { background: var(--orange-dim, rgba(251,191,36,.15)); color: var(--orange, #fbbf24); }
.toast-info    { border-left: 3px solid var(--accent, #818cf8); }
.toast-info .toast-icon    { background: var(--accent-dim, rgba(129,140,248,.15)); color: var(--accent, #818cf8); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(40px) scale(.9); }
}

/* ─── Card Hover Lift ─── */
.card-lift {
  transition: transform .25s cubic-bezier(.22,1,.36,1),
              box-shadow .25s cubic-bezier(.22,1,.36,1),
              border-color .25s;
}
.card-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
  border-color: rgba(129,140,248,.2);
}

/* ─── Animated Gradient Border ─── */
.gradient-border {
  position: relative;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg,
    var(--accent, #818cf8),
    #a855f7,
    var(--green, #34d399),
    var(--accent, #818cf8)
  );
  background-size: 300% 300%;
  animation: gradientRotate 4s ease infinite;
  z-index: -1;
  opacity: .6;
}
@keyframes gradientRotate {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ─── Hero Gradient Background ─── */
.hero-glow {
  position: relative;
  overflow: hidden;
}
.hero-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(99,102,241,.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 60%, rgba(168,85,247,.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 80%, rgba(52,211,153,.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Badge / Pill ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-new {
  background: rgba(52,211,153,.15);
  color: var(--green, #34d399);
  border: 1px solid rgba(52,211,153,.25);
}
.badge-hot {
  background: rgba(248,113,113,.15);
  color: var(--red, #f87171);
  border: 1px solid rgba(248,113,113,.25);
}
.badge-beta {
  background: rgba(251,191,36,.15);
  color: var(--orange, #fbbf24);
  border: 1px solid rgba(251,191,36,.25);
}

/* ─── Smooth page transitions ─── */
.page-transition {
  animation: pageIn .35s cubic-bezier(.22,1,.36,1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Focus ring amélioré ─── */
*:focus-visible {
  outline: 2px solid var(--accent, #818cf8);
  outline-offset: 2px;
  border-radius: 4px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(129,140,248,.25);
  border-color: var(--accent, #818cf8) !important;
}

/* ─── Number counter animation ─── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.count-up { animation: countUp .5s cubic-bezier(.22,1,.36,1) forwards; }

/* ─── Spinner ─── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border, #30363d);
  border-top-color: var(--accent, #818cf8);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Tooltip ─── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface, #161b22);
  color: var(--text, #e6edf3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  border: 1px solid var(--border, #30363d);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ─── Empty State ─── */
.empty-state-modern {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.empty-state-modern .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--surface2, #21262d);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 28px;
  opacity: .5;
}
.empty-state-modern .empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #e6edf3);
  margin-bottom: 6px;
}
.empty-state-modern .empty-desc {
  font-size: 13px;
  color: var(--text3, #6e7681);
  max-width: 320px;
  line-height: 1.5;
}
