/* ══════════════════════════════════════════════════════════════════════
   CaleDoHub Design System v1.0 — Tokens, composants, animations premium
   Applicable sur les 10 sites de l'écosystème.
   À inclure AVANT caledohub-tokens.css et caledohub-design.css
   ══════════════════════════════════════════════════════════════════════ */

:root {
  /* ─── BRAND COLORS ─── */
  --ch-primary:       #06D6A0;  /* CaleDo Green */
  --ch-primary-dark:  #059669;
  --ch-primary-light: #34d399;
  --ch-coral:         #FF6B35;
  --ch-red:           #E63946;
  --ch-gold:          #F59E0B;
  --ch-navy:          #0F172A;
  --ch-blue:          #4361EE;
  --ch-violet:        #7c3aed;

  /* ─── SECTOR COLORS (1 par site) ─── */
  --color-hub:    #264653;  /* 🌴 Portail */
  --color-drive:  #FF6B35;  /* 🚗 Auto */
  --color-resto:  #E63946;  /* 🍽️ Resto */
  --color-tech:   #06D6A0;  /* 💻 Tech */
  --color-beaute: #C9347C;  /* 💄 Beauté */
  --color-immo:   #457B9D;  /* 🏠 Immo */
  --color-sante:  #2A9D8F;  /* 🏥 Santé */
  --color-kids:   #F4A261;  /* 🎪 Kids */
  --color-kdo:    #E76F51;  /* 🎁 KDO */
  --color-job:    #4361EE;  /* 💼 Job */

  /* ─── NEUTRAL SCALE ─── */
  --ch-gray-50:  #f8fafc;
  --ch-gray-100: #f1f5f9;
  --ch-gray-200: #e2e8f0;
  --ch-gray-300: #cbd5e1;
  --ch-gray-400: #94a3b8;
  --ch-gray-500: #64748b;
  --ch-gray-600: #475569;
  --ch-gray-700: #334155;
  --ch-gray-800: #1e293b;
  --ch-gray-900: #0f172a;

  /* ─── SEMANTIC ─── */
  --ch-success: #10b981;
  --ch-warning: #f59e0b;
  --ch-danger:  #ef4444;
  --ch-info:    #3b82f6;

  /* ─── SPACING SCALE (4px base) ─── */
  --ch-sp-0: 0;
  --ch-sp-1: 4px;
  --ch-sp-2: 8px;
  --ch-sp-3: 12px;
  --ch-sp-4: 16px;
  --ch-sp-5: 20px;
  --ch-sp-6: 24px;
  --ch-sp-8: 32px;
  --ch-sp-10: 40px;
  --ch-sp-12: 48px;
  --ch-sp-16: 64px;
  --ch-sp-20: 80px;

  /* ─── RADIUS ─── */
  --ch-r-sm:  6px;
  --ch-r-md:  10px;
  --ch-r-lg:  14px;
  --ch-r-xl:  20px;
  --ch-r-2xl: 28px;
  --ch-r-full: 9999px;

  /* ─── SHADOWS ─── */
  --ch-shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --ch-shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --ch-shadow-md: 0 4px 6px -1px rgba(15,23,42,.08), 0 2px 4px -2px rgba(15,23,42,.04);
  --ch-shadow-lg: 0 10px 15px -3px rgba(15,23,42,.1), 0 4px 6px -4px rgba(15,23,42,.05);
  --ch-shadow-xl: 0 20px 25px -5px rgba(15,23,42,.1), 0 8px 10px -6px rgba(15,23,42,.04);
  --ch-shadow-glow: 0 0 0 4px rgba(6,214,160,.15);
  --ch-shadow-coral-glow: 0 0 0 4px rgba(255,107,53,.18);

  /* ─── TYPOGRAPHY ─── */
  --ch-font-sans: 'Outfit', system-ui, -apple-system, sans-serif;
  --ch-font-display: 'Righteous', 'Outfit', cursive;
  --ch-font-mono: 'JetBrains Mono', 'Menlo', monospace;

  --ch-fs-xs:   0.72rem;
  --ch-fs-sm:   0.82rem;
  --ch-fs-base: 0.9rem;
  --ch-fs-md:   1rem;
  --ch-fs-lg:   1.15rem;
  --ch-fs-xl:   1.4rem;
  --ch-fs-2xl:  1.8rem;
  --ch-fs-3xl:  2.4rem;
  --ch-fs-hero: clamp(2rem, 5vw, 4rem);

  /* ─── MOTION ─── */
  --ch-ease:      cubic-bezier(.4,0,.2,1);
  --ch-ease-out:  cubic-bezier(.16,1,.3,1);
  --ch-ease-bouncy: cubic-bezier(.68,-.55,.27,1.55);
  --ch-dur-fast:   .15s;
  --ch-dur-base:   .25s;
  --ch-dur-slow:   .4s;

  /* ─── LAYERS (z-index) ─── */
  --ch-z-base:    1;
  --ch-z-nav:     100;
  --ch-z-overlay: 900;
  --ch-z-modal:   1000;
  --ch-z-toast:   1100;
  --ch-z-top:     9999;

  /* ─── GLASS EFFECT ─── */
  --ch-glass-bg: rgba(255,255,255,.72);
  --ch-glass-border: rgba(255,255,255,.35);
  --ch-glass-blur: blur(14px) saturate(140%);

  /* ─── BG SURFACE ─── */
  --ch-bg:       #ffffff;
  --ch-bg-soft:  #f8fafc;
  --ch-bg-muted: #f1f5f9;
  --ch-text:     #0f172a;
  --ch-text-soft:#64748b;
  --ch-border:   #e2e8f0;
}

