/* Base Reset & Variables */
:root {
  --chassis-bg: #2e352e; /* Vert olive mat militaire */
  --chassis-accent: #1e221d;
  --lcd-bg: #071807; /* Fond vert/noir de tube CRT */
  --lcd-text: #33ff33; /* Vert phosphore fluo terminal Fallout */
  --orange-glow: rgba(51, 255, 51, 0.4);
  --font-mono: 'Share Tech Mono', monospace;
  --font-retro: 'VT323', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #0d0d0f;
  color: #e2e2e7;
  font-family: 'Share Tech Mono', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  overflow-x: hidden;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: row;
  gap: 30px;
  max-width: 900px;
  width: 100%;
  justify-content: center;
  align-items: stretch;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    align-items: center;
  }
}

/* CHASSIS DU TALKIE-WALKIE */
.radio-chassis {
  background: radial-gradient(circle at 50% 30%, #2e2e33 0%, #171719 100%);
  border: 4px solid #111;
  border-radius: 40px 40px 30px 30px;
  width: 380px;
  padding: 25px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.8),
    inset 0 2px 3px rgba(255, 255, 255, 0.1),
    inset 0 -5px 10px rgba(0, 0, 0, 0.6);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Antenne */
.antenna {
  width: 24px;
  height: 90px;
  background: linear-gradient(90deg, #18181a 0%, #2e2e33 50%, #101012 100%);
  position: absolute;
  top: -85px;
  left: 60px;
  border-radius: 6px 6px 0 0;
  border: 2px solid #111;
  z-index: -1;
  box-shadow: inset -1px 0 2px rgba(255,255,255,0.1);
}
.antenna::after {
  content: '';
  width: 32px;
  height: 14px;
  background: #111;
  position: absolute;
  bottom: 0;
  left: -4px;
  border-radius: 2px;
}

/* Boutons physiques supérieurs */
.top-knobs {
  position: absolute;
  top: -16px;
  right: 50px;
  display: flex;
  gap: 20px;
  z-index: -1;
}
.volume-knob, .channel-knob {
  width: 30px;
  height: 18px;
  background: linear-gradient(90deg, #111, #333, #111);
  border: 2px solid #000;
  border-radius: 3px 3px 0 0;
}
.channel-knob {
  width: 35px;
  height: 22px;
  transform: translateY(-4px);
}

/* Grille de Haut-parleur */
.speaker-grill {
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  opacity: 0.85;
}
.grill-line {
  height: 6px;
  background: linear-gradient(90deg, transparent 5%, #111 20%, #111 80%, transparent 95%);
  border-radius: 3px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.05), 0 1px 1px rgba(0,0,0,0.4);
}

/* CADRE DE L'ÉCRAN LCD */
.lcd-screen-border {
  background: #232822; /* Acier industriel olive durci */
  border: 3px solid #161915;
  border-radius: 14px;
  padding: 12px;
  width: 100%;
  box-shadow: 
    inset 0 4px 10px rgba(0,0,0,0.9),
    0 4px 8px rgba(0,0,0,0.6);
  margin-bottom: 15px;
  position: relative;
}

/* Vis de fixation militaires aux quatre coins */
.lcd-screen-border::before {
  content: '🔩       🔩';
  position: absolute;
  top: 2px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  opacity: 0.55;
  pointer-events: none;
}

.lcd-screen-border::after {
  content: '🔩       🔩';
  position: absolute;
  bottom: 2px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  opacity: 0.55;
  pointer-events: none;
}

/* L'ÉCRAN VERT CRT (Style Fallout/Pip-Boy) */
.lcd-screen {
  background-color: var(--lcd-bg) !important;
  color: var(--lcd-text) !important;
  border-radius: 6px;
  padding: 12px;
  height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 
    inset 0 0 30px rgba(0, 0, 0, 0.95),
    0 0 15px var(--orange-glow) !important;
  
  /* Trame CRT Scanlines et grille d'ouverture */
  background-image: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.28) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 4px, 3px 100%;
  
  /* Effet de lueur phosphore */
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.45);
  animation: crt-flicker 0.15s infinite alternate;
}

/* Écran : courbure vitre incurvée et reflet fisheye */
.screen-glare {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle, rgba(0,0,0,0) 65%, rgba(0,0,0,0.45) 100%),
    linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
  z-index: 5; /* Passe devant l'overlay vidéo */
}

/* Scintillement CRT */
@keyframes crt-flicker {
  0% { opacity: 0.975; }
  50% { opacity: 0.99; }
  100% { opacity: 0.98; }
}

/* Incrustation vidéo de la caméra dans l'écran CRT (Monochrome vert) */
.screen-camera-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1; /* Sous le texte et l'oscilloscope */
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  /* Filtre militaire vert phosphore */
  filter: grayscale(1) brightness(0.65) contrast(1.3) sepia(1) hue-rotate(85deg) saturate(3.5);
}

.screen-camera-view.active {
  opacity: 0.35; /* Fusionne avec le texte vert */
}

/* Éléments de texte surélevés par rapport à l'overlay vidéo */
.screen-header, .frequency-display, .operator-info, .lcd-intruder-alert, .lcd-wow-display, .audio-oscilloscope {
  position: relative;
  z-index: 2;
}

/* Écran : Header */
.screen-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: bold;
  border-bottom: 1px solid rgba(34, 18, 0, 0.3);
  padding-bottom: 3px;
}
.status-mode {
  background-color: var(--lcd-text);
  color: var(--lcd-bg);
  padding: 1px 5px;
  border-radius: 2px;
  letter-spacing: 1px;
  font-family: var(--font-mono);
}

/* Écran : Affichage Fréquence */
.frequency-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: var(--font-retro);
  font-size: 54px;
  line-height: 0.9;
  letter-spacing: -1px;
  margin: 10px 0;
  text-shadow: 1px 1px 0px rgba(255,255,255,0.3);
}
.frequency-display .unit {
  font-size: 18px;
  margin-left: 5px;
  font-family: var(--font-mono);
}

/* Écran : Infos Opérateur */
.operator-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: bold;
}
.operator-info .label {
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Écran : Oscilloscope audio */
.audio-oscilloscope {
  height: 24px;
  background-color: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(34, 18, 0, 0.2);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.scope-grid {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(34,18,0,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,18,0,0.1) 1px, transparent 1px);
  background-size: 8px 8px;
}
.scope-line {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--lcd-text);
  transform: translateY(-50%);
  transition: transform 0.05s ease;
}

