/* ================================================================
 * ProVsup Design System — pv-faults.css
 * Panneau Défauts — glisse depuis la navbar, style sombre.
 *
 * Classes :
 *   .pv-faults-overlay / --visible
 *   .pv-faults-panel   / --open
 *   .pv-faults-header, .pv-faults-title, .pv-faults-close
 *   .pv-faults-body
 *   .pv-faults-list, .pv-faults-table
 *   .pv-fault-row--active, .pv-fault-row--falled
 *   .pv-fault-debug
 *   .pv-faults-empty
 *   .pv-analyse-card, .pv-analyse-label, .pv-analyse-stats
 *   .pv-analyse-stat--active, --falled
 *   .pv-analyse-chart-wrap, .pv-analyse-percent-text
 *   .pv-analyse-sep
 *   .pv-analyse-freq, .pv-analyse-freq-item
 *   .pv-analyse-actions, .pv-analyse-btn--acquit, --horn
 * ================================================================ */


/* ── Overlay ────────────────────────────────────────────────────── */

.pv-theme .pv-faults-overlay {
  position: fixed;
  top: var(--cmdbar-h);
  left: 0; right: 0; bottom: 0;
  background: oklch(0 0 0 / 0.45);
  z-index: 1019;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  cursor: pointer;
}

.pv-theme .pv-faults-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}


/* ── Panneau ────────────────────────────────────────────────────── */

.pv-theme .pv-faults-panel {
  position: fixed;
  top: var(--cmdbar-h);
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1020;
  background: var(--cmd-bg);
  border-bottom: 1px solid oklch(1 0 0 / 0.09);
  box-shadow: 0 12px 48px oklch(0 0 0 / 0.55);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--cmdbar-h) - 24px);
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.22s ease;
}

.pv-theme .pv-faults-panel--open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}


/* ── En-tête ────────────────────────────────────────────────────── */

.pv-theme .pv-faults-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 46px;
  flex: none;
  border-bottom: 1px solid oklch(1 0 0 / 0.08);
}

.pv-theme .pv-faults-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--cmd-fg);
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

.pv-theme .pv-faults-title > i {
  color: oklch(0.74 0.22 15);
  font-size: 14px;
}

.pv-theme .pv-faults-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  color: oklch(1 0 0 / 0.40);
  cursor: pointer;
  transition: background 0.13s, color 0.13s;
  font-size: 13px;
  padding: 0;
  line-height: 1;
}

.pv-theme .pv-faults-close:hover {
  background: oklch(1 0 0 / 0.08);
  color: var(--cmd-fg);
}


/* ── Corps : liste + analyse ────────────────────────────────────── */

.pv-theme .pv-faults-body {
  display: flex;
  flex: 1;
  min-height: 0;
}


/* ── Zone liste ─────────────────────────────────────────────────── */

.pv-theme .pv-faults-list {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: oklch(1 0 0 / 0.15) transparent;
}

.pv-theme .pv-faults-list::-webkit-scrollbar { width: 4px; }

.pv-theme .pv-faults-list::-webkit-scrollbar-thumb {
  background: oklch(1 0 0 / 0.15);
  border-radius: 2px;
}

.pv-theme .pv-faults-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 12.5px;
}

.pv-theme .pv-faults-table thead th {
  padding: 8px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: oklch(1 0 0 / 0.32);
  border-bottom: 1px solid oklch(1 0 0 / 0.08);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--cmd-bg);
  z-index: 1;
}

.pv-theme .pv-faults-table tbody tr {
  border-bottom: 1px solid oklch(1 0 0 / 0.05);
  transition: background 0.10s;
}

.pv-theme .pv-faults-table tbody tr:nth-child(even) {
  background: oklch(1 0 0 / 0.03);
}

.pv-theme .pv-faults-table tbody tr:hover {
  background: oklch(1 0 0 / 0.07);
}

.pv-theme .pv-faults-table td {
  padding: 9px 12px;
  color: oklch(1 0 0 / 0.78);
  vertical-align: middle;
  line-height: 1.35;
}

/* Ligne active */
.pv-theme .pv-fault-row--active td:first-child {
  border-left: 3px solid oklch(0.72 0.22 15);
  padding-left: 9px;
}

.pv-theme .pv-fault-row--active td:nth-child(2) {
  color: oklch(1 0 0 / 0.90);
  font-weight: 500;
}

.pv-theme .pv-fault-row--active td:first-child {
  color: oklch(0.88 0.14 15);
}

