/* ============================================================
   NETICMEET V3 — DESIGN SYSTEM
   Fichier central : toutes les variables, typographie, utilitaires
   Modifier ici pour impacter toute l'app
   ============================================================ */

:root {
  /* --- Couleurs principales --- */
  --bg:        #080B14;   /* Fond principal */
  --surf:      #0F1420;   /* Surface niveau 1 (sidebar, cards) */
  --surf2:     #161D2E;   /* Surface niveau 2 (inputs, hover) */
  --surf3:     #1E2740;   /* Surface niveau 3 (actif, sélectionné) */

  /* --- Bordures --- */
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --border3:   rgba(255,255,255,0.20);

  /* --- Accent principal (bleu) --- */
  --accent:    #2563EB;
  --accentH:   #1D4ED8;   /* Hover */
  --accentL:   rgba(37,99,235,0.12); /* Background léger */

  /* --- IA (violet) — couleur distinctive pour tout ce qui est IA --- */
  --ia:        #7C3AED;
  --iaH:       #6D28D9;
  --iaL:       rgba(124,58,237,0.12);
  --ia-text:   #A78BFA;

  /* --- États --- */
  --green:     #10B981;
  --greenL:    rgba(16,185,129,0.12);
  --red:       #EF4444;
  --redL:      rgba(239,68,68,0.12);
  --yellow:    #F59E0B;
  --yellowL:   rgba(245,158,11,0.12);
  --cyan:      #0891B2;
  --cyanL:     rgba(8,145,178,0.12);

  /* --- Texte --- */
  --text:      #F1F5F9;
  --text2:     #94A3B8;
  --text3:     rgba(255,255,255,0.28);

  /* --- Typographie --- */
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* --- Espacements --- */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  12px;
  --sp-lg:  16px;
  --sp-xl:  24px;
  --sp-2xl: 32px;
  --sp-3xl: 48px;

  /* --- Rayons --- */
  --r-sm:  6px;
  --r-md:  9px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-2xl: 20px;
  --r-full: 9999px;

  /* --- Ombres --- */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.5);
  --shadow-xl:  0 32px 80px rgba(0,0,0,0.6);

  /* --- Transitions --- */
  --t-fast:   0.12s ease;
  --t-normal: 0.20s ease;
  --t-slow:   0.35s ease;

  /* --- Layout --- */
  --sidebar-w:  240px;
  --topbar-h:   58px;
  --settings-w: 220px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ============================================================
   TYPOGRAPHIE
   ============================================================ */
.t-xs   { font-size: 11px; }
.t-sm   { font-size: 12px; }
.t-md   { font-size: 14px; }
.t-lg   { font-size: 16px; }
.t-xl   { font-size: 18px; }
.t-2xl  { font-size: 22px; }
.t-3xl  { font-size: 28px; }
.t-4xl  { font-size: 36px; }
.t-5xl  { font-size: 48px; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

.text-primary  { color: var(--text); }
.text-secondary{ color: var(--text2); }
.text-muted    { color: var(--text3); }
.text-accent   { color: var(--accent); }
.text-ia       { color: var(--ia-text); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-yellow   { color: var(--yellow); }

.gradient-text {
  background: linear-gradient(135deg, #60A5FA 0%, #A78BFA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-ia {
  background: linear-gradient(135deg, #A78BFA 0%, #60A5FA 50%, #34D399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  min-height: 100vh;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content {
  padding: var(--sp-xl) var(--sp-xl);
  flex: 1;
}

.content-wide  { max-width: 1200px; }
.content-mid   { max-width: 900px; }
.content-narrow{ max-width: 700px; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-lg); }

/* Flex helpers */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-xs { gap: var(--sp-xs); }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }
.gap-xl { gap: var(--sp-xl); }
.flex-1  { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }

/* ============================================================
   COMPOSANTS — BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accentH); transform: translateY(-1px); }

.btn-ia {
  background: var(--ia);
  color: #fff;
}
.btn-ia:hover { background: var(--iaH); transform: translateY(-1px); }

.btn-ghost {
  background: var(--surf2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

.btn-danger {
  background: var(--redL);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--r-lg); }
.btn-xl { padding: 14px 32px; font-size: 16px; font-weight: 700; border-radius: var(--r-lg); }
.btn-full { width: 100%; }

/* ============================================================
   COMPOSANTS — CARDS
   ============================================================ */
.card {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
}

.card:hover { border-color: var(--border2); }
.card-hover { transition: var(--t-normal); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-ia {
  background: linear-gradient(135deg, rgba(124,58,237,0.06) 0%, var(--surf) 60%);
  border-color: rgba(124,58,237,0.2);
}

.card-accent {
  background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, var(--surf) 60%);
  border-color: rgba(37,99,235,0.2);
}

/* ============================================================
   COMPOSANTS — BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
}

.badge-ia     { background: var(--iaL); color: var(--ia-text); border: 1px solid rgba(124,58,237,0.2); }
.badge-accent { background: var(--accentL); color: #60A5FA; border: 1px solid rgba(37,99,235,0.2); }
.badge-green  { background: var(--greenL); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.badge-red    { background: var(--redL); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-yellow { background: var(--yellowL); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }
.badge-gray   { background: var(--surf2); color: var(--text2); border: 1px solid var(--border); }

/* ============================================================
   COMPOSANTS — FORMULAIRES
   ============================================================ */
.field { margin-bottom: var(--sp-lg); }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.field-hint { font-size: 11px; color: var(--text3); margin-top: 5px; }
.field-error { font-size: 11px; color: var(--red); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surf2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--t-fast);
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.input::placeholder { color: var(--text3); }
.input.error { border-color: var(--red); }

.select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surf2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--t-fast);
  cursor: pointer;
}
.select:focus { border-color: var(--accent); }
.select option { background: var(--surf2); }

.textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surf2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--t-fast);
  resize: vertical;
  min-height: 80px;
}
.textarea:focus { border-color: var(--accent); }

/* Toggle */
.toggle {
  width: 40px;
  height: 22px;
  background: var(--surf3);
  border-radius: var(--r-full);
  position: relative;
  border: none;
  cursor: pointer;
  transition: var(--t-normal);
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle.ia.on { background: var(--ia); }
.toggle::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: var(--t-normal);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle.on::after { left: 21px; }

/* ============================================================
   COMPOSANTS — ALERT
   ============================================================ */
.alert {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  display: none;
  margin-bottom: var(--sp-lg);
}
.alert.show { display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--greenL); border: 1px solid rgba(16,185,129,0.25); color: var(--green); }
.alert-error   { background: var(--redL);   border: 1px solid rgba(239,68,68,0.25);  color: var(--red); }
.alert-ia      { background: var(--iaL);    border: 1px solid rgba(124,58,237,0.25); color: var(--ia-text); }

/* ============================================================
   COMPOSANTS — MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-xl);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surf);
  border: 1px solid var(--border2);
  border-radius: var(--r-2xl);
  padding: var(--sp-2xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: var(--sp-xl);
  letter-spacing: -0.3px;
}

.modal-footer {
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
  margin-top: var(--sp-xl);
}

/* ============================================================
   COMPOSANTS — TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--surf);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-xl);
  gap: var(--sp-md);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--surf2);
  border: 1px solid var(--border);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t-fast);
}
.topbar-btn:hover { color: var(--text); border-color: var(--border2); }
.topbar-btn-notif { position: relative; }
.topbar-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--surf);
}

/* ============================================================
   COMPOSANTS — SECTION HEADER
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}
.section-title { font-size: 15px; font-weight: 700; color: var(--text); }
.section-link  { font-size: 12px; color: var(--accent); font-weight: 500; cursor: pointer; }
.section-link:hover { text-decoration: underline; }

/* ============================================================
   COMPOSANTS — STAT CARDS
   ============================================================ */
.stat-card { text-align: left; }
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-md);
}
.stat-val { font-size: 28px; font-weight: 800; letter-spacing: -1px; margin-bottom: 3px; }
.stat-label { font-size: 12px; color: var(--text2); font-weight: 500; }
.stat-trend { font-size: 11px; margin-top: 5px; display: flex; align-items: center; gap: 3px; }
.stat-trend.up   { color: var(--green); }
.stat-trend.down { color: var(--red); }

/* ============================================================
   COMPOSANTS — IA SPÉCIFIQUES
   ============================================================ */

/* Badge IA flottant */
.ia-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ia);
  animation: ia-pulse 2s infinite;
}
@keyframes ia-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:.5; transform:scale(0.8); }
}

/* Carte suggestion IA */
.ia-suggestion-card {
  background: var(--surf2);
  border: none;
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text2);
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  transition: var(--t-fast);
  cursor: pointer;
}
.ia-suggestion-card:hover { background: var(--surf3); color: var(--text); }
.ia-suggestion-card svg { color: var(--ia-text); flex-shrink: 0; }

/* Bouton magique */
.btn-magic {
  background: linear-gradient(135deg, var(--ia) 0%, var(--accent) 100%);
  color: #fff;
  border: none;
  border-radius: var(--r-lg);
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  transition: var(--t-normal);
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}
.btn-magic:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(124,58,237,0.5); }

/* Chat IA */
.ia-chat-bubble {
  background: var(--iaL);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 4px;
  padding: var(--sp-md) var(--sp-lg);
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  max-width: 80%;
}

.user-chat-bubble {
  background: var(--accentL);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: var(--r-lg) var(--r-lg) 4px var(--r-lg);
  padding: var(--sp-md) var(--sp-lg);
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  max-width: 80%;
  margin-left: auto;
}

/* ============================================================
   COMPOSANTS — EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
}
.empty-state svg { color: var(--text3); margin-bottom: var(--sp-lg); }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; color: var(--text2); }

/* ============================================================
   UTILITAIRES
   ============================================================ */
.hidden   { display: none !important; }
.visible  { display: block !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider  { height: 1px; background: var(--border); margin: var(--sp-lg) 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surf3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .main { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: var(--sp-lg); }
  .field-row { grid-template-columns: 1fr; }
}
