/* ============================================================
   popups.css — kit de fenêtres flottantes « verre sombre premium »
   Portée volontairement restreinte : tout est préfixé .pw / .lv / .cam
   Aucun sélecteur .win n'est redéfini ici.
   ============================================================ */

:root {
  --pw-bg: rgba(14, 18, 26, .78);
  --pw-line: rgba(140, 160, 200, .18);
  --pw-acc: #3ee0c4;
  --pw-acc2: #8b5cf6;
  --pw-txt: #eaf0f8;
  --pw-dim: #8592a8;
}

/* ---------- fenêtre ---------- */
.pw {
  position: fixed;
  left: 90px;
  top: 78px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  min-width: 340px;
  min-height: 240px;
  border-radius: 18px;
  overflow: hidden;
  color: var(--pw-txt);
  background:
    linear-gradient(168deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 46%),
    var(--pw-bg);
  border: 1px solid var(--pw-line);
  box-shadow:
    0 30px 80px -24px #000,
    0 12px 34px rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 255, 255, .09);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  animation: pw-in .2s cubic-bezier(.2, .9, .25, 1);
  font: 12px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@keyframes pw-in {
  from { opacity: 0; transform: scale(.968) translateY(8px) }
}

.pw.foc {
  border-color: rgba(62, 224, 196, .42);
  box-shadow:
    0 34px 90px -24px #000,
    0 0 0 1px rgba(62, 224, 196, .18),
    0 0 52px rgba(62, 224, 196, .16),
    inset 0 1px 0 rgba(255, 255, 255, .12);
}

.pw.gone {
  animation: pw-out .15s ease-in forwards;
}

@keyframes pw-out {
  to { opacity: 0; transform: scale(.97) }
}

/* ---------- barre de titre ---------- */
.pw-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  flex: none;
  padding: 0 7px 0 12px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  border-bottom: 1px solid var(--pw-line);
  background: linear-gradient(rgba(255, 255, 255, .07), rgba(255, 255, 255, .012));
}

.pw-bar:active { cursor: grabbing }

.pw-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--pw-acc);
  box-shadow: 0 0 0 3px rgba(62, 224, 196, .13), 0 0 10px rgba(62, 224, 196, .55);
}

.pw-dot.off {
  background: var(--pw-dim);
  box-shadow: 0 0 0 3px rgba(140, 160, 200, .1);
}

.pw-tt {
  flex: 1;
  min-width: 0;
}

.pw-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pw-sub {
  display: block;
  font-size: 10px;
  color: var(--pw-dim);
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pw-bar button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: #cfd7e4;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}

.pw-bar button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pw-bar button:hover {
  background: rgba(255, 255, 255, .13);
  color: #fff;
}

.pw-bar button[data-a="close"]:hover {
  background: rgba(255, 93, 108, .88);
  border-color: rgba(255, 140, 150, .5);
}

/* ---------- corps ---------- */
.pw-body {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.pw.mini { height: auto !important }
.pw.mini .pw-body { display: none }
.pw.mini .pw-rs,
.pw.mini .pw-er,
.pw.mini .pw-eb { display: none }

/* ---------- poignées ---------- */
.pw-rz {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  width: 17px;
  height: 17px;
  cursor: nwse-resize;
  touch-action: none;
}

.pw-rz::after,
.pw-rz::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid rgba(200, 214, 235, .38);
  border-bottom: 1.6px solid rgba(200, 214, 235, .38);
}

.pw-rz::before {
  right: 8px;
  bottom: 8px;
  width: 4px;
  height: 4px;
  opacity: .55;
}

.pw-er,
.pw-eb {
  position: absolute;
  z-index: 3;
  touch-action: none;
}

.pw-er {
  top: 40px;
  right: 0;
  bottom: 14px;
  width: 6px;
  cursor: ew-resize;
}

.pw-eb {
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 6px;
  cursor: ns-resize;
}

/* ---------- contrôles génériques ---------- */
.pw-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--pw-line);
  background: rgba(255, 255, 255, .05);
  color: var(--pw-txt);
  font: 600 11.5px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: .14s;
  white-space: nowrap;
}