/* ══════════════════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════════════════ */
:root[data-theme="dark"] {
  --ch-bg:       #0f172a;
  --ch-bg-soft:  #1e293b;
  --ch-bg-muted: #334155;
  --ch-text:     #f1f5f9;
  --ch-text-soft:#94a3b8;
  --ch-border:   #334155;
  --ch-gray-50:  #1e293b;
  --ch-gray-100: #334155;
  --ch-gray-200: #475569;
  --ch-shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --ch-shadow-md: 0 4px 6px -1px rgba(0,0,0,.5), 0 2px 4px -2px rgba(0,0,0,.3);
  --ch-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.6), 0 4px 6px -4px rgba(0,0,0,.3);
  --ch-glass-bg: rgba(30,41,59,.72);
  --ch-glass-border: rgba(148,163,184,.18);
}

/* Auto-switch si préférence système (retirer pour forcer clair/sombre) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   RESET + BASE
   ══════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--ch-font-sans);
  background: var(--ch-bg);
  color: var(--ch-text);
  transition: background-color var(--ch-dur-base) var(--ch-ease),
              color var(--ch-dur-base) var(--ch-ease);
}

/* Accessibilité : focus visible */
*:focus-visible {
  outline: 2px solid var(--ch-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════════════
   COMPOSANTS UI PREMIUM
   ══════════════════════════════════════════════════════════════════════ */

/* ─── Bouton premium ─── */
.ch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ch-sp-2);
  padding: 10px 20px;
  background: var(--ch-primary);
  color: white;
  border: none;
  border-radius: var(--ch-r-md);
  font-family: inherit;
  font-weight: 700;
  font-size: var(--ch-fs-base);
  cursor: pointer;
  transition: all var(--ch-dur-base) var(--ch-ease);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
.ch-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--ch-shadow-lg), var(--ch-shadow-glow);
}
.ch-btn:active { transform: translateY(0); }
.ch-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.2), transparent);
  opacity: 0;
  transition: opacity var(--ch-dur-base);
}
.ch-btn:hover::after { opacity: 1; }

