/* RAFFINSTOCK 6.15.0 — Styles des Simulations 3D Opérationnelles :
   1. Jaugeage Manuel au Ruban à Lest (API MPMS Ch. 3.1A / NF EN ISO 4512)
   2. Purge & Drainage d'Eau de Fond des Réservoirs + Cuvette -> Séparateur API */

.p3-ops-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 44;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #f1f5f9;
}

#parcRoot.p3-in-ops-sim .p3-top,
#parcRoot.p3-in-ops-sim .p3-tools,
#parcRoot.p3-in-ops-sim .p3-right,
#parcRoot.p3-in-ops-sim .p3-info,
#parcRoot.p3-in-ops-sim .p3-hint,
#parcRoot.p3-in-ops-sim .p3-legend,
#parcRoot.p3-in-ops-sim .p3-dt-hud,
#parcRoot.p3-in-ops-sim .p3-labels {
  display: none !important;
}

.p3-ops-top {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(8, 15, 28, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.p3-ops-top::-webkit-scrollbar { display: none; }

.p3-ops-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.p3-ops-tabs {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
}

.p3-ops-tab {
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.p3-ops-tab.on {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4);
}

.p3-ops-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.p3-ops-sel {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.p3-ops-btn {
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.p3-ops-btn:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.95);
  border-color: #38bdf8;
  color: #ffffff;
}

.p3-ops-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.p3-ops-btn.on {
  background: rgba(14, 165, 233, 0.24);
  border-color: #38bdf8;
  color: #7dd3fc;
}

.p3-ops-btn.pri {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #38bdf8;
  color: #fff;
  font-weight: 700;
}

.p3-ops-btn.ok {
  background: linear-gradient(135deg, #059669, #047857);
  border-color: #34d399;
  color: #fff;
  font-weight: 700;
}

.p3-ops-btn.warn {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: #fbbf24;
  color: #fff;
  font-weight: 700;
}

.p3-ops-btn.danger {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-color: #f87171;
  color: #fff;
  font-weight: 700;
}

.p3-ops-close {
  background: rgba(127, 29, 29, 0.72);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

/* Panneau latéral gauche : protocole pas-à-pas & commandes */
.p3-ops-left {
  position: absolute;
  top: 68px;
  left: 12px;
  bottom: 12px;
  width: 348px;
  max-width: calc(100vw - 24px);
  background: rgba(8, 15, 28, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 12px 14px;
  overflow-y: auto;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* Panneau latéral droit : loupe millimétrique / hublot visuel & calculs ASTM */
.p3-ops-right {
  position: absolute;
  top: 68px;
  right: 12px;
  bottom: 12px;
  width: 356px;
  max-width: calc(100vw - 24px);
  background: rgba(8, 15, 28, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 12px 14px;
  overflow-y: auto;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.p3-ops-sec {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 11px;
  padding: 10px 12px;
}

.p3-ops-sec h4 {
  margin: 0 0 8px 0;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.p3-ops-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p3-ops-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 12px;
  line-height: 1.35;
}

.p3-ops-step.done {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(6, 78, 59, 0.28);
}

.p3-ops-step.active {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(12, 74, 110, 0.35);
}

.p3-ops-step-num {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #334155;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.p3-ops-step.done .p3-ops-step-num {
  background: #10b981;
  color: #052e16;
}

.p3-ops-step.active .p3-ops-step-num {
  background: #38bdf8;
  color: #082f49;
}

.p3-ops-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}

.p3-ops-slider {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

.p3-ops-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.p3-ops-kpi {
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  padding: 7px 9px;
}

.p3-ops-kpi small {
  display: block;
  font-size: 10.5px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.p3-ops-kpi b {
  font-size: 14px;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.p3-ops-kpi.hi {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(12, 74, 110, 0.28);
}

.p3-ops-kpi.pink {
  border-color: rgba(236, 72, 153, 0.5);
  background: rgba(131, 24, 67, 0.25);
}

.p3-ops-alert {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.p3-ops-alert.ok {
  background: rgba(6, 78, 59, 0.55);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #a7f3d0;
}

.p3-ops-alert.warn {
  background: rgba(120, 53, 15, 0.65);
  border: 1px solid rgba(251, 191, 36, 0.6);
  color: #fde68a;
}

.p3-ops-alert.crit {
  background: rgba(127, 29, 29, 0.8);
  border: 1px solid #f87171;
  color: #fecaca;
  animation: p3OpsPulse 0.9s infinite alternate;
}

@keyframes p3OpsPulse {
  from { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
  to { box-shadow: 0 0 16px rgba(239, 68, 68, 0.55); }
}

.p3-ops-loupe-wrap {
  width: 100%;
  height: 196px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: #060d1a;
  position: relative;
}

.p3-ops-loupe-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Étiquettes 3D projetées */
.p3-ops-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.p3-ops-lbl {
  position: absolute;
  transform: translate(-50%, -100%);
  background: rgba(8, 15, 28, 0.84);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.p3-ops-lbl.warn {
  border-color: #fbbf24;
  color: #fde68a;
}

.p3-ops-lbl.pink {
  border-color: #f472b6;
  color: #fbcfe8;
}

@media (max-width: 1024px) {
  .p3-ops-left {
    width: 300px;
  }
  .p3-ops-right {
    width: 306px;
  }
}

@media (max-width: 760px) {
  .p3-ops-left {
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 42vh;
  }
  .p3-ops-right {
    display: none;
  }
  .p3-ops-ui.mob-right .p3-ops-left {
    display: none;
  }
  .p3-ops-ui.mob-right .p3-ops-right {
    display: flex;
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 44vh;
  }
}
