/* =============================================================================
   public/zebdev-ui-components.css — Composants partagés Design System zebdev
   v1.69.15 — Source : norme issue du module CRM (polish Maxime mai 2026).
   À charger APRÈS zebdev-ui-tokens.css. Préfixe `.zd-` pour éviter conflits
   avec les classes module-spécifiques (.crm-*, .project-*, etc.).
   Adoption progressive : nouveaux modules / refactor de modules existants.
   ============================================================================= */

/* ============ Reset commun ============ */
.zd-reset-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ============ Buttons ============ */
.zd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--zd-gap-sm);
  height: var(--zd-size-control);
  padding: 0 var(--zd-pad-btn-x);
  background: transparent;
  color: var(--zd-text);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-md);
  font-family: var(--zd-font);
  font-size: var(--zd-fs-base);
  font-weight: var(--zd-fw-semibold);
  letter-spacing: var(--zd-letter-tight);
  cursor: pointer;
  box-sizing: border-box;
  transition: background var(--zd-transition), color var(--zd-transition), border-color var(--zd-transition);
}
.zd-btn:hover {
  background: var(--zd-bg-card-hover);
  color: var(--zd-text-strong);
}
.zd-btn:disabled,
.zd-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Variantes */
.zd-btn-ghost { /* default = .zd-btn déjà ghost */ }

.zd-btn-primary {
  background: var(--zd-primary);
  color: #ffffff;
  border-color: var(--zd-primary);
  box-shadow: 0 2px 8px var(--zd-primary-glow);
  font-weight: var(--zd-fw-bold);
}
.zd-btn-primary:hover {
  background: var(--zd-primary-hover);
  color: #ffffff;
  border-color: var(--zd-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--zd-primary-glow);
}
.zd-btn-primary:active { transform: translateY(0); }

.zd-btn-danger {
  background: transparent;
  color: var(--zd-danger);
  border-color: var(--zd-divider);
}
.zd-btn-danger:hover {
  background: var(--zd-danger-bg);
  color: var(--zd-danger);
  border-color: var(--zd-danger);
}

.zd-btn-accent {
  background: var(--zd-accent);
  color: #ffffff;
  border-color: var(--zd-accent);
  font-weight: var(--zd-fw-bold);
}
.zd-btn-accent:hover { filter: brightness(1.1); color: #ffffff; }

.zd-btn-icon {
  width: var(--zd-size-control);
  min-width: var(--zd-size-control);
  padding: 0;
}

.zd-btn-lg {
  height: var(--zd-size-control-lg);
  padding: 0 var(--zd-pad-btn-lg-x);
  font-size: var(--zd-fs-md);
}

/* ============ Button Group (style segmented PD) ============ */
.zd-btn-group {
  display: inline-flex;
  background: transparent;
  border-radius: var(--zd-radius-md);
  flex-shrink: 0;
}
.zd-btn-group > button,
.zd-btn-group > a {
  height: var(--zd-size-control);
  padding: 0 var(--zd-pad-btn-lg-x);
  background: var(--zd-bg-card);
  color: var(--zd-text-muted);
  border: 1px solid var(--zd-divider);
  border-right-width: 0;
  border-radius: 0;
  font-family: var(--zd-font);
  font-size: var(--zd-fs-sm);
  font-weight: var(--zd-fw-semibold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--zd-gap-sm);
  box-sizing: border-box;
  text-decoration: none;
  transition: background var(--zd-transition), color var(--zd-transition), border-color var(--zd-transition);
}
.zd-btn-group > *:first-child {
  border-top-left-radius: var(--zd-radius-md);
  border-bottom-left-radius: var(--zd-radius-md);
}
.zd-btn-group > *:last-child {
  border-right-width: 1px;
  border-top-right-radius: var(--zd-radius-md);
  border-bottom-right-radius: var(--zd-radius-md);
}
.zd-btn-group > *:hover {
  background: var(--zd-bg-hover-subtle);
  color: var(--zd-text-strong);
  border-color: var(--zd-divider-strong);
}
.zd-btn-group > .zd-btn-group-active,
.zd-btn-group > [aria-pressed="true"] {
  background: var(--zd-bg-active);
  color: var(--zd-text-strong);
  border-color: var(--zd-accent);
  position: relative;
  z-index: var(--zd-z-elev);
}

/* ============ Select ============ */
.zd-select {
  height: var(--zd-size-control);
  padding: 0 12px;
  background: var(--zd-bg-card);
  color: var(--zd-text);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-md);
  font-family: var(--zd-font);
  font-size: var(--zd-fs-sm);
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--zd-transition);
}
.zd-select:hover  { border-color: var(--zd-divider-strong); }
.zd-select:focus  { border-color: var(--zd-accent); box-shadow: 0 0 0 3px var(--zd-accent-soft); }