/* LEDS D'ÉTAT */
.led-indicators {
  display: flex;
  justify-content: space-around;
  width: 100%;
  background-color: #1a1a1c;
  border-radius: 10px;
  padding: 8px 0;
  border: 2px solid #0e0e10;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
  margin-bottom: 20px;
}
.led {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: bold;
  color: #666;
}
.led::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #333;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.8);
  transition: all 0.2s ease;
}

/* LED TX active (Rouge) */
.led-tx.active { color: #ff5252; }
.led-tx.active::before {
  background-color: #ff5252;
  box-shadow: 0 0 10px #ff5252, inset 0 1px 2px rgba(255,255,255,0.4);
}

/* LED RX active (Vert) */
.led-rx.active { color: #69f0ae; }
.led-rx.active::before {
  background-color: #69f0ae;
  box-shadow: 0 0 10px #69f0ae, inset 0 1px 2px rgba(255,255,255,0.4);
}

/* LED STBY active (Orange) */
.led-stby.active { color: #ffd740; }
.led-stby.active::before {
  background-color: #ffd740;
  box-shadow: 0 0 10px #ffd740, inset 0 1px 2px rgba(255,255,255,0.4);
}

/* PANNEAU DE CONTRÔLE */
.control-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.control-row.inline {
  flex-direction: row;
  align-items: center;
}

/* Inputs & Boutons */
input[type="text"] {
  background-color: #121214;
  border: 2px solid #000;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-mono);
  padding: 10px 15px;
  font-size: 14px;
  flex-grow: 1;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
  transition: border-color 0.2s;
}
input[type="text"]:focus {
  border-color: #ff9800;
}

.btn {
  background: linear-gradient(180deg, #3a3a40 0%, #222225 100%);
  border: 2px solid #000;
  color: #fff;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: var(--font-mono);
  font-weight: bold;
  cursor: pointer;
  box-shadow: 
    0 2px 4px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.1s ease;
}
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #ff9800 0%, #e65100 100%);
  border-color: #000;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.btn-primary:active {
  background: linear-gradient(180deg, #e65100 0%, #b33600 100%);
}

/* Sélecteur de canal/fréquence */
.frequency-selector {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background-color: #161618;
  border-radius: 12px;
  padding: 5px 10px;
  border: 2px solid #0e0e10;
}
.freq-label {
  font-size: 12px;
  color: #888;
  text-align: center;
}
.btn-round {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* BOUTON PUSH-TO-TALK TACTILE */
.ptt-container {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.ptt-btn {
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  width: 140px;
  height: 140px;
}

.ptt-outer {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ff4e00 0%, #b30000 100%);
  border-radius: 50%;
  border: 6px solid #000;
  padding: 6px;
  box-shadow: 
    0 10px 20px rgba(0,0,0,0.6),
    inset 0 4px 6px rgba(255,255,255,0.2),
    inset 0 -4px 6px rgba(0,0,0,0.4);
  transition: all 0.1s ease;
}

.ptt-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #b30000 0%, #800000 100%);
  border-radius: 50%;
  border: 3px solid #5a0000;
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  text-align: center;
  text-shadow: 0 -2px 2px rgba(0,0,0,0.8);
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.1);
  user-select: none;
  transition: all 0.1s ease;
}

/* Effets Active PTT (Presse physique) */
.ptt-btn:active .ptt-outer,
.ptt-btn.transmitting .ptt-outer {
  box-shadow: 
    0 4px 8px rgba(0,0,0,0.4),
    inset 0 1px 2px rgba(0,0,0,0.4);
  transform: scale(0.96);
}
.ptt-btn:active .ptt-inner,
.ptt-btn.transmitting .ptt-inner {
  background: radial-gradient(circle at 50% 30%, #800000 0%, #5a0000 100%);
  box-shadow: inset 0 3px 5px rgba(0,0,0,0.8);
  font-size: 14px;
}

.ptt-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.ptt-btn:disabled .ptt-outer {
  background: #444;
  box-shadow: none;
}
.ptt-btn:disabled .ptt-inner {
  background: #333;
  border-color: #222;
  color: #555;
  text-shadow: none;
}

/* Grille inférieure micro */
.mic-grill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 25px;
  width: 100%;
}
.mic-hole {
  width: 8px;
  height: 8px;
  background-color: #000;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.05);
}
.brand {
  font-size: 9px;
  color: #555;
  letter-spacing: 2px;
}

/* PANNEAU LATÉRAL */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 320px;
}

@media (max-width: 768px) {
  .sidebar {
    width: 380px;
  }
}

.panel {
  background-color: #16161a;
  border: 3px solid #232328;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.panel h3 {
  font-size: 15px;
  color: #ff9800;
  border-bottom: 2px solid #232328;
  padding-bottom: 8px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

/* Liste des opérateurs */
.operators-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 200px;
  overflow-y: auto;
}
.operators-list li {
  background-color: #1f1f25;
  border: 1px solid #2c2c35;
  border-radius: 8px;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  transition: all 0.2s ease;
}
.operators-list li.transmitting {
  border-color: #ff5252;
  background: linear-gradient(90deg, rgba(255, 82, 82, 0.1) 0%, #1f1f25 100%);
  animation: pulse-border 1.5s infinite alternate;
}
.operators-list li.empty-list {
  background-color: transparent;
  border: none;
  color: #666;
  font-style: italic;
  justify-content: center;
}

/* Badge parlant */
.badge-tx {
  background-color: #ff5252;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  animation: pulse-opacity 1s infinite alternate;
}

/* Instructions */
.help-panel ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12px;
  color: #a9a9b3;
  margin-bottom: 15px;
}
.help-panel strong {
  color: #ff9800;
}

.gamepad-status {
  background-color: #101012;
  border: 1px dashed #333;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: #888;
}
.gamepad-status.active {
  border-color: #69f0ae;
  color: #69f0ae;
}

/* Animations */
@keyframes pulse-opacity {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

@keyframes pulse-border {
  from { border-color: #ff5252; }
  to { border-color: #b30000; }
}

/* Styles pour Code d'invitation privé */
.private-room-row {
  margin-top: 5px;
}
.private-room-row input {
  font-size: 13px !important;
  padding: 8px 12px !important;
}
.private-room-row .btn {
  padding: 8px 15px !important;
  font-size: 11px !important;
}

/* Mode texte pour l'affichage de la fréquence */
.frequency-display.text-mode {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 0px;
  text-transform: uppercase;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 5px;
  margin: 15px 0;
  display: block;
  text-align: center;
}
.frequency-display.text-mode .unit {
  display: none;
}

/* Modals pour le QR-code & Scan */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-card {
  background-color: #16161a;
  border: 3px solid #ff9800;
  border-radius: 20px;
  padding: 25px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 25px rgba(255, 152, 0, 0.3);
  color: #fff;
  text-align: center;
}
.modal-card h4 {
  font-size: 16px;
  color: #ff9800;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.modal-close-btn {
  margin-top: 15px;
  width: 100%;
}

/* Conteneur du QR Code généré */
#qrcode-container {
  display: flex;
  justify-content: center;
  background: #fff;
  padding: 15px;
  border-radius: 10px;
  margin: 15px auto;
  width: fit-content;
}
#qrcode-container img {
  display: block;
}

/* Scanner de caméra */
#reader {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  background-color: #000;
  border: 2px solid #232328;
  border-radius: 10px;
  overflow: hidden;
}

/* Favoris & Actions */
.favorites-list li {
  border-left: 3px solid #ffd740;
}
.btn-star-fav {
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  outline: none;
  padding: 5px;
  transition: color 0.2s;
}
.btn-star-fav.active {
  color: #ffd740;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.6);
}
.btn-delete-fav {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  padding: 5px;
}

/* ==========================================
   LENTILLE DE CAMÉRA & MODE ESPION (CSS)
   ========================================== */

.camera-lens-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  width: 100%;
  justify-content: center;
}

.camera-lens {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #4f4f54 0%, #111113 70%, #000 100%);
  border: 3px solid #000;
  box-shadow: 
    0 4px 6px rgba(0,0,0,0.5),
    inset 0 2px 3px rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.camera-lens:hover {
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.5);
}

.lens-glass {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(0, 255, 102, 0.15) 0%, rgba(0, 50, 20, 0.6) 60%, #000 100%);
  z-index: 1;
  pointer-events: none;
}

.lens-reflection {
  position: absolute;
  top: 4px;
  left: 6px;
  width: 14px;
  height: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 80%);
  border-radius: 50% / 40%;
  transform: rotate(-15deg);
  z-index: 3;
  pointer-events: none;
}

.lens-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: none; /* Masqué par défaut */
  z-index: 2;
  transform: scaleX(-1);
}

