/* ============================================================
   ORBITAL OVERWATCH - THEME "EARTH ORBIT" (FINAL + JUICE)
   ============================================================ */
:root {
  --bg-space: #020203; 
  --hud-primary: #00F0FF; 
  --hud-secondary: #008F99;
  --hud-alert: #FF2A2A;
  --hud-dim: rgba(0, 240, 255, 0.15);
  --glass: rgba(8, 12, 16, 0.85);
  --atmosphere-color: rgba(0, 180, 255, 0.25);
  
  --font-tech: 'Rajdhani', sans-serif;
  --font-data: 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0; height: 100vh; overflow: hidden;
  background: var(--bg-space);
  color: var(--hud-primary);
  font-family: var(--font-tech);
}

/* --- 0. BOOT SCREEN (INTRO) --- */
#boot-screen {
  position: fixed; inset: 0; z-index: 99999;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-data);
}
.boot-terminal { width: 300px; max-width: 90vw; }
.boot-terminal .line {
  color: var(--hud-primary); opacity: 0;
  margin-bottom: 5px; font-size: 14px;
  animation: typeLine 0.1s forwards;
}
.boot-terminal .ok { color: #00FF94; margin-left: 10px; }
/* Délais d'apparition */
.d-1 { animation-delay: 0.5s !important; }
.d-2 { animation-delay: 1.2s !important; }
.d-3 { animation-delay: 2.0s !important; }
.d-4 { animation-delay: 2.8s !important; }

@keyframes typeLine { from{opacity:0; transform:translateX(-10px);} to{opacity:1; transform:translateX(0);} }

/* --- 1. PLANÈTE & ESPACE --- */
.deep-space-bg {
  position: fixed; inset: 0; z-index: -2;
  background: 
    radial-gradient(1px 1px at 10% 10%, white, transparent),
    radial-gradient(1px 1px at 20% 20%, white, transparent),
    radial-gradient(2px 2px at 50% 50%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 80% 80%, white, transparent);
  background-size: 550px 550px;
  opacity: 0.5;
}

.planet-horizon {
  position: fixed; bottom: -75vh; left: -50%; right: -50%; height: 100vh;
  background: radial-gradient(circle at 50% 0%, #000810 20%, #000 100%);
  border-radius: 50% 50% 0 0; z-index: -1; 
  box-shadow: 0 -10px 40px rgba(0, 100, 255, 0.1), inset 0 10px 80px rgba(0, 0, 0, 0.9);
}

.atmosphere-glow {
  position: absolute; inset: 0; border-radius: 50% 50% 0 0;
  box-shadow: 0 -20px 60px var(--atmosphere-color), 0 -2px 10px rgba(255, 255, 255, 0.15);
  animation: breatheAtmosphere 8s ease-in-out infinite; opacity: 0.9;
}
@keyframes breatheAtmosphere {
  0%, 100% { box-shadow: 0 -20px 60px rgba(0, 150, 255, 0.2), 0 -2px 5px rgba(255,255,255,0.1); }
  50% { box-shadow: 0 -35px 90px rgba(0, 200, 255, 0.4), 0 -4px 15px rgba(255,255,255,0.3); }
}

#worldCanvas { position: fixed; inset: 0; z-index: 0; cursor: crosshair; }

/* --- 2. HUD UI --- */
.hud-layer {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; justify-content: space-between;
  pointer-events: none; 
}
button, a, summary, details, .hud-panel, .data-card, #mw-root { pointer-events: auto !important; }

/* Top Bar */
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px; width: 100%; }

.glass-panel {
  background: var(--glass); border: 1px solid var(--hud-dim);
  backdrop-filter: blur(12px); box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  border-radius: 4px; display: flex; align-items: center; gap: 12px; padding: 8px 12px;
}
.glass-panel:hover { border-color: var(--hud-primary); box-shadow: 0 0 15px var(--hud-dim); }

.tactical-btn {
  background: rgba(0,0,0,0.3); border: 1px solid var(--hud-dim);
  color: var(--hud-primary); font-family: var(--font-data);
  height: 36px; min-width: 36px; padding: 0 12px;
  cursor: pointer; font-weight: 700; transition: 0.2s;
  display: grid; place-items: center; border-radius: 2px;
}
.tactical-btn:hover { background: var(--hud-primary); color: #000; }
.tactical-btn.icon { font-size: 16px; padding: 0; }
.tactical-btn.warning:hover { background: var(--hud-alert); color: white; border-color: var(--hud-alert); }

.status-block { display: flex; flex-direction: column; line-height: 1; }
.status-block .label { font-size: 9px; opacity: 0.7; letter-spacing: 1px; }
.status-block .val { font-size: 14px; font-weight: 800; font-family: var(--font-data); }
.blink-slow { animation: blink 3s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.4} }
.green { color: #00FF94; text-shadow: 0 0 8px rgba(0,255,148,0.4); }

.tactical-selector { position: relative; }
.tactical-summary {
  list-style: none; cursor: pointer; font-weight: 700; letter-spacing: 2px;
  display: flex; gap: 8px; align-items: center;
}
.tactical-summary::-webkit-details-marker { display: none; }
.brackets { opacity: 0.5; font-family: var(--font-data); }
.tactical-dropdown {
  position: absolute; top: 45px; left: 50%; transform: translateX(-50%);
  width: 240px; background: #05080a; border: 1px solid var(--hud-primary);
  box-shadow: 0 0 30px rgba(0,0,0,0.8); z-index: 100; display: none;
}
details[open] .tactical-dropdown { display: block; animation: slideDown 0.2s ease-out; }
@keyframes slideDown { from{opacity:0;transform:translateX(-50%) translateY(-10px);} to{opacity:1;transform:translateX(-50%) translateY(0);} }

.t-item {
  display: block; padding: 12px 16px; color: #889; text-decoration: none;
  border-bottom: 1px solid #1a1d20; font-size: 14px; transition: .2s;
}
.t-item:hover, .t-item.active { background: var(--hud-dim); color: #fff; padding-left: 20px; }

/* --- 3. BOUTONS & BOTTOM BAR --- */
.scan-container { position: relative; display: flex; justify-content: center; }
.scan-btn {
  position: relative; height: 44px; padding: 0 30px;
  background: rgba(0, 240, 255, 0.05); border: 1px solid var(--hud-primary);
  color: var(--hud-primary); font-family: var(--font-tech); font-weight: 700; letter-spacing: 2px;
  cursor: pointer; overflow: hidden; transition: 0.3s;
  clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
}
.scan-btn:hover { background: var(--hud-primary); color: #000; box-shadow: 0 0 20px var(--hud-primary); }
.scan-btn[aria-busy="true"] .scan-ring {
  position: absolute; bottom: 0; left: 0; height: 2px; width: 100%;
  background: #fff; animation: scanMove 1s infinite linear;
}
@keyframes scanMove { 0%{transform:translateY(0)} 100%{transform:translateY(-44px)} }

/* SCAN WAVE EFFECT */
.scan-wave {
  position: fixed; top: 50%; left: 50%; width: 0; height: 0;
  border-radius: 50%; border: 2px solid var(--hud-primary);
  opacity: 1; transform: translate(-50%, -50%); pointer-events: none; z-index: 5;
}
@keyframes shockwave {
  0% { width: 0; height: 0; opacity: 1; border-width: 5px; }
  100% { width: 200vw; height: 200vw; opacity: 0; border-width: 0px; }
}

.tactical-bottom {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 20px 30px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); 
}

.hud-circle {
  width: 48px; height: 48px; border-radius: 50%;
  background: #0a0f14; border: 1px solid #334; color: #fff;
  display: grid; place-items: center; font-size: 20px; cursor: pointer;
  position: relative; transition: .3s;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.hud-circle:hover { border-color: var(--hud-primary); color: var(--hud-primary); transform: translateY(-2px); }
.dot-badge {
  position: absolute; top: 0; right: 0; width: 10px; height: 10px;
  background: var(--hud-alert); border-radius: 50%; border: 1px solid #000;
}

/* --- 4. POPUP PROFIL (CENTRAGE FORCÉ) --- */
.data-card {
  position: fixed; 
  top: 50% !important; left: 50% !important; 
  transform: translate(-50%, -50%) !important; margin: 0 !important;
  width: 380px; max-width: 90vw;
  background: rgba(5, 7, 9, 0.96); border: 1px solid var(--hud-secondary);
  box-shadow: 0 0 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(0, 240, 255, 0.05);
  z-index: 200; display: flex; flex-direction: column;
  backdrop-filter: blur(10px);
}
.data-card.hidden { display: none !important; }
.data-card.show { display: flex !important; animation: holoPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes holoPop { from{transform:translate(-50%,-40%) scale(0.9); opacity:0;} to{transform:translate(-50%,-50%) scale(1); opacity:1;} }

.card-header { padding: 16px; border-bottom: 1px solid #223; display: flex; gap: 15px; align-items: center; }
.card-avatar { 
  width: 50px; height: 50px; background: #111; border: 1px solid var(--hud-primary); 
  display: grid; place-items: center; font-weight: bold; color: #fff; 
}
.card-name { font-size: 18px; font-weight: 700; color: #fff; }
.card-sub { font-family: var(--font-data); font-size: 12px; color: var(--hud-secondary); }
.card-body { padding: 16px; max-height: 40vh; overflow-y: auto; color: #ccc; line-height: 1.5; }
.card-title { color: var(--hud-primary); font-weight: bold; margin-bottom: 6px; display: block;}
.card-footer { padding: 16px; display: flex; gap: 10px; border-top: 1px solid #223; background: rgba(0,0,0,0.2); }
.full { flex: 1; }
.card-close { position: absolute; top: 0; right: 0; width: 30px; height: 30px; background: var(--hud-alert); border: none; color: white; cursor: pointer; font-weight: bold; }

/* --- 5. PANNEAUX NOTIFS --- */
.hud-panel {
  position: absolute; top: 70px; right: 20px; width: 320px;
  background: #080a0c; border: 1px solid var(--hud-secondary);
  border-left: 3px solid var(--hud-primary);
  z-index: 90; display: none;
  box-shadow: -10px 10px 30px rgba(0,0,0,0.8);
}
.hud-panel:not(.hidden) { display: block; animation: slideLeft 0.2s ease; }
.panel-header { padding: 10px 15px; background: rgba(0,240,255,0.05); border-bottom: 1px solid #223; display: flex; justify-content: space-between; }
.h-title { font-family: var(--font-data); color: var(--hud-primary); font-weight: bold; }
.list .item { padding: 12px; border-bottom: 1px solid #222; cursor: pointer; }
.list .item:hover { background: rgba(255,255,255,0.05); }

#mw-root { position: fixed; right: 20px; bottom: 100px; z-index: 80; }
.mw-toggle { 
  background: #000; border: 1px solid var(--hud-primary); color: #fff; 
  padding: 8px 16px; font-family: var(--font-data); font-weight: bold;
  box-shadow: 0 0 15px rgba(0,240,255,0.1); display: flex; align-items: center; gap: 10px; cursor: pointer;
}

/* --- 6. MOBILE --- */
.mobile-only { display: none; }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: grid !important; }
  .hud-top { padding: 10px; }
  .hud-module { padding: 6px 10px; }
  
  .tactical-bottom { padding: 10px 15px 20px 15px; align-items: center; gap: 15px; }
  .scan-container { flex: 1; order: 2; }
  .scan-btn { width: 100%; height: 50px; font-size: 16px; }

  .hud-controls-bottom { width: 100%; justify-content: space-between; order: 1; display: contents; }
  #mobBtnMatches { order: 1; }
  #mobBtnMessages { order: 3; }
  
  #mw-root { bottom: 90px; right: 10px; }
  .data-card { width: 94%; }
}

.hidden { display: none !important; }