/* ============ Inputs (text/search) ============ */
.zd-input {
  height: var(--zd-size-control);
  padding: 0 12px;
  background: var(--zd-bg-card);
  color: var(--zd-text);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-md);
  font-family: var(--zd-font);
  font-size: var(--zd-fs-base);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--zd-transition), background var(--zd-transition);
}
.zd-input::placeholder { color: var(--zd-text-faint); }
.zd-input:hover { border-color: var(--zd-divider-strong); }
.zd-input:focus {
  border-color: var(--zd-accent);
  background: var(--zd-bg-card-hover);
  box-shadow: 0 0 0 3px var(--zd-accent-soft);
}

/* Variante search avec icône à gauche (le parent doit être position:relative) */
.zd-search-wrap {
  position: relative;
  flex-shrink: 1;
  min-width: 200px;
}
.zd-search-wrap .zd-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--zd-text-dim);
  pointer-events: none;
  font-size: var(--zd-fs-base);
}
.zd-search-input {
  width: 100%;
  height: var(--zd-size-control);
  padding: 0 14px 0 36px;
  background: var(--zd-bg-card);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-md);
  color: var(--zd-text);
  font-family: var(--zd-font);
  font-size: var(--zd-fs-base);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--zd-transition), background var(--zd-transition);
}
.zd-search-input::placeholder { color: var(--zd-text-faint); }
.zd-search-input:focus {
  border-color: var(--zd-accent);
  background: var(--zd-bg-card-hover);
  box-shadow: 0 0 0 3px var(--zd-accent-soft);
}

/* Variante pseudo-input qui ouvre une modale Cmd+K (look input mais c'est un button) */
.zd-search-pseudo {
  display: inline-flex;
  align-items: center;
  gap: var(--zd-gap-md);
  height: var(--zd-size-control);
  padding: 0 12px;
  background: var(--zd-bg-card);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-md);
  color: var(--zd-text-muted);
  font-family: var(--zd-font);
  font-size: var(--zd-fs-base);
  cursor: pointer;
  box-sizing: border-box;
  transition: background var(--zd-transition), border-color var(--zd-transition);
}
.zd-search-pseudo:hover { background: var(--zd-bg-card-hover); border-color: var(--zd-divider-strong); }
.zd-search-pseudo .zd-search-icon { color: var(--zd-text-dim); }
.zd-search-pseudo .zd-kbd-hint {
  margin-left: auto;
  padding: 2px 6px;
  background: var(--zd-bg-shell);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-sm);
  font-size: var(--zd-fs-xs);
  color: var(--zd-text-dim);
}

/* ============ Chip ============ */
.zd-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--zd-gap-sm);
  height: var(--zd-size-control);
  padding: 0 var(--zd-pad-chip-x);
  background: var(--zd-bg-card);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-md);
  font-family: var(--zd-font);
  font-size: var(--zd-fs-sm);
  font-weight: var(--zd-fw-semibold);
  color: var(--zd-text);
  box-sizing: border-box;
  white-space: nowrap;
}
.zd-chip-meta {
  color: var(--zd-text-dim);
  font-size: var(--zd-fs-xs);
  font-weight: var(--zd-fw-medium);
}
.zd-chip-icon {
  font-size: var(--zd-fs-sm);
  opacity: 0.85;
}

/* ============ Stats / labels mineurs ============ */
.zd-stats {
  display: inline-flex;
  align-items: center;
  height: var(--zd-size-control);
  padding: 0 4px;
  color: var(--zd-text-dim);
  font-family: var(--zd-font);
  font-size: var(--zd-fs-sm);
  font-weight: var(--zd-fw-semibold);
  font-variant-numeric: tabular-nums;
}