/* LED d'état de la caméra */
.camera-status-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444; /* Rouge par défaut */
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
  transition: all 0.3s ease;
}

.camera-status-led.active {
  background-color: #10b981; /* Vert quand active */
  box-shadow: 0 0 8px #10b981, inset 0 1px 1px rgba(255,255,255,0.5);
  animation: pulse-opacity 1s infinite alternate;
}

/* CARNET D'ADRESSES */
.phonebook-card {
  border-color: #ffd740 !important;
  box-shadow: 0 0 25px rgba(255, 215, 64, 0.3) !important;
  background-color: #16161a !important;
}

.phonebook-tab {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: #232328 !important;
  color: #888 !important;
}

.phonebook-tab.active {
  background: #ffd740 !important;
  color: #000 !important;
  border-color: #ffd740 !important;
}

.phonebook-add-row input {
  background-color: #121214;
  border: 2px solid #000;
  border-radius: 6px;
  color: #fff;
  outline: none;
  font-family: var(--font-mono);
}

.phonebook-add-row input:focus {
  border-color: #ffd740;
}

/* MONITEUR ESPION */
.spy-monitor-card {
  border-color: #10b981 !important;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.25) !important;
  background-color: #09090b !important;
}

.spy-video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: #000;
  border: 2px solid #10b981;
  border-radius: 8px;
  overflow: hidden;
}

.spy-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  transition: filter 0.3s ease;
}

/* Effet Vision de Nuit Vert (Matrix Spy) */
.spy-video-wrapper.night-vision .spy-video {
  filter: grayscale(100%) sepia(100%) hue-rotate(80deg) saturate(500%) contrast(1.2) brightness(0.9);
}
.spy-video-wrapper.night-vision {
  border-color: #00ff66;
  box-shadow: 0 0 20px rgba(0, 255, 102, 0.35);
}

.spy-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.2) 50%
  );
  background-size: 100% 4px;
  z-index: 10;
  pointer-events: none;
  animation: crt-flicker 0.15s infinite;
}

.spy-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 45px;
  height: 45px;
  transform: translate(-50%, -50%);
  border: 1px dashed rgba(16, 185, 129, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 11;
}

.spy-crosshair::before,
.spy-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(16, 185, 129, 0.4);
}

.spy-crosshair::before {
  top: 50%;
  left: -15px;
  width: 75px;
  height: 1px;
}

.spy-crosshair::after {
  left: 50%;
  top: -15px;
  height: 75px;
  width: 1px;
}

/* Télémétries HUD */
.spy-hud-top-left,
.spy-hud-bottom-right {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: bold;
  color: #10b981;
  text-transform: uppercase;
  z-index: 12;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(16, 185, 129, 0.6);
  padding: 3px 6px;
  background: rgba(0,0,0,0.6);
  border-radius: 4px;
}

.spy-hud-top-left {
  top: 10px;
  left: 10px;
  border-left: 2px solid #10b981;
}

.spy-hud-bottom-right {
  bottom: 10px;
  right: 10px;
  border-right: 2px solid #10b981;
}

/* REC dot pulsing */
.spy-rec-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  animation: pulse-opacity 0.6s infinite alternate;
}

/* Animations d'espionnage */
@keyframes crt-flicker {
  0% { opacity: 0.95; }
  50% { opacity: 1; }
  100% { opacity: 0.96; }
}

/* Animation de pulsation verte pour lentille caméra active */
@keyframes camera-glow-pulse {
  from { box-shadow: 0 0 10px rgba(16, 185, 129, 0.6), inset 0 2px 3px rgba(255,255,255,0.2); }
  to   { box-shadow: 0 0 22px rgba(16, 185, 129, 1.0), inset 0 2px 3px rgba(255,255,255,0.2); }
}

