/* ==========================================================
   1 — FOND AUTOUR DU CADRE (extérieur de la scène 3D)
   ========================================================== */

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #0a0a0a;
}

/* ==========================================================
   2 — STRUCTURE INTERNE DE L’IFRAME
   ========================================================== */

.map-selector-body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #03e9f4;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Yantramanav', sans-serif;
}

/* ==========================================================
   3 — GLOBE 3D (WebGL)
   ========================================================== */

#xr-orbit-container {
  width: 100%;
  height: 100%;
  pointer-events: auto;
  position: absolute;
  inset: 0;
  z-index: 2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: xrGlowPulse 8s ease-in-out infinite;
}

#xr-orbit-container canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
}

@keyframes xrGlowPulse {
  0%   { background-color: rgba(0, 20, 40, 0.10); }
  50%  { background-color: rgba(0, 20, 40, 0.16); }
  100% { background-color: rgba(0, 20, 40, 0.10); }
}

/* ==========================================================
   SCAN HOLOGRAPHIQUE HORIZONTAL
   ========================================================== */

#xr-orbit-container::after {
  content: "";
  position: absolute;
  left: 0;
  top: -20%;
  width: 100%;
  height: 3px;
  background: rgba(3, 233, 244, 0.35);
  box-shadow:
    0 0 6px rgba(3, 233, 244, 0.35),
    0 0 12px rgba(3, 233, 244, 0.25),
    0 0 24px rgba(3, 233, 244, 0.15);
  filter: blur(1px);
  animation: xrScanHorizontal 26s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes xrScanHorizontal {
  0%   { top: -20%; }
  100% { top: 120%; }
}


/* ==========================================================
   4 — CADRE PREMIUM
   ========================================================== */

.xr-frame {
  position: absolute;
  inset: 1vh 4vw;
  border-radius: 22px;
  border: 1px solid rgba(3, 233, 244, 0.18);
  box-shadow:
    0 0 22px rgba(3, 233, 244, 0.08),
    inset 0 0 18px rgba(3, 233, 244, 0.05);
  background: rgba(0, 10, 25, 0.25);
  backdrop-filter: blur(6px);
  overflow: visible;
  z-index: 1;
}

/* ==========================================================
   5 — TOOLTIP DES HEXAGONES
   ========================================================== */

.hex-label {
  position: absolute;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(3, 233, 244, 0.4);
  border-radius: 6px;
  color: #03e9f4;
  font-size: 14px;
  pointer-events: none;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.15s ease-out;
  white-space: nowrap;
  z-index: 20;
}

/* ==========================================================
   6 — PANELS XR
   ========================================================== */

.xr-panel {
  position: absolute;
  inset: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(3, 233, 244, 0.18);
  box-shadow:
    0 0 22px rgba(3, 233, 244, 0.08),
    inset 0 0 18px rgba(3, 233, 244, 0.05);
  overflow-y: auto;
  display: none;
  z-index: 50;
  color: #03e9f4;
  padding: 40px;

  opacity: 0;
  transform: translateY(12px) scale(1.03);
  animation: panelFadeIn 0.45s cubic-bezier(0.16, 0.84, 0.44, 1) forwards;
}

/* ==========================================================
   7 — BOUTON RETOUR (NOUVELLE VERSION)
   ========================================================== */

/* Zone sécurisée en bas */
#xr-footer {
  position: absolute;
  bottom: 1.5vh;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  padding-left: 2vw;
  z-index: 2000;
  pointer-events: none; /* ne bloque pas la scène */
}

/* Bouton Retour */
#xr-footer .panel-back {
  position: relative;
  pointer-events: auto; /* bouton cliquable */
  padding: 10px 16px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(3,233,244,0.4);
  border-radius: 6px;
  color: #03e9f4;
  cursor: pointer;
  display: none;
  backdrop-filter: blur(6px);
  transition: all 0.25s ease;
}

#xr-footer .panel-back:hover {
  background: rgba(0,0,0,0.75);
  border-color: rgba(3,233,244,0.75);
  box-shadow:
    0 0 8px rgba(3,233,244,0.45),
    0 0 16px rgba(3,233,244,0.25);
  transform: translateY(-1px);
}

/* Mobile : centré */
@media (max-width: 768px) {
  #xr-footer {
    justify-content: center;
    padding-left: 0;
  }

  #xr-footer .panel-back {
    padding: 8px 14px;
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  #xr-footer .panel-back {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ==========================================================
   8 — NETWORK CANVAS
   ========================================================== */

#networkCanvasMap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: transparent;
}

.xr-frame canvas:not(#networkCanvasMap) {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ==========================================================
   9 — TITRES
   ========================================================== */

#map-vision-title,
#map-vision-name {
  position: absolute;
  top: 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  color: rgba(3, 233, 244, 0.55);
  text-shadow: 0 0 6px rgba(3, 233, 244, 0.35);
  opacity: 0;
  animation: titleFadeIn 2.5s ease forwards 1.2s;
  pointer-events: none;
  z-index: 10;
}

#map-vision-title { left: 16px; }
#map-vision-name { right: 16px; }

/* ⭐ Animation */
@keyframes titleFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 📱 Mobile medium */
@media (max-width: 768px) {
  #map-vision-title,
  #map-vision-name {
    top: 8px;
    font-size: 11px;        /* plus petit */
    letter-spacing: 2px;    /* plus compact */
  }

  #map-vision-title { left: 10px; }
  #map-vision-name { right: 10px; }
}

/* 📱 Mobile small (paysage inclus) */
@media (max-width: 480px) {
  #map-vision-title,
  #map-vision-name {
    top: 6px;
    font-size: 9px;         /* ultra compact */
    letter-spacing: 1.5px;
    text-shadow: 0 0 4px rgba(3, 233, 244, 0.25);
  }

  #map-vision-title { left: 8px; }
  #map-vision-name { right: 8px; }
}


/* ==========================================================
   10 — LÉGENDE
   ========================================================== */

#legendBar {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  z-index: 20;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(3, 233, 244, 0.25);
}

/* 📱 Mobile medium */
@media (max-width: 768px) {
  #legendBar {
    bottom: 14px;
    padding: 6px 10px;
    font-size: 11px;
    gap: 10px;
    border-radius: 10px;

    /* plus léger */
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(3, 233, 244, 0.18);
    backdrop-filter: blur(4px);
  }
}

/* 📱 Mobile small (paysage inclus) */
@media (max-width: 480px) {
  #legendBar {
    bottom: 8px;
    padding: 4px 8px;
    font-size: 9.5px;
    gap: 6px;
    border-radius: 8px;

    /* ultra compact */
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(3, 233, 244, 0.12);
    backdrop-filter: blur(3px);
  }
}


/* ==========================================================
   11 — PANEL GLOBAL
   ========================================================== */

.xr-panel-global {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  display: none;
  z-index: 999;
  overflow: hidden;
}

.xr-panel-global iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
