/* ═══════════════════════════════════════════════════════
   BUIX DESIGN SYSTEM 2026 — Components (bd-* classes)
   Violet dark premium · Outfit font
   ═══════════════════════════════════════════════════════ */

/* ── Tokens officiels ── */
:root {
  --bg-base:    #070714;
  --bg-surface: #0f1023;
  --bg-card:    #171833;

  --accent:       #7c5cff;
  --accent-hover: #6a4ee6;
  --accent-soft:  rgba(124,92,255,0.12);

  --text:     #f1f1ff;
  --text-sub: #a1a1c2;

  --border: rgba(255,255,255,0.08);

  --success: #22d3a0;
  --warning: #f59e0b;
  --danger:  #f43f5e;

  /* ── Compatibilité anciens tokens index.html ── */
  --or:          var(--accent);
  --beige:       var(--bg-surface);
  --beige-fonce: var(--bg-card);
  --anthracite:  var(--bg-base);
  --gris-clair:  var(--text-sub);
  --noir:        var(--text);

  /* Espacement strict */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Radius */
  --radius:    14px;
  --radius-sm:  8px;
  --radius-xs:  6px;
}

/* ── Body global ── */
body {
  background: var(--bg-base);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
}

/* ═══════════════════════════
   SKELETON LOADER
   ═══════════════════════════ */
@keyframes bd-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.bd-skel {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    rgba(255,255,255,0.04) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: bd-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════
   PAGE HEADER
   ═══════════════════════════ */
.bd-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-4) 0;
}
.bd-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ═══════════════════════════
   SECTION TITLE
   ═══════════════════════════ */
.bd-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-sub);
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  opacity: 0.65;
}

/* ═══════════════════════════
   STATS / KPI GRID
   ═══════════════════════════ */
.bd-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  padding: var(--sp-4);
}
.bd-stats-2 { grid-template-columns: repeat(2, 1fr); }
.bd-stats-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 640px) {
  .bd-stats-3 { grid-template-columns: repeat(2, 1fr); }
}

.bd-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px var(--sp-4);
  cursor: default;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.bd-stat.clickable { cursor: pointer; }
.bd-stat.clickable:hover {
  border-color: rgba(124,92,255,0.3);
  transform: translateY(-1px);
}

.bd-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  margin-bottom: var(--sp-2);
  opacity: 0.7;
}
.bd-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.bd-stat-value.accent  { color: var(--accent); }
.bd-stat-value.success { color: var(--success); }
.bd-stat-value.warning { color: var(--warning); }
.bd-stat-value.danger  { color: var(--danger); }

.bd-stat-sub {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: var(--sp-1);
  opacity: 0.6;
}

/* ═══════════════════════════
   FILTERS + SEARCH
   ═══════════════════════════ */
.bd-filters {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  flex-wrap: wrap;
}

.bd-filter-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  transition: all 0.15s;
  font-family: 'Outfit', sans-serif;
}
.bd-filter-pill:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.18);
}
.bd-filter-pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(124,92,255,0.35);
}

.bd-search {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: var(--sp-2) 14px;
  font-size: 13px;
  font-family: 'Outfit', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  min-width: 180px;
}
.bd-search:focus { border-color: rgba(124,92,255,0.4); }

/* ═══════════════════════════
   TABLE
   ═══════════════════════════ */
.bd-table-wrap { padding-bottom: 80px; }

.bd-table {
  width: 100%;
  border-collapse: collapse;
}
.bd-table thead th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  padding: 10px var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-surface);
  opacity: 0.7;
}
.bd-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  cursor: pointer;
}
.bd-table tbody tr:hover { background: rgba(124,92,255,0.04); }
.bd-table tbody td {
  padding: 13px var(--sp-4);
  font-size: 13px;
  color: var(--text);
}
.td-num  { color: var(--accent); font-weight: 600; font-size: 12px; }
.td-main { font-weight: 500; }
.td-sub  { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.td-amt  { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════
   BADGES
   ═══════════════════════════ */
.bd-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.bd-badge-success { background: rgba(34,211,160,0.12);  color: var(--success); }
.bd-badge-warning { background: rgba(245,158,11,0.12);  color: var(--warning); }
.bd-badge-danger  { background: rgba(244,63,94,0.12);   color: var(--danger);  }
.bd-badge-accent  { background: var(--accent-soft);     color: var(--accent);  }
.bd-badge-neutral { background: rgba(255,255,255,0.06); color: var(--text-sub);}

/* ═══════════════════════════
   BOTTOM BAR (fixed)
   ═══════════════════════════ */
.bd-bottom-bar {
  position: fixed;
  bottom: 56px;
  left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 40;
}
.bd-bottom-bar-left  { font-size: 13px; color: var(--text-sub); }
.bd-bottom-bar-right { display: flex; align-items: center; gap: var(--sp-3); }
.bd-bottom-bar-total { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ═══════════════════════════
   CARD (bd-card)
   ═══════════════════════════ */
.bd-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin: 0 var(--sp-4) var(--sp-3);
}
.bd-card-accent  { border-left: 3px solid var(--accent); }
.bd-card-success { border-left: 3px solid var(--success); }
.bd-card-warning { border-left: 3px solid var(--warning); }
.bd-card-danger  { border-left: 3px solid var(--danger); }

/* ═══════════════════════════
   FORM FIELDS (bd-*)
   ═══════════════════════════ */
.bd-form-group { margin-bottom: 14px; }

.bd-form-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-sub);
  margin-bottom: var(--sp-2);
  opacity: 0.7;
}
.bd-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 13px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bd-input:focus {
  border-color: rgba(124,92,255,0.45);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.08);
}