.ch-btn--ghost {
  background: transparent;
  color: var(--ch-text);
  border: 1.5px solid var(--ch-border);
}
.ch-btn--ghost:hover {
  background: var(--ch-bg-muted);
  box-shadow: var(--ch-shadow-sm);
}
.ch-btn--coral { background: var(--ch-coral); }
.ch-btn--coral:hover { box-shadow: var(--ch-shadow-lg), var(--ch-shadow-coral-glow); }
.ch-btn--danger { background: var(--ch-danger); }
.ch-btn--lg { padding: 14px 28px; font-size: var(--ch-fs-md); }
.ch-btn--sm { padding: 6px 12px; font-size: var(--ch-fs-xs); }
.ch-btn--block { display: flex; width: 100%; }

/* ─── Card glassmorphism ─── */
.ch-card {
  background: var(--ch-bg);
  border-radius: var(--ch-r-lg);
  padding: var(--ch-sp-5);
  border: 1px solid var(--ch-border);
  box-shadow: var(--ch-shadow-sm);
  transition: box-shadow var(--ch-dur-base) var(--ch-ease),
              transform var(--ch-dur-base) var(--ch-ease);
}
.ch-card:hover {
  box-shadow: var(--ch-shadow-md);
  transform: translateY(-2px);
}
.ch-card--glass {
  background: var(--ch-glass-bg);
  backdrop-filter: var(--ch-glass-blur);
  -webkit-backdrop-filter: var(--ch-glass-blur);
  border: 1px solid var(--ch-glass-border);
}
.ch-card--gradient {
  background: linear-gradient(135deg, var(--ch-primary), var(--ch-primary-dark));
  color: white;
  border: none;
}

/* ─── Input / Form ─── */
.ch-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--ch-border);
  border-radius: var(--ch-r-md);
  font-family: inherit;
  font-size: var(--ch-fs-base);
  background: var(--ch-bg);
  color: var(--ch-text);
  transition: border-color var(--ch-dur-fast), box-shadow var(--ch-dur-fast);
}
.ch-input:focus {
  outline: none;
  border-color: var(--ch-primary);
  box-shadow: var(--ch-shadow-glow);
}
.ch-input:disabled { opacity: .6; cursor: not-allowed; }

.ch-label {
  display: block;
  font-size: var(--ch-fs-xs);
  font-weight: 600;
  color: var(--ch-text-soft);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: var(--ch-sp-1);
}