/* Bouton d'appel du carnet d'adresses */
.pb-call-btn:hover {
  background: rgba(255, 215, 64, 0.15) !important;
  transform: scale(1.1);
  transition: all 0.15s ease;
}

/* Indicateur HUD qui clignote lentement */
@keyframes hud-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
/* ── HUD blink animation ─── */
.spy-hud-top-left {
  animation: hud-blink 2.5s ease infinite;
}

/* ==============================================
   CHAT E2E + TRANSFERT DE FICHIERS
   ============================================== */

.chat-panel {
  border-color: #2a2a35 !important;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Liste des messages */
.chat-messages {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
  margin-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

/* Message générique */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: chat-appear 0.15s ease;
}
@keyframes chat-appear {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mes messages → droite */
.chat-msg-self {
  align-self: flex-end;
  align-items: flex-end;
}

/* Messages des pairs → gauche */
.chat-msg-peer {
  align-self: flex-start;
  align-items: flex-start;
}

/* Méta (indicatif + heure) */
.chat-meta {
  font-size: 9px;
  color: #555;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}

.chat-sender {
  color: #ff9800;
  font-weight: bold;
  font-size: 9px;
}

.chat-time {
  color: #444;
  font-size: 9px;
}

/* Bulle de message */
.chat-bubble {
  background: #1a1a20;
  border: 1px solid #2c2c38;
  border-radius: 12px 12px 12px 3px;
  padding: 7px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: #d0d0d8;
  word-break: break-word;
  max-width: 100%;
}

.chat-msg-self .chat-bubble {
  background: #1c1208;
  border-color: rgba(255, 152, 0, 0.3);
  border-radius: 12px 12px 3px 12px;
  color: #ffd090;
}

/* Message système */
.chat-msg-system {
  align-self: center;
  max-width: 100%;
}
.chat-system-msg {
  font-size: 10px;
  color: #444;
  text-align: center;
  font-style: italic;
  padding: 2px 0;
  letter-spacing: 0.5px;
}

/* Carte croc (fichier volumineux) */
.croc-bubble {
  background: #0d150d !important;
  border-color: rgba(0, 200, 80, 0.3) !important;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px !important;
}
.croc-icon { font-size: 22px; flex-shrink: 0; }
.croc-info { flex: 1; overflow: hidden; }
.croc-filename {
  font-size: 11px;
  font-weight: bold;
  color: #69f0ae;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.croc-cmd {
  font-size: 10px;
  color: #2a6b45;
  font-family: var(--font-mono);
  margin-top: 2px;
  letter-spacing: 0.5px;
}
.croc-copy-btn {
  font-size: 10px !important;
  padding: 4px 8px !important;
  border-color: #69f0ae !important;
  color: #69f0ae !important;
  background: rgba(105, 240, 174, 0.05) !important;
  flex-shrink: 0;
}

/* Fichier reçu (bulle normale avec icône) */
.chat-msg-file .chat-bubble {
  border-color: rgba(100, 180, 255, 0.3) !important;
  color: #90caf9 !important;
}

/* Barre de progression upload/download */
.file-progress-bubble {
  background: #0e0e16 !important;
  border-color: #333 !important;
  padding: 8px 12px !important;
  min-width: 200px;
}
.fp-name {
  font-size: 10px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
.fp-bar-wrap {
  background: #1a1a22;
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}
.fp-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff9800, #ff5722);
  border-radius: 4px;
  transition: width 0.3s ease;
  box-shadow: 0 0 6px rgba(255, 152, 0, 0.5);
}
.fp-info {
  font-size: 9px;
  color: #555;
  text-align: right;
}

/* Champ de saisie du chat */
.chat-input-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.chat-input-row input {
  font-size: 12px !important;
  padding: 8px 10px !important;
  border-radius: 20px !important;
  flex-grow: 1;
}
.chat-input-row input:focus {
  border-color: #333 !important;
  box-shadow: inset 0 0 0 1px rgba(255,152,0,0.2);
}
.chat-input-row .btn {
  padding: 8px 14px !important;
  border-radius: 20px !important;
  font-size: 13px !important;
  flex-shrink: 0;
}

/* Badge non-lu */
.chat-unread-badge {
  background: #1a1a20;
  border: 1px solid #333;
  color: #555;
  border-radius: 10px;
  font-size: 10px;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
  font-family: var(--font-mono);
  transition: all 0.2s;
}
.chat-unread-badge.has-unread {
  background: #ff9800;
  border-color: #ff9800;
  color: #000;
  font-weight: bold;
  animation: pulse-opacity 0.8s infinite alternate;
}

/* Drag-and-drop highlight */
.chat-panel.drag-over {
  border-color: #ff9800 !important;
  background: rgba(255, 152, 0, 0.04) !important;
  box-shadow: 0 0 15px rgba(255, 152, 0, 0.15) !important;
}

/* ══════════════════════════════════════════════════
   CHAT IN-APP — Overlay dans le châssis
   ══════════════════════════════════════════════════ */

/* Le châssis doit être overflow:hidden pour contenir l'overlay */
.radio-chassis {
  overflow: hidden;
}

/* ══════════════════════════════════════════════════
   CHAT IN-APP — Overlay dans le châssis
   THÈME : MATRIX / TERMINAL VERT
   ══════════════════════════════════════════════════ */

/* Variables Matrix */
:root {
  --mx-green:       #00ff41;
  --mx-green-dim:   #00b32c;
  --mx-green-dark:  #003b00;
  --mx-green-glow:  rgba(0, 255, 65, 0.25);
  --mx-bg:          rgba(0, 8, 0, 0.92);
  --mx-glass:       rgba(0, 20, 0, 0.55);
  --mx-glass-msg:   rgba(0, 15, 0, 0.7);
}

/* Le châssis doit être overflow:hidden pour contenir l'overlay */
.radio-chassis { overflow: hidden; }

/* ── Bouton MSG dans le panneau de contrôle ── */
.chassis-msg-btn { transition: all 0.15s ease !important; }
.chassis-msg-btn:hover:not(:disabled) {
  background: rgba(0, 255, 65, 0.1) !important;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.3) !important;
  border-color: var(--mx-green-dim) !important;
  color: var(--mx-green) !important;
}

/* Badge non-lu sur le bouton MSG */
.chassis-msg-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--mx-green); color: #000;
  border-radius: 8px; font-size: 9px; font-weight: bold;
  padding: 1px 5px; min-width: 16px; text-align: center;
  display: none;
  animation: pulse-opacity 0.6s infinite alternate;
}
.chassis-msg-badge.visible { display: block; }