/* ═══════════════════════════
   INFO BOX
   ═══════════════════════════ */
.bd-info-box {
  background: var(--accent-soft);
  border: 1px solid rgba(124,92,255,0.2);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) 14px;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
  margin: 0 var(--sp-4) var(--sp-3);
}

/* ═══════════════════════════
   BUTTONS — 4 variantes STRICT
   ═══════════════════════════ */
.bd-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 18px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.bd-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* Primary — gradient violet */
.bd-btn-primary {
  background: linear-gradient(135deg, #7c5cff 0%, #5b3fff 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(124,92,255,0.28);
}
.bd-btn-primary:hover {
  box-shadow: 0 6px 24px rgba(124,92,255,0.45);
  transform: translateY(-1px);
}

/* Secondary — dark + border */
.bd-btn-secondary {
  background: var(--bg-card);
  color: var(--text-sub);
  border: 1px solid var(--border);
}
.bd-btn-secondary:hover {
  color: var(--text);
  border-color: rgba(124,92,255,0.25);
  background: var(--bg-surface);
}

/* Ghost — transparent */
.bd-btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid transparent;
}
.bd-btn-ghost:hover {
  background: var(--accent-soft);
  border-color: rgba(124,92,255,0.2);
}

/* Danger — red soft */
.bd-btn-danger {
  background: rgba(244,63,94,0.1);
  color: var(--danger);
  border: 1px solid rgba(244,63,94,0.2);
}
.bd-btn-danger:hover { background: rgba(244,63,94,0.18); }

/* Tailles */
.bd-btn-sm { padding: 5px 12px; font-size: 12px; }
.bd-btn-lg { padding: 13px 24px; font-size: 14px; }

/* ═══════════════════════════
   SUBNAV PILLS
   ═══════════════════════════ */
.bd-subnav {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.bd-subnav::-webkit-scrollbar { display: none; }

.bd-subnav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  white-space: nowrap;
  font-family: 'Outfit', sans-serif;
}
.bd-subnav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.bd-subnav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ═══════════════════════════
   GPS MAP
   ═══════════════════════════ */
.bd-map {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-card);
}

/* ═══════════════════════════
   PLAN — PIECE CARD
   Format :
   Nom pièce
   56.35 m²  75.25 m²  30.1 ml
   Sol       Murs      Périmètre
   7.00 × 8.05 m
   ═══════════════════════════ */
.plan-piece-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin-bottom: var(--sp-2);
  transition: border-color 0.15s;
}
.plan-piece-card:hover {
  border-color: rgba(124,92,255,0.3);
}
.plan-piece-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.plan-piece-name::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.plan-piece-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.plan-piece-metric {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px var(--sp-3);
  text-align: center;
}
.plan-piece-metric-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.plan-piece-metric-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--sp-1);
  opacity: 0.65;
}
.plan-piece-dims {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
}
.plan-piece-dims-icon { opacity: 0.45; flex-shrink: 0; }
.plan-piece-dims-val  { font-weight: 600; color: var(--text-sub); }

/* ═══════════════════════════
   RESPONSIVE
   ═══════════════════════════ */
@media (max-width: 640px) {
  .bd-col-hide-mobile { display: none !important; }
  .bd-bottom-bar { bottom: 56px; padding: 10px var(--sp-3); }
  .plan-piece-metrics { gap: var(--sp-1); }
  .plan-piece-metric-val { font-size: 15px; }
}