/* Ligne retombée */
.pv-theme .pv-fault-row--falled td:first-child {
  border-left: 3px solid oklch(1 0 0 / 0.12);
  padding-left: 9px;
}

.pv-theme .pv-fault-row--falled td {
  color: oklch(1 0 0 / 0.42);
}

/* Lien équipement */
.pv-theme .pv-faults-table .clickable {
  cursor: pointer;
  transition: color 0.12s;
}

.pv-theme .pv-fault-row--active .clickable:hover {
  color: var(--accent);
}

/* Préfixe debug */
.pv-theme .pv-fault-debug {
  font-family: var(--font-mono);
  font-size: 10px;
  color: oklch(0.65 0.20 300 / 0.55);
  margin-right: 3px;
}

/* État vide */
.pv-theme .pv-faults-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 56px 24px;
  font-family: var(--font-ui);
  text-align: center;
}

.pv-theme .pv-faults-empty > i {
  font-size: 42px;
  color: oklch(0.68 0.18 145);
  margin-bottom: 6px;
}

.pv-theme .pv-faults-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: oklch(1 0 0 / 0.78);
  letter-spacing: 0.01em;
}

.pv-theme .pv-faults-empty-sub {
  font-size: 12px;
  color: oklch(1 0 0 / 0.32);
}


/* ── Carte Analyse ──────────────────────────────────────────────── */

.pv-theme .pv-analyse-card {
  flex: none;
  width: 230px;
  background: oklch(1 0 0 / 0.05);
  border-left: 1px solid oklch(1 0 0 / 0.08);
  border-radius: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.pv-theme .pv-analyse-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: oklch(1 0 0 / 0.28);
  font-family: var(--font-ui);
  margin: 0;
}

/* Stats */
.pv-theme .pv-analyse-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pv-theme .pv-analyse-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-family: var(--font-ui);
  font-weight: 500;
}

.pv-theme .pv-analyse-stat i {
  font-size: 8px;
  flex: none;
}

.pv-theme .pv-analyse-stat--active {
  color: oklch(0.90 0.13 15);
}

.pv-theme .pv-analyse-stat--active i {
  color: oklch(0.74 0.22 15);
}

.pv-theme .pv-analyse-stat--falled {
  color: oklch(1 0 0 / 0.35);
}

.pv-theme .pv-analyse-stat--falled i {
  color: oklch(1 0 0 / 0.22);
}

/* Donut */
.pv-theme .pv-analyse-chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pv-theme .pv-analyse-percent-text {
  font-size: 11px;
  color: oklch(1 0 0 / 0.40);
  font-family: var(--font-ui);
  text-align: center;
  line-height: 1.45;
  margin: 0;
}

.pv-theme .pv-analyse-percent-text strong {
  color: oklch(1 0 0 / 0.70);
}

/* Séparateur */
.pv-theme .pv-analyse-sep {
  height: 1px;
  background: oklch(1 0 0 / 0.07);
  margin: 0 -2px;
}

/* Fréquences */
.pv-theme .pv-analyse-freq {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pv-theme .pv-analyse-freq-block {
  font-size: 11px;
  color: oklch(1 0 0 / 0.38);
  font-family: var(--font-ui);
  line-height: 1.5;
}

.pv-theme .pv-analyse-freq-block strong {
  color: oklch(1 0 0 / 0.72);
  font-weight: 600;
  display: block;
}

.pv-theme .pv-analyse-freq-toggle {
  background: none;
  border: 1px solid oklch(1 0 0 / 0.12);
  border-radius: var(--r-sm);
  color: oklch(1 0 0 / 0.40);
  font-size: 10.5px;
  font-family: var(--font-ui);
  cursor: pointer;
  padding: 3px 8px;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}

.pv-theme .pv-analyse-freq-toggle:hover {
  background: oklch(1 0 0 / 0.07);
  color: oklch(1 0 0 / 0.70);
}

/* Boutons */
.pv-theme .pv-analyse-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pv-theme .pv-analyse-actions .pv-btn {
  width: 100%;
}

/* Séparateur qui pousse les actions en bas de la carte */
.pv-theme .pv-analyse-sep--push {
  margin-top: auto;
}

/* Texte centré du donut (override Bootstrap dark colors) */
.pv-theme .pv-chart-text {
  color: oklch(1 0 0 / 0.85) !important;
}

/* Icône check dans le donut état OK */
.pv-theme .pv-chart-ok {
  font-size: 22px;
  color: oklch(0.70 0.20 145) !important;
}
