/* ── PANOPTES — FBI / Gov XP Theme ──────────────── */
:root {
  --panel-w:     400px;
  --header-h:    48px;

  /* Couleurs gouvernementales */
  --gov-blue:    #1c4a9e;
  --gov-blue2:   #0f2d6b;
  --gov-blue3:   #2a66cc;
  --win-gray:    #d4d0c8;
  --win-gray2:   #ece9d8;
  --win-gray3:   #f0ede4;
  --win-dark:    #808080;
  --win-black:   #1a1a1a;
  --win-white:   #ffffff;
  --status-red:  #cc0000;
  --status-grn:  #007700;
  --status-amber:#cc7700;
  --accent:      #1c4a9e;
  --text:        #0a0a0a;
  --text-dim:    #4a5060;

  /* Bordures style Windows classique */
  --b-out: 2px solid;
  --b-in:  inset 1px 1px 0 #ffffff, inset -1px -1px 0 #808080;
}

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

body {
  background: #a8adb8;
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  font-size: 12px;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ── Header — barre titre gouvernementale ─────── */
#header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: linear-gradient(180deg,
    #3a72e0 0%, var(--gov-blue) 45%, var(--gov-blue2) 100%);
  border-bottom: 2px solid #0a1f50;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  flex-shrink: 0;
  z-index: 900;
}

#logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#logo-eye {
  width: 28px; height: 17px;
  filter: brightness(0) invert(1) drop-shadow(0 0 3px rgba(255,255,255,0.6));
}

.logo-text {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 5px;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(255,255,255,0.4);
}

/* Badge "SYSTÈME DE SURVEILLANCE" */
#header::before {
  content: 'SYSTÈME DE SURVEILLANCE MONDIAL v2.1';
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: rgba(180,210,255,0.7);
  letter-spacing: 2px;
  white-space: nowrap;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ── Search ───────────────────────────────────── */
#search-wrap {
  position: relative;
  flex: 1;
  max-width: 340px;
}

#search-input {
  width: 100%;
  background: #ffffff;
  border: none;
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
  border-right: 1px solid #dfdfdf;
  border-bottom: 1px solid #dfdfdf;
  color: var(--text);
  padding: 5px 10px;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 11px;
  outline: none;
}
#search-input::placeholder { color: #888; }
#search-input:focus {
  border-color: var(--gov-blue);
  outline: 1px solid var(--gov-blue);
}

#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: #ffffff;
  border: 1px solid #404040;
  border-top: none;
  max-height: 260px;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.35);
}