/* ── Overlay principal ── */
.chassis-chat {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: var(--mx-bg);
  border-radius: inherit;
  transform: translateY(105%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  /* Scanlines Matrix par-dessus tout */
  isolation: isolate;
}
.chassis-chat::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 255, 65, 0.025) 3px,
    rgba(0, 255, 65, 0.025) 4px
  );
  pointer-events: none;
  z-index: 10;
  border-radius: inherit;
}
.chassis-chat.open { transform: translateY(0); }

/* Canvas pluie Matrix */
.matrix-rain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.18;
  border-radius: inherit;
}

/* ── Header ── */
.chassis-chat-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: linear-gradient(180deg, rgba(0,12,0,0.95) 0%, rgba(0,8,0,0) 100%);
  border-bottom: 1px solid rgba(0,255,65,0.15);
  flex-shrink: 0;
}
.chassis-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chassis-chat-app-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 8px var(--mx-green));
}
.chassis-chat-title-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: bold;
  color: var(--mx-green);
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--mx-green-glow);
}
.chassis-chat-subtitle {
  font-size: 9px;
  color: var(--mx-green-dark);
  letter-spacing: 1px;
  margin-top: 1px;
  font-family: 'Share Tech Mono', monospace;
}
.chassis-chat-close-btn {
  position: relative; z-index: 5;
  background: rgba(0,255,65,0.05);
  border: 1px solid rgba(0,255,65,0.2);
  border-radius: 50%;
  width: 30px; height: 30px;
  color: var(--mx-green-dim);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  font-family: 'Share Tech Mono', monospace;
}
.chassis-chat-close-btn:hover {
  background: rgba(0,255,65,0.12);
  border-color: var(--mx-green);
  color: var(--mx-green);
  box-shadow: 0 0 10px var(--mx-green-glow);
}

/* ── Liste des messages ── */
.chassis-chat-messages {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--mx-green-dark) transparent;
  position: relative;
  z-index: 5;
}
.chassis-chat-messages::-webkit-scrollbar { width: 3px; }
.chassis-chat-messages::-webkit-scrollbar-thumb {
  background: var(--mx-green-dark);
  border-radius: 2px;
}

/* Écran vide */
.chassis-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--mx-green-dark);
  font-size: 12px;
  gap: 10px;
  padding: 30px 0;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 1px;
}
.chassis-chat-empty-icon {
  font-size: 34px;
  filter: drop-shadow(0 0 12px var(--mx-green));
  opacity: 0.6;
  animation: pulse-opacity 2s infinite alternate;
}

/* ── Messages — style terminal Matrix ── */
.chassis-chat-messages .chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: chat-appear 0.15s ease;
}
.chassis-chat-messages .chat-msg-self  { align-self: flex-end;  align-items: flex-end; }
.chassis-chat-messages .chat-msg-peer { align-self: flex-start; align-items: flex-start; }

.chassis-chat-messages .chat-meta {
  font-size: 9px;
  color: var(--mx-green-dark);
  margin-bottom: 3px;
  letter-spacing: 0.5px;
  font-family: 'Share Tech Mono', monospace;
}
.chassis-chat-messages .chat-sender {
  color: var(--mx-green);
  font-weight: bold;
  text-shadow: 0 0 6px var(--mx-green-glow);
}
.chassis-chat-messages .chat-time { color: var(--mx-green-dark); }

/* Bulle pair : glass vert gauche */
.chassis-chat-messages .chat-msg-peer .chat-bubble {
  background: var(--mx-glass-msg);
  border: 1px solid rgba(0, 255, 65, 0.15);
  border-radius: 0 14px 14px 14px;
  padding: 8px 13px;
  font-size: 13px;
  color: var(--mx-green-dim);
  line-height: 1.5;
  word-break: break-word;
  font-family: 'Share Tech Mono', monospace;
  backdrop-filter: blur(4px);
  box-shadow: inset 0 0 12px rgba(0,255,65,0.04),
              0 0 0 1px rgba(0,255,65,0.08);
}

/* Bulle soi : verte brillante droite */
.chassis-chat-messages .chat-msg-self .chat-bubble {
  background: rgba(0, 40, 0, 0.75);
  border: 1px solid rgba(0, 255, 65, 0.35);
  border-radius: 14px 0 14px 14px;
  padding: 8px 13px;
  font-size: 13px;
  color: var(--mx-green);
  line-height: 1.5;
  word-break: break-word;
  font-family: 'Share Tech Mono', monospace;
  text-shadow: 0 0 8px rgba(0,255,65,0.4);
  box-shadow: 0 0 16px rgba(0, 255, 65, 0.12),
              inset 0 0 8px rgba(0,255,65,0.06);
  backdrop-filter: blur(4px);
}

/* Bulle croc */
.chassis-chat-messages .croc-bubble {
  background: rgba(0, 30, 10, 0.8) !important;
  border-color: rgba(0, 255, 65, 0.3) !important;
  border-radius: 10px !important;
}
.croc-filename { color: var(--mx-green) !important; }
.croc-cmd { color: var(--mx-green-dark) !important; }
.croc-copy-btn {
  border-color: var(--mx-green) !important;
  color: var(--mx-green) !important;
  background: rgba(0,255,65,0.05) !important;
}

/* Bulle système */
.chassis-chat-messages .chat-msg-system { align-self: center; }
.chassis-chat-messages .chat-system-msg {
  font-size: 10px;
  color: var(--mx-green-dark);
  text-align: center;
  font-style: normal;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 1px;
}

/* ── Barre de saisie ── */
.chassis-chat-input-bar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(0,255,65,0.1);
  background: linear-gradient(0deg, rgba(0,8,0,0.98) 0%, rgba(0,8,0,0) 100%);
  flex-shrink: 0;
}

.chassis-attach-btn {
  background: rgba(0,255,65,0.05);
  border: 1px solid rgba(0,255,65,0.2);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--mx-green-dim);
  transition: all 0.15s;
  flex-shrink: 0;
}
.chassis-attach-btn:hover:not(:disabled) {
  border-color: var(--mx-green);
  color: var(--mx-green);
  box-shadow: 0 0 10px var(--mx-green-glow);
}
.chassis-attach-btn:disabled { opacity: 0.2; cursor: not-allowed; }