/* ═══════════════════════════════════════════════════════
   UTILITAIRES — Générés depuis inventaire style=""
   Règle : ≥ 3 occurrences · préfixe bd- · aucune logique
   ═══════════════════════════════════════════════════════ */

/* ── GROUPE B — Flex ── */
.bd-f1            { flex: 1; }
.bd-f1-min        { flex: 1; min-width: 0; }
.bd-f2            { flex: 2; }
.bd-shrink-0      { flex-shrink: 0; }

.bd-flex-g2       { display: flex; gap: var(--sp-2); }
.bd-flex-g6       { display: flex; gap: 6px; }
.bd-flex-g10      { display: flex; gap: 10px; }

.bd-flex-center   { display: flex; align-items: center; gap: var(--sp-2); }
.bd-flex-wrap     { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.bd-flex-center-wrap { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.bd-flex-between  { display: flex; justify-content: space-between; align-items: center; }
.bd-flex-between-start { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2); }

.bd-flex-g10-mt4  { display: flex; gap: 10px; margin-top: var(--sp-4); }
.bd-flex-end-mt4  { display: flex; gap: 10px; justify-content: flex-end; margin-top: var(--sp-4); }
.bd-flex-center-full { width: 100%; display: flex; align-items: center; justify-content: center; gap: var(--sp-2); }

/* ── GROUPE C — Icônes SVG inline ── */
.bd-icon-r3 { vertical-align: -2px; margin-right: 3px; }
.bd-icon-r4 { vertical-align: -2px; margin-right: 4px; }
.bd-icon-r5 { vertical-align: -2px; margin-right: 5px; }
.bd-icon-r6 { vertical-align: -2px; margin-right: 6px; }

/* ── GROUPE D — Empty states ── */
.bd-empty    { text-align: center; padding: 40px; color: var(--gris-clair); font-size: 13px; }
.bd-empty-sm { text-align: center; padding: 30px; color: var(--gris-clair); font-size: 13px; }

/* ── GROUPE E — Typography ── */
.bd-text-xs         { font-size: 11px; }
.bd-text-sm         { font-size: 12px; }
.bd-fw-600          { font-weight: 600; }
.bd-fw-700          { font-weight: 700; }
.bd-text-600        { font-size: 13px; font-weight: 600; }
.bd-text-strong     { font-size: 13px; font-weight: 700; color: var(--noir); }
.bd-text-h2         { font-size: 22px; font-weight: 700; color: var(--noir); }
.bd-text-danger     { color: var(--rouge); }

.bd-text-muted      { font-size: 13px; color: var(--gris-clair); }
.bd-text-sm-muted   { font-size: 12px; color: var(--gris-clair); }
.bd-text-sm-semi    { font-size: 12px; font-weight: 600; color: var(--gris-clair); }
.bd-text-xs-muted   { font-size: 11px; color: var(--gris-clair); }
.bd-text-xs-muted-mt { font-size: 11px; color: var(--gris-clair); margin-top: var(--sp-1); }
.bd-text-xs-muted-b  { font-size: 11px; color: var(--gris-clair); display: block; margin-bottom: var(--sp-1); }

/* ── GROUPE H — Spacing ── */
.bd-p-0   { padding: 0; }
.bd-p-2   { padding: var(--sp-2); }
.bd-px-4  { padding: 0 var(--sp-4); }

.bd-mt-1  { margin-top: var(--sp-1); }
.bd-mt-3  { margin-top: var(--sp-3); }
.bd-mt-4  { margin-top: var(--sp-4); }

.bd-mb-2  { margin-bottom: var(--sp-2); }
.bd-mb-3  { margin-bottom: var(--sp-3); }
.bd-mb-4  { margin-bottom: var(--sp-4); }
.bd-mb-5  { margin-bottom: var(--sp-5); }

/* ── GROUPE I — Grid ── */
.bd-col-full { grid-column: 1 / -1; }
.bd-grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

/* ── Touch : désactiver :hover sur écrans tactiles ── */
@media(hover:none) {
  .bd-stat.clickable:hover,
  .bd-filter-pill:hover,
  .bd-table tbody tr:hover,
  .bd-btn-primary:hover,
  .bd-btn-secondary:hover,
  .bd-btn-ghost:hover,
  .bd-btn-danger:hover,
  .bd-subnav-item:hover,
  .plan-piece-card:hover { all: unset; }

  .bd-btn-primary:active,
  .bd-btn-secondary:active,
  .bd-btn-ghost:active,
  .bd-btn-danger:active,
  .bd-stat.clickable:active,
  .plan-piece-card:active { opacity: 0.65; transition: opacity 0.05s; }
}