.sr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 11px;
  border-bottom: 1px solid #e0e0e0;
  gap: 12px;
}
.sr-item:hover { background: #316ac5; color: #fff; }
.sr-item:hover .sr-loc { color: #c8d8ff; }
.sr-item .sr-name { color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-item .sr-loc  { color: #666; font-size: 10px; flex-shrink: 0; }
.sr-empty { padding: 8px 10px; color: #666; font-size: 11px; }

/* ── Stats bar ────────────────────────────────── */
#stats-bar {
  display: flex;
  gap: 16px;
  font-size: 10px;
  color: #b8d4ff;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  font-family: 'Courier New', monospace;
}
#stats-bar span { display: flex; align-items: center; gap: 5px; }
#stats-bar span::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #00ff44;
  box-shadow: 0 0 5px #00ff44;
  animation: blink 2s step-end infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }

/* ── Main ─────────────────────────────────────── */
#main { display: flex; flex: 1; overflow: hidden; }

/* ── Map ──────────────────────────────────────── */
#map-wrap { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }
.leaflet-tile-pane { filter: none; }

/* Cadre "écran" autour de la carte */
#map-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.3);
  z-index: 400;
  pointer-events: none;
}

#map-badge {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: var(--win-gray2);
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
  padding: 4px 10px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: var(--text);
  z-index: 500;
  pointer-events: none;
}

/* ── Points caméras — rouges style enregistrement ── */
.cam-dot {
  width: 12px;
  height: 12px;
  background: radial-gradient(circle at 35% 30%, #ff6666, #cc0000);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform .12s;
}
.cam-dot:hover {
  transform: scale(1.8);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 0 8px rgba(220,0,0,0.8);
}

/* ── Clusters — style XP ──────────────────────── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(28,74,158,0.80) !important;
  border: 2px solid #fff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5) !important;
}
.marker-cluster-small  div,
.marker-cluster-medium div,
.marker-cluster-large  div {
  background: transparent !important;
  color: #ffffff !important;
  font-family: Tahoma, Arial, sans-serif !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8) !important;
}

/* ── Popup ────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--win-gray2) !important;
  border: 2px solid #808080 !important;
  border-top-color: #ffffff !important;
  border-left-color: #ffffff !important;
  border-radius: 0 !important;
  color: var(--text) !important;
  font-family: Tahoma, Arial, sans-serif !important;
  font-size: 11px !important;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.4) !important;
  padding: 0 !important;
}
.leaflet-popup-content { margin: 0 !important; padding: 8px 12px !important; }
.leaflet-popup-tip-container { display: none !important; }
.leaflet-popup-close-button {
  color: #000 !important;
  top: 3px !important; right: 4px !important;
  font-size: 14px !important;
}
.popup-title { font-size: 11px; font-weight: 700; color: #000; margin-bottom: 3px; }
.popup-loc   { font-size: 10px; color: #444; margin-bottom: 8px; font-family: 'Courier New', monospace; }
.popup-btn {
  display: block; width: 100%;
  background: linear-gradient(180deg, #f0ede4 0%, #d4d0c8 100%);
  border-top: 1px solid #ffffff;
  border-left: 1px solid #ffffff;
  border-right: 1px solid #808080;
  border-bottom: 1px solid #808080;
  color: var(--text);
  padding: 4px 8px;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 11px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
}
.popup-btn:hover { background: linear-gradient(180deg, #e0dccc 0%, #c4c0b8 100%); }
.popup-btn:active {
  border-top-color: #808080; border-left-color: #808080;
  border-right-color: #ffffff; border-bottom-color: #ffffff;
}

/* ── Leaflet zoom controls ────────────────────── */
.leaflet-control-zoom a {
  background: linear-gradient(180deg, #f0ede4 0%, #d4d0c8 100%) !important;
  border: none !important;
  border-top: 1px solid #fff !important;
  border-left: 1px solid #fff !important;
  border-right: 1px solid #808080 !important;
  border-bottom: 1px solid #808080 !important;
  border-radius: 0 !important;
  color: #000 !important;
  font-size: 14px !important;
  width: 22px !important;
  height: 22px !important;
  line-height: 20px !important;
  display: block !important;
}
.leaflet-control-zoom a:hover {
  background: linear-gradient(180deg, #e0f0ff 0%, #b8d4f8 100%) !important;
}
.leaflet-control-zoom {
  border: none !important;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.3) !important;
}

/* ── Right panel — fenêtre dialog XP ─────────── */
#panel {
  width: var(--panel-w);
  background: var(--win-gray2);
  border-left: 3px solid #808080;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width .25s ease, opacity .25s ease;
  box-shadow: -2px 0 8px rgba(0,0,0,0.3);
}
#panel.closed { width: 0; opacity: 0; border-left: none; }

/* Barre de titre Windows */
#panel-header {
  background: linear-gradient(180deg, #3a72e0 0%, var(--gov-blue) 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 8px;
  flex-shrink: 0;
}
#panel-location {
  font-size: 9px;
  color: rgba(180,210,255,0.85);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 3px;
  font-family: 'Courier New', monospace;
}
#panel-title {
  font-size: 12px;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.3;
  font-family: Tahoma, Arial, sans-serif;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
#btn-close {
  background: linear-gradient(180deg, #f0ede4 0%, #d4d0c8 100%);
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #404040;
  border-bottom: 1px solid #404040;
  color: #000;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  min-width: 18px;
  height: 16px;
  flex-shrink: 0;
  line-height: 14px;
  font-family: Tahoma, Arial, sans-serif;
}
#btn-close:active {
  border-top-color: #404040; border-left-color: #404040;
  border-right-color: #fff; border-bottom-color: #fff;
}

/* Zone stream */
#panel-stream {
  flex: 1;
  background: #000;
  position: relative;
  overflow: hidden;
  border-top: 1px solid #404040;
  border-bottom: 1px solid #404040;
}

#placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  background: #0a0a0a;
}
#placeholder svg { width: 60px; opacity: .15; }
#placeholder p {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: #446622;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#stream-box { position: absolute; inset: 0; }
#loading-stream {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000; z-index: 2;
}
.spinner {
  width: 24px; height: 24px;
  border: 2px solid #333;
  border-top-color: var(--gov-blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#cam-frame { width: 100%; height: 100%; border: none; display: block; }

/* Bande de métadonnées */
#panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 12px;
  background: var(--win-gray);
  border-top: 1px solid #ffffff;
  flex-shrink: 0;
}
.meta-col { display: flex; flex-direction: column; gap: 2px; }
.mlabel {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: Tahoma, Arial, sans-serif;
}
.mval {
  font-size: 11px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  letter-spacing: .3px;
}
.live { color: var(--status-grn); font-weight: 700; }
.live::before { content: '● '; animation: blink 1.5s step-end infinite; }

/* ── Scrollbar classique ──────────────────────── */
::-webkit-scrollbar       { width: 16px; }
::-webkit-scrollbar-track { background: #d4d0c8; border: 1px solid #a0a0a0; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #f0ede4, #c4c0b8);
  border: 1px solid #808080;
  border-top-color: #fff;
  border-left-color: #fff;
}
::-webkit-scrollbar-button { background: #d4d0c8; border: 1px solid #808080; }

/* ── Attribution ──────────────────────────────── */
.leaflet-control-attribution {
  background: rgba(212,208,200,0.9) !important;
  border-top: 1px solid #808080 !important;
  border-left: 1px solid #808080 !important;
  color: #333 !important;
  font-size: 9px !important;
  font-family: Tahoma, Arial, sans-serif !important;
  padding: 2px 6px !important;
  border-radius: 0 !important;
}