.chassis-chat-input {
  flex: 1;
  background: rgba(0, 15, 0, 0.8) !important;
  border: 1px solid rgba(0,255,65,0.2) !important;
  border-radius: 4px !important;
  padding: 9px 14px !important;
  font-size: 13px !important;
  color: var(--mx-green) !important;
  font-family: 'Share Tech Mono', monospace !important;
  letter-spacing: 1px;
  outline: none;
  transition: all 0.15s;
  caret-color: var(--mx-green);
}
.chassis-chat-input::placeholder { color: rgba(0,255,65,0.2) !important; }
.chassis-chat-input:focus {
  border-color: rgba(0,255,65,0.5) !important;
  box-shadow: 0 0 12px rgba(0,255,65,0.15), inset 0 0 6px rgba(0,255,65,0.05);
  background: rgba(0, 20, 0, 0.9) !important;
}
.chassis-chat-input:disabled { opacity: 0.3; cursor: not-allowed; }

.chassis-send-btn {
  background: rgba(0, 40, 0, 0.8);
  border: 1px solid rgba(0,255,65,0.35);
  border-radius: 50%;
  width: 36px; height: 36px;
  color: var(--mx-green);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0,255,65,0.15);
}
.chassis-send-btn:hover:not(:disabled) {
  background: rgba(0, 60, 0, 0.9);
  box-shadow: 0 0 18px rgba(0,255,65,0.4);
  border-color: var(--mx-green);
}
.chassis-send-btn:disabled { opacity: 0.2; cursor: not-allowed; }
.chassis-send-btn:active:not(:disabled) { transform: scale(0.9); }

/* ── Sidebar mini-indicateur ── */
.sidebar-chat-badge { display: none; }
.sidebar-chat-badge.has-unread {
  display: inline-block;
  background: var(--mx-green);
  color: #000;
  border-radius: 10px;
  font-size: 10px; font-weight: bold;
  padding: 1px 7px;
  animation: pulse-opacity 0.8s infinite alternate;
}

.chassis-msg-btn:hover:not(:disabled) {
  background: rgba(79, 142, 247, 0.15) !important;
  box-shadow: 0 0 12px rgba(79, 142, 247, 0.3) !important;
}

/* Badge non-lu sur le bouton MSG */
.chassis-msg-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ff3b30;
  color: #fff;
  border-radius: 8px;
  font-size: 9px;
  font-weight: bold;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  display: none;
  animation: pulse-opacity 0.6s infinite alternate;
}
.chassis-msg-badge.visible {
  display: block;
}

/* ── Overlay principal ── */
.chassis-chat {
  position: absolute;
  inset: 0;                  /* couvre tout le châssis */
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: #0a0a0f;
  border-radius: inherit;    /* hérite du border-radius du châssis */

  /* Animation : slide-up depuis le bas */
  transform: translateY(105%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.chassis-chat.open {
  transform: translateY(0);
}

/* ── Header ── */
.chassis-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: linear-gradient(180deg, #111118 0%, rgba(10,10,15,0) 100%);
  border-bottom: 1px solid #1a1a22;
  flex-shrink: 0;
}

.chassis-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chassis-chat-app-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(79,142,247,0.5));
}

.chassis-chat-title-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: bold;
  color: #e0e0e8;
  letter-spacing: 1px;
}

.chassis-chat-subtitle {
  font-size: 9px;
  color: #3a3a50;
  letter-spacing: 0.5px;
  margin-top: 1px;
}

.chassis-chat-close-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid #222;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  color: #555;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chassis-chat-close-btn:hover {
  background: rgba(255,59,48,0.1);
  border-color: rgba(255,59,48,0.4);
  color: #ff3b30;
}

/* ── Liste des messages ── */
.chassis-chat-messages {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: #1e1e28 transparent;
}
.chassis-chat-messages::-webkit-scrollbar { width: 3px; }
.chassis-chat-messages::-webkit-scrollbar-thumb { background: #1e1e28; border-radius: 2px; }

/* Écran vide */
.chassis-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #2a2a3a;
  font-size: 12px;
  gap: 8px;
  padding: 30px 0;
}
.chassis-chat-empty-icon {
  font-size: 36px;
  opacity: 0.4;
}

/* Messages — style SMS/iMessage */
.chassis-chat-messages .chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: chat-appear 0.18s ease;
}
.chassis-chat-messages .chat-msg-self  { align-self: flex-end;  align-items: flex-end;   }
.chassis-chat-messages .chat-msg-peer { align-self: flex-start; align-items: flex-start; }

