/* ============================================================================
 * RAFFINSTOCK v5.1.0 — PARC 3D · INSPECTEUR EXPERT DES TOITS DE RÉSERVOIRS
 * Interface plein écran épurée, sans surcharge d'étiquettes, responsive
 * ============================================================================ */

.p3r-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  background: #07101f;
  color: #e2e8f0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.p3r-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #1e3a5f, #07101f 75%);
}

.p3r-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.p3r-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

/* ── Barre supérieure Glass ──────────────────────────────────────────────── */
.p3r-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(11, 18, 32, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
}

.p3r-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.p3r-brand > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.p3r-brand strong {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p3r-brand small {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p3r-top-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.p3r-btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.88);
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.12s;
  white-space: nowrap;
}

.p3r-btn:hover {
  background: rgba(51, 65, 85, 0.96);
  border-color: rgba(56, 189, 248, 0.65);
}

.p3r-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-color: #38bdf8;
  color: #fff;
}

.p3r-btn.primary {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}

/* ── Tooltip discret au survol ───────────────────────────────────────────── */
.p3r-hover-tip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  font-size: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p3r-hover-tip[hidden] {
  display: none;
}

.p3r-hover-tip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.p3r-hover-tip small {
  color: #94a3b8;
  font-size: 11px;
}

/* ── Barre d'animation (Mode Fonctionnement & Technique) ─────────────────── */
.p3r-anim-bar {
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(11, 18, 32, 0.90);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(249, 115, 22, 0.45);
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.55);
  max-width: calc(100% - 24px);
}
.p3r-anim-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.p3r-lvl-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 11.5px;
  color: #cbd5e1;
}
.p3r-lvl-wrap input[type="range"] {
  width: 96px;
  accent-color: #38bdf8;
  cursor: pointer;
}
.p3r-lvl-wrap b {
  color: #7dd3fc;
  min-width: 34px;
  text-align: right;
}
.p3r-pos-live {
  font-size: 11.5px;
  color: #86efac;
  background: rgba(22, 163, 74, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  text-align: center;
}
.p3r-pos-live.warn {
  color: #fde047;
  background: rgba(234, 179, 8, 0.16);
  border-color: rgba(250, 204, 21, 0.45);
}
.p3r-pos-live.landed {
  color: #fdba74;
  background: rgba(234, 88, 12, 0.22);
  border-color: rgba(249, 115, 22, 0.65);
}

.p3r-anim-bar[hidden] {
  display: none;
}

.p3r-anim-lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: #fdba74;
  margin-right: 4px;
}

.p3r-chip {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.p3r-chip:hover {
  border-color: #38bdf8;
  color: #fff;
}

.p3r-chip.on {
  background: #f97316;
  border-color: #fdba74;
  color: #fff;
}

/* ── Bandeau marche libre ────────────────────────────────────────────────── */
.p3r-walk-hud {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(14, 116, 144, 0.9);
  border: 1px solid rgba(103, 232, 249, 0.55);
  color: #f0fdfa;
  font-size: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  max-width: calc(100% - 24px);
  text-align: center;
}

.p3r-walk-hud[hidden] {
  display: none;
}

/* ── Dock inférieur des 5 modes de formation ─────────────────────────────── */
.p3r-modes {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(11, 18, 32, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.55);
  max-width: calc(100% - 20px);
  overflow-x: auto;
}

.p3r-mbtn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}

.p3r-mbtn:hover {
  background: rgba(51, 65, 85, 0.65);
  color: #fff;
}

.p3r-mbtn.active {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border-color: rgba(186, 230, 253, 0.5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

/* ── Panneau latéral droit (Liste, Recherche, Filtres, Légende & Fiche 12) ─ */
.p3r-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0b1220;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.p3r-side-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: #0f172a;
}

.p3r-search {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #1e293b;
  color: #f8fafc;
  font-size: 12.5px;
  outline: none;
}

.p3r-search:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.p3r-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.p3r-cpill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.75);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.p3r-cpill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.p3r-cpill.on {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: #fff;
}

.p3r-side-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.p3r-legend {
  padding: 10px 11px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.p3r-leg-t {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 7px;
}

.p3r-leg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  font-size: 11px;
  color: #cbd5e1;
}

.p3r-leg-grid span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.p3r-leg-grid i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.p3r-insp-box {
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 12px;
  color: #fef3c7;
}

.p3r-insp-box p {
  margin: 4px 0 0;
  color: #fde68a;
  line-height: 1.45;
}

.p3r-eq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p3r-eq-item {
  appearance: none;
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(30, 41, 59, 0.55);
  color: #f1f5f9;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.p3r-eq-item:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.5);
}

.p3r-eq-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.p3r-eq-item b {
  display: block;
  font-size: 12.5px;
  line-height: 1.3;
  color: #f8fafc;
}

.p3r-eq-item small {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.p3r-eq-item i {
  font-style: normal;
  color: #64748b;
  font-size: 13px;
}

.p3r-empty {
  padding: 18px;
  text-align: center;
  font-size: 12.5px;
  color: #94a3b8;
}

/* ── Fiche technique 12 rubriques ────────────────────────────────────────── */
.p3r-back-list {
  appearance: none;
  align-self: flex-start;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.85);
  color: #bae6fd;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
}

.p3r-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p3r-eq-hd h3 {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.35;
  color: #f8fafc;
}

.p3r-cat-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.p3r-tank-spec {
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.35);
  font-size: 11.5px;
  line-height: 1.45;
  color: #dbeafe;
}

.p3r-tank-spec b {
  display: block;
  color: #93c5fd;
  margin-bottom: 2px;
}

.p3r-ped-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-top: 2px;
}

.p3r-kv {
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 12px;
  line-height: 1.5;
  color: #e2e8f0;
}

.p3r-kv b {
  color: #38bdf8;
}

.p3r-kv.warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.32);
}

.p3r-kv.warn b {
  color: #fbbf24;
}

.p3r-kv.bad {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.32);
}

.p3r-kv.bad b {
  color: #f87171;
}

.p3r-kv.ok {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.32);
}

.p3r-kv.ok b {
  color: #4ade80;
}

.p3r-svg-box {
  margin-top: 7px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.p3r-svg-box svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Responsive tablette & mobile ────────────────────────────────────────── */
@media (max-width: 960px) {
  .p3r-overlay {
    grid-template-columns: 1fr;
    grid-template-rows: 58vh 42vh;
  }

  .p3r-side {
    border-left: none;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
  }

  .p3r-top {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 8px 10px;
  }

  .p3r-anim-bar {
    bottom: 60px;
    padding: 6px 8px;
  }

  .p3r-modes {
    bottom: 8px;
    padding: 4px;
  }

  .p3r-mbtn {
    font-size: 11px;
    padding: 6px 9px;
  }
}