/* ============ Subnav layout standard ============ */
.zd-subnav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--zd-gap-lg);
  padding: var(--zd-pad-subnav);
  background: var(--zd-bg-shell);
  border-bottom: 1px solid var(--zd-bg-shell);
}
.zd-subnav > * { flex-shrink: 0; }
.zd-subnav > .zd-search-wrap { flex: 1 1 200px; max-width: 320px; min-width: 100px; }

/* ============ Kanban + chevron headers (style Pipedrive) ============ */
.zd-kanban {
  display: flex;
  gap: var(--zd-gap-xs);
  padding: var(--zd-gap-2xl) 28px 28px;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
}
.zd-kanban > .zd-col {
  flex: 1 1 0;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  background: var(--zd-bg-col);
  border-radius: var(--zd-radius-xl);
  overflow: visible;             /* ESSENTIEL pour que les ::before/::after du header dépassent */
  transition: background var(--zd-transition);
}
.zd-col-header {
  position: relative;
  height: var(--zd-size-col-header);
  padding: 0 var(--zd-gap-xl) 0 16px;
  background: var(--zd-bg-col);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border-radius: var(--zd-radius-lg);
  overflow: visible;
  transition: box-shadow var(--zd-transition);
}
.zd-col-header::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 0;
  width: 0;
  height: 0;
  border-top: 28px solid transparent;
  border-bottom: 28px solid transparent;
  border-left: 10px solid var(--zd-bg-col);
  z-index: 2;
}
.zd-col-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-top: 28px solid transparent;
  border-bottom: 28px solid transparent;
  border-left: 10px solid var(--zd-bg-shell);
  z-index: 1;
}
.zd-kanban > .zd-col:first-child .zd-col-header { padding-left: var(--zd-gap-xl); }
.zd-kanban > .zd-col:first-child .zd-col-header::before { display: none; }
.zd-kanban > .zd-col:last-child  .zd-col-header { padding-right: var(--zd-gap-xl); }
.zd-kanban > .zd-col:last-child  .zd-col-header::after  { display: none; }
.zd-col-header-scrolled {
  box-shadow: var(--zd-shadow-md);
}
.zd-col-name {
  font-size: var(--zd-fs-lg);
  font-weight: var(--zd-fw-bold);
  color: var(--zd-text-strong);
  letter-spacing: var(--zd-letter-tight);
}
.zd-col-sum {
  font-size: var(--zd-fs-sm);
  color: var(--zd-text-dim);
  font-weight: var(--zd-fw-medium);
}
.zd-col-body {
  padding: 6px 8px 16px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--zd-gap-md);
  min-height: 100px;
}

/* ============ Slide-in detail panel ============ */
.zd-detail-panel {
  position: fixed;
  top: var(--zd-size-topbar);
  right: 0;
  bottom: 0;
  width: clamp(560px, 50vw, 1100px);
  background: var(--zd-bg-panel);
  border-left: 1px solid var(--zd-divider);
  box-shadow: var(--zd-shadow-panel);
  z-index: var(--zd-z-panel);
  display: flex;
  flex-direction: column;
  color: var(--zd-text);
  font-family: var(--zd-font);
  letter-spacing: var(--zd-letter-tight);
}
.zd-detail-panel-fullscreen {
  width: 100vw !important;
  max-width: 100vw !important;
}
.zd-detail-header {
  padding: var(--zd-pad-panel-header);
  border-bottom: 1px solid var(--zd-divider);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--zd-gap-lg);
}
.zd-detail-header-top {
  display: flex;
  align-items: center;
  gap: var(--zd-gap-md);
}
.zd-detail-title {
  font-size: var(--zd-fs-xl);
  font-weight: var(--zd-fw-bold);
  color: var(--zd-text-strong);
  letter-spacing: var(--zd-letter-tight);
  line-height: 1.3;
}
.zd-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--zd-gap-2xl);
}

/* ============ Cards ============ */
.zd-card {
  background: var(--zd-bg-card);
  border: 1px solid var(--zd-divider);
  border-radius: var(--zd-radius-lg);
  padding: var(--zd-pad-card);
  transition: background var(--zd-transition), border-color var(--zd-transition), box-shadow var(--zd-transition), transform var(--zd-transition-fast);
}
.zd-card:hover {
  border-color: var(--zd-divider-strong);
  box-shadow: var(--zd-shadow-card-hover);
  transform: translateY(-1px);
}