.chassis-chat-messages .chat-meta {
  font-size: 9px;
  color: #333;
  margin-bottom: 2px;
  letter-spacing: 0.3px;
}
.chassis-chat-messages .chat-sender { color: #4f8ef7; font-weight: bold; }
.chassis-chat-messages .chat-time   { color: #2a2a3a; }

/* Bulle pair : gauche, gris foncé */
.chassis-chat-messages .chat-msg-peer .chat-bubble {
  background: #16161e;
  border: 1px solid #1e1e2a;
  border-radius: 18px 18px 18px 4px;
  padding: 9px 13px;
  font-size: 13px;
  color: #c0c0cc;
  line-height: 1.45;
  word-break: break-word;
}

/* Bulle soi : droite, bleu midnight */
.chassis-chat-messages .chat-msg-self .chat-bubble {
  background: linear-gradient(135deg, #1a2a4a, #0f1a35);
  border: 1px solid rgba(79,142,247,0.25);
  border-radius: 18px 18px 4px 18px;
  padding: 9px 13px;
  font-size: 13px;
  color: #a0c4ff;
  line-height: 1.45;
  word-break: break-word;
}

/* Bulle croc (vert emeraude) */
.chassis-chat-messages .croc-bubble {
  background: #0a180f !important;
  border-color: rgba(0,200,80,0.2) !important;
  border-radius: 14px !important;
}

/* Bulle système */
.chassis-chat-messages .chat-msg-system {
  align-self: center;
}
.chassis-chat-messages .chat-system-msg {
  font-size: 10px;
  color: #2a2a3a;
  text-align: center;
  font-style: italic;
}

/* ── Barre de saisie ── */
.chassis-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid #14141c;
  background: linear-gradient(0deg, #080810 0%, rgba(8,8,16,0) 100%);
  flex-shrink: 0;
}

.chassis-attach-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid #1e1e2a;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chassis-attach-btn:hover:not(:disabled) {
  border-color: #333;
  color: #888;
}
.chassis-attach-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.chassis-chat-input {
  flex: 1;
  background: #111118 !important;
  border: 1px solid #1e1e2a !important;
  border-radius: 20px !important;
  padding: 9px 16px !important;
  font-size: 13px !important;
  color: #d0d0e0 !important;
  font-family: inherit !important;
  outline: none;
  transition: border-color 0.15s;
}
.chassis-chat-input::placeholder { color: #2a2a3a !important; }
.chassis-chat-input:focus {
  border-color: rgba(79,142,247,0.35) !important;
  box-shadow: 0 0 0 2px rgba(79,142,247,0.08);
}
.chassis-chat-input:disabled { opacity: 0.4; cursor: not-allowed; }

.chassis-send-btn {
  background: linear-gradient(135deg, #1a3a7a, #0f1e50);
  border: 1px solid rgba(79,142,247,0.3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  color: #4f8ef7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chassis-send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2a4a9a, #1a2a6a);
  box-shadow: 0 0 12px rgba(79,142,247,0.4);
}
.chassis-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.chassis-send-btn:active:not(:disabled) { transform: scale(0.92); }

/* ── Sidebar mini-indicateur ── */
.sidebar-chat-badge {
  display: none;
}
.sidebar-chat-badge.has-unread {
  display: inline-block;
  background: #ff3b30;
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 7px;
  animation: pulse-opacity 0.8s infinite alternate;
}

/* ── Appairage Sécurisé WPA3 & SMS Gateway simulation ── */
.pairing-card {
  border: 3px solid #00ff66 !important;
  box-shadow: 0 0 30px rgba(0, 255, 102, 0.25) !important;
  background-color: #0b0f12 !important;
}

.pairing-card .btn {
  border-color: #22c55e;
  color: #22c55e;
  transition: all 0.2s ease;
}

.pairing-card .btn:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.pairing-card .btn.active {
  background: #22c55e !important;
  color: #000 !important;
  font-weight: bold;
}

.pairing-step {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Bulle SMS simulée */
.sms-bubble {
  background: rgba(26, 26, 36, 0.95);
  border: 2px solid #ff9800;
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-family: monospace;
  box-shadow: 0 5px 20px rgba(255, 152, 0, 0.4);
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: smsSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: all 0.3s ease;
}

.sms-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 152, 0, 0.6);
}

.sms-bubble-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 152, 0, 0.3);
  padding-bottom: 6px;
  margin-bottom: 8px;
  font-size: 10px;
  color: #ff9800;
  font-weight: bold;
}

.sms-bubble-body {
  font-size: 11px;
  line-height: 1.4;
  color: #eee;
  word-break: break-all;
}

@keyframes smsSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.sms-bubble.fade-out {
  transform: translateX(120%);
  opacity: 0;
}

/* Badge contact certifié */
.verified-contact-badge {
  background: rgba(0, 255, 102, 0.1);
  border: 1px solid #00ff66;
  color: #00ff66;
  border-radius: 4px;
  font-size: 8px;
  padding: 1px 4px;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}

/* LED d'état Mode Privé */
.private-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background-color: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#private-mode-btn.active {
  border-color: #00ff66 !important;
  color: #00ff66 !important;
  background: rgba(0, 255, 102, 0.05) !important;
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.15);
}

#private-mode-btn.active .private-led {
  background-color: #00ff66;
  box-shadow: 0 0 8px #00ff66;
}

/* LED d'état Mode Aide */
.help-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background-color: #555;
  box-shadow: 0 0 4px rgba(255, 152, 0, 0.3);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#help-mode-btn.active {
  border-color: #ff9800 !important;
  color: #ff9800 !important;
  background: rgba(255, 152, 0, 0.1) !important;
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.25);
}

#help-mode-btn.active .help-led {
  background-color: #ff9800;
  box-shadow: 0 0 8px #ff9800;
}

/* Alerte Intrus sur Écran LCD */
.lcd-intruder-alert {
  font-size: 10px;
  font-weight: bold;
  text-align: center;
  color: #ff3b30;
  margin: 3px 0;
  padding: 2px 0;
  border-top: 1px dashed rgba(255, 59, 48, 0.3);
  border-bottom: 1px dashed rgba(255, 59, 48, 0.3);
  letter-spacing: 1px;
  font-family: monospace;
  animation: flash-red 0.8s infinite alternate;
}

@keyframes flash-red {
  0% { opacity: 0.3; color: #ff5500; }
  100% { opacity: 1; color: #ff0000; text-shadow: 0 0 6px rgba(255, 0, 0, 0.8); }
}

/* Statuts d'opérateurs dans la liste */
.peer-item.unverified-operator {
  border-left: 3px solid #ef4444 !important;
}

.peer-item.verified-operator {
  border-left: 3px solid #00ff66 !important;
}

/* --- RAIE HYDROGÈNE / LCD COSMIC --- */
.lcd-screen.cosmic {
  background-color: #0c1b1a !important; /* Vert émeraude/teal rétro profond */
  color: #00f0ff !important; /* Cyan fluo */
  box-shadow: 
    inset 0 0 25px rgba(0, 0, 0, 0.85),
    0 0 15px rgba(0, 240, 255, 0.5) !important;
  transition: all 0.5s ease;
}

.lcd-screen.cosmic .screen-header {
  border-bottom: 1px solid rgba(0, 240, 255, 0.3) !important;
}

.lcd-screen.cosmic .status-mode {
  background-color: #00f0ff !important;
  color: #0c1b1a !important;
}

.lcd-screen.cosmic #scope-canvas {
  filter: drop-shadow(0 0 2px rgba(0, 240, 255, 0.6));
}

/* Affichage WoW! Signal sur Écran LCD */
.lcd-wow-display {
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  color: #00f0ff;
  margin: 3px 0;
  padding: 2px 0;
  border-top: 1px dashed rgba(0, 240, 255, 0.3);
  border-bottom: 1px dashed rgba(0, 240, 255, 0.3);
  letter-spacing: 1.5px;
  font-family: monospace;
  animation: flash-cyan 1s infinite alternate;
}

@keyframes flash-cyan {
  0% { opacity: 0.4; text-shadow: 0 0 2px rgba(0, 240, 255, 0.4); }
  100% { opacity: 1; text-shadow: 0 0 8px rgba(0, 240, 255, 0.9); }
}

/* --- PANNEAU RÉSEAU MESH & CARTE --- */
.mesh-panel {
  display: flex;
  flex-direction: column;
}

.mesh-map-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

#mesh-map {
  height: 180px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid #ff9800;
  background-color: #000;
  z-index: 1; /* S'assurer que les popups et contrôles ne dépassent pas */
  /* FILTRE CYBER-DARK POUR LEAFLET MAP */
  filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(1.2);
}