/* ─── Badge ─── */
.ch-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--ch-gray-100);
  color: var(--ch-gray-700);
  border-radius: var(--ch-r-full);
  font-size: var(--ch-fs-xs);
  font-weight: 700;
  letter-spacing: .3px;
}
.ch-badge--primary { background: #d1fae5; color: var(--ch-primary-dark); }
.ch-badge--warning { background: #fef3c7; color: #92400e; }
.ch-badge--danger  { background: #fee2e2; color: #991b1b; }
.ch-badge--info    { background: #dbeafe; color: #1e40af; }
.ch-badge--gold    { background: linear-gradient(135deg,#fbbf24,#f59e0b); color: #78350f; }
.ch-badge--premium { background: linear-gradient(135deg,#a78bfa,#7c3aed); color: white; }

/* ─── Pulse dot (live indicator) ─── */
.ch-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ch-success);
  position: relative;
  margin-right: var(--ch-sp-2);
}
.ch-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ch-success);
  animation: ch-pulse 1.8s infinite;
}
@keyframes ch-pulse {
  0%   { transform: scale(1); opacity: .9; }
  100% { transform: scale(3); opacity: 0; }
}

/* ─── Chip ─── */
.ch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--ch-gray-100);
  color: var(--ch-text);
  border-radius: var(--ch-r-full);
  font-size: var(--ch-fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ch-dur-fast);
  border: 1px solid transparent;
}
.ch-chip:hover { background: var(--ch-gray-200); }
.ch-chip--active { background: var(--ch-primary); color: white; }

/* ─── Skeleton loader ─── */
.ch-skeleton {
  background: linear-gradient(90deg, var(--ch-gray-100) 0%, var(--ch-gray-200) 50%, var(--ch-gray-100) 100%);
  background-size: 200% 100%;
  animation: ch-skeleton 1.5s infinite;
  border-radius: var(--ch-r-md);
  min-height: 14px;
}
@keyframes ch-skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Animations d'entrée ─── */
@keyframes ch-fadeIn      { from { opacity: 0; } to { opacity: 1; } }
@keyframes ch-slideUp     { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ch-slideDown   { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ch-slideLeft   { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ch-scaleIn     { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes ch-bounce      { 0%,20%,50%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-8px); } 60% { transform: translateY(-4px); } }

.ch-anim-fade     { animation: ch-fadeIn var(--ch-dur-slow) var(--ch-ease-out) both; }
.ch-anim-up       { animation: ch-slideUp var(--ch-dur-slow) var(--ch-ease-out) both; }
.ch-anim-down     { animation: ch-slideDown var(--ch-dur-slow) var(--ch-ease-out) both; }
.ch-anim-scale    { animation: ch-scaleIn var(--ch-dur-slow) var(--ch-ease-bouncy) both; }
.ch-anim-delay-1  { animation-delay: .08s; }
.ch-anim-delay-2  { animation-delay: .16s; }
.ch-anim-delay-3  { animation-delay: .24s; }
.ch-anim-delay-4  { animation-delay: .32s; }
.ch-anim-delay-5  { animation-delay: .4s; }

/* ─── Hover lift effect ─── */
.ch-lift {
  transition: transform var(--ch-dur-base) var(--ch-ease),
              box-shadow var(--ch-dur-base) var(--ch-ease);
}
.ch-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--ch-shadow-xl);
}

/* ─── Gradient text ─── */
.ch-text-gradient {
  background: linear-gradient(135deg, var(--ch-primary) 0%, var(--ch-blue) 50%, var(--ch-violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ─── Dividers ─── */
.ch-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ch-border), transparent);
  margin: var(--ch-sp-6) 0;
}

/* ─── Avatar ─── */
.ch-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ch-primary), var(--ch-blue));
  color: white;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ch-fs-sm);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ─── Grid system ─── */
.ch-grid { display: grid; gap: var(--ch-sp-4); }
.ch-grid-1 { grid-template-columns: 1fr; }
.ch-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ch-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ch-grid-4 { grid-template-columns: repeat(4, 1fr); }
.ch-grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 800px) {
  .ch-grid-2, .ch-grid-3, .ch-grid-4 { grid-template-columns: 1fr; }
}

/* ─── Utilities ─── */
.ch-flex { display: flex; }
.ch-flex-col { display: flex; flex-direction: column; }
.ch-items-center { align-items: center; }
.ch-justify-between { justify-content: space-between; }
.ch-gap-1 { gap: var(--ch-sp-1); }
.ch-gap-2 { gap: var(--ch-sp-2); }
.ch-gap-3 { gap: var(--ch-sp-3); }
.ch-gap-4 { gap: var(--ch-sp-4); }
.ch-mt-2 { margin-top: var(--ch-sp-2); }
.ch-mt-4 { margin-top: var(--ch-sp-4); }
.ch-mb-4 { margin-bottom: var(--ch-sp-4); }
.ch-w-full { width: 100%; }
.ch-rounded { border-radius: var(--ch-r-md); }
.ch-text-center { text-align: center; }
.ch-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }

/* ─── Sector accent classes ─── */
.ch-sector-drive  { --ch-primary: var(--color-drive); }
.ch-sector-resto  { --ch-primary: var(--color-resto); }
.ch-sector-tech   { --ch-primary: var(--color-tech); }
.ch-sector-beaute { --ch-primary: var(--color-beaute); }
.ch-sector-immo   { --ch-primary: var(--color-immo); }
.ch-sector-sante  { --ch-primary: var(--color-sante); }
.ch-sector-kids   { --ch-primary: var(--color-kids); }
.ch-sector-kdo    { --ch-primary: var(--color-kdo); }
.ch-sector-job    { --ch-primary: var(--color-job); }

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