/* ============ Status pills (segmented small) ============
   Variante stylisée de zd-btn-group, pour les status (Open/Won/Lost, etc.).
   Identique structurellement mais valeurs visuelles plus douces. */
.zd-status-pills { /* alias structurel sur .zd-btn-group */
  display: inline-flex;
  background: transparent;
  border-radius: var(--zd-radius-md);
  flex-shrink: 0;
}
.zd-status-pills > button {
  height: var(--zd-size-control);
  padding: 0 var(--zd-pad-btn-lg-x);
  background: var(--zd-bg-card);
  color: var(--zd-text-muted);
  border: 1px solid var(--zd-divider);
  border-right-width: 0;
  border-radius: 0;
  font-family: var(--zd-font);
  font-size: var(--zd-fs-sm);
  font-weight: var(--zd-fw-semibold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--zd-gap-sm);
  box-sizing: border-box;
  transition: background var(--zd-transition), color var(--zd-transition), border-color var(--zd-transition);
}
.zd-status-pills > button:first-child {
  border-top-left-radius: var(--zd-radius-md);
  border-bottom-left-radius: var(--zd-radius-md);
}
.zd-status-pills > button:last-child {
  border-right-width: 1px;
  border-top-right-radius: var(--zd-radius-md);
  border-bottom-right-radius: var(--zd-radius-md);
}
.zd-status-pills > button:hover {
  background: var(--zd-bg-hover-subtle);
  color: var(--zd-text-strong);
}
.zd-status-pills > .zd-pill-active { background: var(--zd-bg-active); color: var(--zd-text-strong); border-color: var(--zd-accent); position: relative; z-index: var(--zd-z-elev); }
.zd-status-pills > .zd-pill-open.zd-pill-active   { color: var(--zd-info);    border-color: var(--zd-info); }
.zd-status-pills > .zd-pill-won.zd-pill-active    { color: var(--zd-primary); border-color: var(--zd-primary); }
.zd-status-pills > .zd-pill-lost.zd-pill-active   { color: var(--zd-danger);  border-color: var(--zd-danger); }

/* ============ Empty state ============ */
.zd-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--zd-text-dim);
  flex: 1;
  align-self: center;
  width: 100%;
}
.zd-empty-icon {
  font-size: 56px;
  margin-bottom: var(--zd-gap-xl);
  opacity: 0.4;
}
.zd-empty-title {
  font-size: var(--zd-fs-xl);
  font-weight: var(--zd-fw-semibold);
  color: var(--zd-text-strong);
  margin-bottom: 6px;
}
.zd-empty-hint {
  font-size: var(--zd-fs-base);
  color: var(--zd-text-muted);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ============ Badges ============ */
.zd-badge {
  display: inline-block;
  padding: 1px 7px;
  background: var(--zd-bg-card);
  color: var(--zd-text-muted);
  border-radius: 10px;
  font-size: var(--zd-fs-xs);
  font-weight: var(--zd-fw-bold);
}
.zd-badge-accent { background: var(--zd-accent); color: #ffffff; }
.zd-badge-primary { background: var(--zd-primary); color: #ffffff; }
.zd-badge-danger { background: var(--zd-danger); color: #ffffff; }

/* ============ Avatar fallback (initiales) ============ */
.zd-avatar {
  width: var(--zd-size-avatar);
  height: var(--zd-size-avatar);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--zd-fs-xs);
  font-weight: var(--zd-fw-bold);
  color: #ffffff;
  flex-shrink: 0;
  background: var(--zd-bg-card);
}
.zd-avatar-empty {
  background: var(--zd-bg-card);
  color: var(--zd-text-dim);
}

/* ============ Utility — scrollbar style cohérent ============ */
.zd-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.zd-scrollbar::-webkit-scrollbar-track { background: transparent; }
.zd-scrollbar::-webkit-scrollbar-thumb {
  background: var(--zd-divider);
  border-radius: 4px;
}
.zd-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--zd-divider-strong);
}