.radar-sweep {
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
  bottom: 1px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
  background: conic-gradient(from 0deg, rgba(0, 255, 102, 0.12) 0deg, rgba(0, 255, 102, 0) 90deg);
  animation: radar-spin 4s linear infinite;
  display: none;
  opacity: 0.85;
}

@keyframes radar-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Ajustements pour les marqueurs et popups Leaflet en mode sombre */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: #111 !important;
  color: #ff9800 !important;
  border: 1px solid #ff9800;
  font-family: var(--font-mono);
  font-size: 10px;
}

.mesh-info-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 152, 0, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.mesh-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 3px;
  color: #ccc;
}

.mesh-info-row span:first-child {
  color: #888;
}

.mesh-log-area {
  height: 70px;
  overflow-y: auto;
  background: #000;
  border: 1px solid rgba(255, 152, 0, 0.15);
  border-radius: 4px;
  padding: 5px;
  font-family: monospace;
  font-size: 9px;
  color: #00ff66;
  line-height: 1.3;
}

.mesh-log-area div {
  margin-bottom: 2px;
  border-bottom: 1px dotted rgba(0, 255, 102, 0.05);
}

/* --- ONGLETS MESH / RADAR & RADAR BLUETOOTH --- */
.mesh-tabs {
  border-bottom: 1px solid rgba(255, 152, 0, 0.15);
  padding-bottom: 6px;
}
.mesh-tabs .btn {
  background: transparent;
  border: 1px solid #232328;
  color: #888;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.mesh-tabs .btn.active {
  border-color: #00ff66;
  color: #00ff66;
  background: rgba(0, 255, 102, 0.05);
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.2);
}

/* Radar Wrapper and interactive elements */
.bluetooth-radar-wrapper {
  box-shadow: inset 0 0 15px rgba(0, 255, 102, 0.2);
}

/* Blips du radar */
.radar-blip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  position: absolute;
  cursor: pointer;
  z-index: 5;
  transform: translate(-50%, -50%); /* Centrer sur son point d'ancrage */
  animation: blip-pulse 2s infinite ease-in-out;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.radar-blip:hover {
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 15px #fff;
  z-index: 10;
}

.radar-blip.op {
  background-color: #00ff66;
  box-shadow: 0 0 8px #00ff66;
}
.radar-blip.iot-temp {
  background-color: #ffd740;
  box-shadow: 0 0 8px #ffd740;
  border-color: #000;
}
.radar-blip.iot-light {
  background-color: #00f0ff;
  box-shadow: 0 0 8px #00f0ff;
  border-color: #000;
}
.radar-blip.iot-motion {
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  border-color: #000;
}
.radar-blip.iot-battery {
  background-color: #a855f7;
  box-shadow: 0 0 8px #a855f7;
  border-color: #000;
}
.radar-blip.diy-ble {
  background-color: #ff00ff;
  box-shadow: 0 0 8px #ff00ff;
  border-color: #fff;
}

@keyframes blip-pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
  50% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; box-shadow: 0 0 12px; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
}

/* Formulaire d'ajout IoT & Gestion de Groupe dans la Phonebook modal */
.group-management-section {
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  margin-top: 10px;
  text-align: left;
}

.group-management-section h5 {
  color: #a78bfa;
  font-size: 11px;
  border-bottom: 1px solid rgba(167, 139, 250, 0.2);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.iot-input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.iot-input-row input, .iot-input-row select {
  font-family: monospace;
  font-size: 10px;
  background: #000;
  border: 1px solid #a78bfa;
  color: #a78bfa;
  padding: 4px 6px;
  border-radius: 4px;
  outline: none;
}

/* Sonar Blips in Submarine style LCD Screen */
.sonar-blip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #00ff66;
  background-color: rgba(0, 255, 102, 0.2);
  position: absolute;
  cursor: pointer;
  z-index: 10;
  transform: translate(-50%, -50%);
  animation: sonar-blip-pulse 1.8s infinite ease-in-out;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sonar-blip:hover {
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 12px #00ff66;
  background-color: rgba(0, 255, 102, 0.4);
}

.sonar-blip.op {
  border-color: #00ff66;
}
.sonar-blip.iot-temp {
  border-color: #ffd740;
  background-color: rgba(255, 215, 64, 0.2);
}
.sonar-blip.iot-light {
  border-color: #00f0ff;
  background-color: rgba(0, 240, 255, 0.2);
}
.sonar-blip.iot-motion {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.2);
}
.sonar-blip.diy-ble {
  border-color: #ff00ff;
  background-color: rgba(255, 0, 255, 0.2);
}

/* Label text next to blip */
.sonar-blip-label {
  position: absolute;
  left: 16px;
  top: -4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  font-weight: bold;
  color: #00ff66;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.85);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(0, 255, 102, 0.3);
  text-shadow: 0 0 2px #00ff66;
  pointer-events: none;
}

.sonar-blip.iot-temp .sonar-blip-label {
  color: #ffd740;
  border-color: rgba(255, 215, 64, 0.3);
}
.sonar-blip.iot-light .sonar-blip-label {
  color: #00f0ff;
  border-color: rgba(0, 240, 255, 0.3);
}
.sonar-blip.iot-motion .sonar-blip-label {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}
.sonar-blip.diy-ble .sonar-blip-label {
  color: #ff00ff;
  border-color: rgba(255, 0, 255, 0.3);
}

@keyframes sonar-blip-pulse {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; box-shadow: 0 0 8px rgba(0, 255, 102, 0.5); }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.8; }
}




