/* ═══════════════════════════════════════════════════════════════════════════
   FLAIR ERP — Module Styles v1.0
   Styles partagés pour tous les modules dynamiques
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Module container ────────────────────────────────────────────────────── */
.module-section {
  margin-bottom: 2rem;
  border-radius: 16px;
  overflow: hidden;
  animation: fadeUp .45s ease both;
}

.module-inner {
  padding: 1.5rem;
}

.mod-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.mod-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  padding: .45rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
}

.tab:hover   { background: rgba(124,58,237,.15); color: #a78bfa; border-color: rgba(124,58,237,.4); }
.tab.active  { background: rgba(124,58,237,.25); color: #c4b5fd; border-color: rgba(124,58,237,.6); }

/* ── Tab panels ──────────────────────────────────────────────────────────── */
.tab-panel         { display: none; }
.tab-panel.active  { display: block; animation: fadeUp .3s ease; }

/* ── KPI grid ────────────────────────────────────────────────────────────── */
.kpi-grid    { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.kpi-grid-4  { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.kpi { padding: 1.25rem 1rem; border-radius: 12px; text-align: center; }
.kpi-icon  { font-size: 1.5rem; margin-bottom: .35rem; }
.kpi-label { font-size: .75rem; color: var(--text-secondary, #94a3b8); margin-bottom: .25rem; }
.kpi-value { font-size: 1.35rem; font-weight: 700; color: var(--accent-violet, #7c3aed); }

/* ── Data table ──────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; border-radius: 10px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table th {
  padding: .65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary, #94a3b8);
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.data-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.05);
  color: var(--text-primary, #e2e8f0);
}

.data-table tr:hover td { background: rgba(124,58,237,.06); }
.data-table tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2em .65em;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-success   { background: rgba(16,185,129,.15); color: #10b981; }
.badge-danger    { background: rgba(239,68,68,.15);  color: #ef4444; }
.badge-warn      { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-primary   { background: rgba(124,58,237,.2);  color: #a78bfa; }
.badge-secondary { background: rgba(100,116,139,.15);color: #94a3b8; }
.badge-info      { background: rgba(6,182,212,.15);  color: #06b6d4; }

/* ── NOVA result ─────────────────────────────────────────────────────────── */
.nova-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 10px;
  background: rgba(124,58,237,.08);
  border: 1px solid rgba(124,58,237,.25);
  color: #c4b5fd;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .8rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* ── Module nav item ─────────────────────────────────────────────────────── */
.mod-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent-violet, #7c3aed);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 0 5px;
  margin-left: .35rem;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Module activation grid (admin/tenant) ───────────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.module-card {
  padding: 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: border-color .2s, background .2s;
}

.module-card:hover { border-color: rgba(124,58,237,.4); background: rgba(124,58,237,.06); }
.module-card.active { border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.05); }

.module-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-card-icon  { font-size: 1.5rem; }
.module-card-name  { font-weight: 600; font-size: .95rem; color: var(--text-primary, #e2e8f0); }
.module-card-desc  { font-size: .78rem; color: var(--text-secondary, #94a3b8); line-height: 1.4; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(100,116,139,.3);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: #7c3aed; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
