/* ==========================================================================
   Module AR Moteur Hemi - Styles
   ========================================================================== */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

/* ==========================================================================
   Header
   ========================================================================== */
header {
  padding: 1rem;
  text-align: center;
  background: #16213e;
  border-bottom: 2px solid #0f3460;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

header p {
  font-size: 0.85rem;
  color: #aaa;
}

/* ==========================================================================
   Navigation phases pedagogiques
   ========================================================================== */
.phases-nav {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 1rem;
  background: #0f3460;
  border-bottom: 1px solid #1a4d7c;
  overflow-x: auto;
}

.phase-btn {
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: #7ec8e3;
  border: 1px solid #1a4d7c;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.phase-btn:hover {
  background: rgba(126, 200, 227, 0.1);
  border-color: #7ec8e3;
}

.phase-btn.active {
  background: #e94560;
  color: #fff;
  border-color: #e94560;
}

.phase-btn .phase-num {
  font-weight: 700;
  margin-right: 0.3rem;
}

/* ==========================================================================
   Bandeau de consigne pedagogique
   ========================================================================== */
.consigne-bandeau {
  background: #0f3460;
  padding: 0.8rem 1rem;
  text-align: center;
  border-bottom: 1px solid #1a4d7c;
}

.consigne-bandeau p {
  font-size: 0.9rem;
  color: #7ec8e3;
  font-style: normal;
  line-height: 1.4;
}

.consigne-bandeau strong {
  color: #fff;
  font-style: normal;
}

.consigne-bandeau em {
  color: #e94560;
  font-style: normal;
  font-weight: 600;
}

/* ==========================================================================
   Controles d'etat
   ========================================================================== */
.state-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-wrap: wrap;
}

.state-btn {
  padding: 0.5rem 1rem;
  background: #1a4d7c;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.state-btn:hover {
  background: #2a6d9c;
}

.state-btn.active {
  background: #e94560;
  box-shadow: 0 2px 8px rgba(233, 69, 96, 0.4);
}

.state-btn .state-label {
  font-weight: 600;
}

.state-btn .state-desc {
  font-size: 0.7rem;
  opacity: 0.8;
  display: block;
  margin-top: 0.1rem;
}

/* ==========================================================================
   Vues expertes predefinies
   ========================================================================== */
.expert-views {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #1a1a2e;
  border-bottom: 1px solid #0f3460;
  flex-wrap: wrap;
}

.expert-views-label {
  font-size: 0.75rem;
  color: #7ec8e3;
  margin-right: 0.3rem;
}

.view-btn {
  padding: 0.3rem 0.6rem;
  background: transparent;
  color: #aaa;
  border: 1px solid #333;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn:hover {
  background: rgba(126, 200, 227, 0.1);
  border-color: #7ec8e3;
  color: #7ec8e3;
}

.view-btn:active {
  background: #7ec8e3;
  color: #1a1a2e;
}

/* ==========================================================================
   Viewer 3D
   ========================================================================== */
.viewer-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 320px);
  min-height: 300px;
}

model-viewer {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Loader */
model-viewer .progress-bar {
  display: block;
  height: 4px;
  background: #e94560;
}

/* Bouton AR */
.ar-button {
  position: absolute;
  bottom: 16px;
  right: 16px;
  padding: 0.7rem 1.2rem;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.4);
}

.ar-button:hover {
  background: #ff6b6b;
}

.ar-button[hidden] {
  display: none;
}

/* ==========================================================================
   Hotspots pedagogiques
   ========================================================================== */
.hotspot {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e94560;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.2s ease;
  animation: hotspot-pulse 2s ease-in-out infinite;
}

/* Animation de pulsation pour attirer l'attention */
@keyframes hotspot-pulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 0 rgba(233, 69, 96, 0.6);
  }
  50% {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 8px rgba(233, 69, 96, 0);
  }
}

.hotspot:hover {
  transform: scale(1.2);
  animation: none;
}

.hotspot-annotation {
  position: absolute;
  background: rgba(22, 33, 62, 0.95);
  color: #fff;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  max-width: 180px;
  pointer-events: none;
  transform: translateX(-50%);
  margin-top: 8px;
  border: 1px solid #0f3460;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hotspot-annotation::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(22, 33, 62, 0.95);
}

.hotspot-annotation strong {
  display: block;
  color: #e94560;
  margin-bottom: 0.2rem;
}

/* Hotspot visible uniquement au survol */
.hotspot .hotspot-annotation {
  display: none;
}

.hotspot:hover .hotspot-annotation,
.hotspot:focus .hotspot-annotation {
  display: block;
}

/* ==========================================================================
   Footer & Legende
   ========================================================================== */
footer {
  padding: 0.8rem 1rem;
  background: #16213e;
  border-top: 2px solid #0f3460;
  font-size: 0.75rem;
  color: #888;
  text-align: center;
}

footer strong {
  color: #e94560;
}

.legende {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.legende-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legende-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
  header h1 {
    font-size: 1.2rem;
  }

  .phases-nav {
    justify-content: flex-start;
    padding: 0.5rem;
  }

  .phase-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }

  .consigne-bandeau p {
    font-size: 0.8rem;
  }

  .state-controls {
    gap: 0.3rem;
  }

  .state-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  .state-btn .state-desc {
    display: none;
  }

  .viewer-container {
    height: calc(100vh - 300px);
    min-height: 250px;
  }

  .expert-views {
    padding: 0.4rem 0.5rem;
    gap: 0.3rem;
  }

  .expert-views-label {
    display: none;
  }

  .view-btn {
    padding: 0.25rem 0.4rem;
    font-size: 0.65rem;
  }

  .hotspot-annotation {
    max-width: 150px;
    font-size: 0.75rem;
  }

  .legende {
    gap: 0.5rem;
  }

  .legende-item {
    font-size: 0.7rem;
  }
}