.pw-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pw-btn:hover {
  border-color: rgba(62, 224, 196, .45);
  background: rgba(62, 224, 196, .1);
}

.pw-btn.acc {
  border-color: transparent;
  background: linear-gradient(150deg, var(--pw-acc), #1d9c88);
  color: #04211c;
  box-shadow: 0 4px 14px rgba(62, 224, 196, .28);
}

.pw-btn.danger {
  border-color: rgba(255, 93, 108, .32);
  color: #ffd6da;
}

.pw-btn.danger:hover {
  background: rgba(255, 93, 108, .18);
  border-color: rgba(255, 93, 108, .6);
}

.pw-btn:disabled {
  opacity: .4;
  cursor: default;
  box-shadow: none;
}

.pw-range {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(62, 224, 196, .55), rgba(139, 92, 246, .45));
  outline: none;
  cursor: pointer;
}

.pw-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f2f7ff;
  border: 2px solid #10c2a5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
  cursor: grab;
}

.pw-range::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid #10c2a5;
  border-radius: 50%;
  background: #f2f7ff;
}

/* ============================================================
   live screen
   ============================================================ */
.lv {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.lv-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: none;
  width: 42px;
  padding: 8px 6px;
  overflow-y: auto;
  border-right: 1px solid var(--pw-line);
  background: rgba(255, 255, 255, .028);
  scrollbar-width: thin;
}

.lv-rail button {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 29px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
  color: #b9c4d6;
  cursor: pointer;
  transition: .13s;
}

.lv-rail button svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lv-rail button:hover {
  background: rgba(62, 224, 196, .16);
  border-color: rgba(62, 224, 196, .45);
  color: #eafffb;
}

.lv-rail button.on {
  background: linear-gradient(150deg, var(--pw-acc), #17a98f);
  border-color: transparent;
  color: #04211c;
  box-shadow: 0 3px 10px rgba(62, 224, 196, .3);
}

.lv-rail .sep {
  flex: none;
  height: 1px;
  margin: 3px 2px;
  background: rgba(255, 255, 255, .08);
}

.lv-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.lv-view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #131926, #05070b 78%);
  touch-action: none;
}

.lv-view img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: crosshair;
  user-select: none;
  -webkit-user-drag: none;
}

.lv-view img.vide { visibility: hidden }

.lv-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #000;
  opacity: 0;
  transition: opacity .18s;
}

.lv-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .58);
  border: 1px solid rgba(255, 255, 255, .08);
  color: #93a0b4;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}

.lv-bandeau {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 7px 9px;
  border-top: 1px solid var(--pw-line);
  background: rgba(255, 255, 255, .03);
}

.lv-bandeau .pw-btn {
  padding: 6px 9px;
  font-size: 11px;
}

.lv-bandeau .pw-range {
  flex: 1;
  min-width: 60px;
}

.lv-alpha {
  flex: none;
  width: 30px;
  text-align: right;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--pw-dim);
}

/* ============================================================
   caméra
   ============================================================ */
.cam {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.cam-view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #141a27, #05070b 80%);
}

.cam-view img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity .2s;
}

.cam-view img.mirror { transform: scaleX(-1) }
.cam-view img.vide { opacity: 0 }

.cam-attente {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  align-content: center;
  color: var(--pw-dim);
  font-size: 11.5px;
  letter-spacing: .35px;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity .2s;
}

.cam-attente svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4;
  opacity: .75;
}

.cam-attente.cache { opacity: 0 }

.cam-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid rgba(62, 224, 196, .3);
  background: rgba(8, 12, 18, .7);
  color: var(--pw-acc);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  pointer-events: none;
}

.cam-barre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 8px 9px;
  border-top: 1px solid var(--pw-line);
  background: rgba(255, 255, 255, .03);
}

.cam-barre .pw-range { flex: 1; min-width: 54px }
.cam-barre .sep { width: 1px; height: 18px; background: var(--pw-line) }

@media (prefers-reduced-motion: reduce) {
  .pw,
  .pw.gone { animation: none }
}
