/* ========================================
   HEADER.CSS - Navigation sidebar
   Portfolio Batiste Ansaldi
   VERSION CORRIGÉE - Avatar centré + Bouton repositionné
   ======================================== */

/* ========== VARIABLES SPÉCIFIQUES HEADER ========== */
:root {
  --nav-width: 320px;
  --nav-bg: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
  --nav-item-hover: rgba(13, 110, 253, 0.15);
  --toggle-size: 50px;
  --toggle-size-mobile: 45px;
  /* ✅ Couleurs du bouton toggle plus visibles */
  --toggle-bg: linear-gradient(135deg, #0066ff, #00ccff);
  --toggle-active-bg: linear-gradient(135deg, #ff4444, #ff0066);
}

/* ========== BOUTON TOGGLE - REPOSITIONNÉ ET VISIBLE ========== */
.header-toggle {
  position: fixed;
  /* ✅ CORRECTION : Position à droite pour ne pas cacher l'avatar */
  top: 25px;
  right: 25px;
  width: var(--toggle-size);
  height: var(--toggle-size);
  /* ✅ Couleurs plus vives */
  background: var(--toggle-bg);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 15px;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  /* ✅ Shadow très visible */
  box-shadow: 0 8px 30px rgba(0, 102, 255, 0.8);
}

.header-toggle:hover {
  transform: scale(1.12) rotate(5deg);
  box-shadow: 0 12px 45px rgba(0, 204, 255, 1);
  background: linear-gradient(135deg, #0080ff, #00ddff);
  border-color: rgba(255, 255, 255, 0.8);
}

.header-toggle:active {
  transform: scale(0.95);
}

.header-toggle:focus {
  outline: 3px solid rgba(0, 204, 255, 0.7);
  outline-offset: 3px;
}

.toggle-icon {
  width: 26px;
  height: 3px;
  background: #ffffff;
  border-radius: 3px;
  transition: all 0.3s ease;
  /* ✅ Shadow sur les barres pour + de contraste */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Animation du burger en X - Rouge/Rose très visible */
.header-toggle.active {
  background: var(--toggle-active-bg);
  border-color: rgba(255, 255, 255, 0.7);
  transform: rotate(90deg);
  box-shadow: 0 12px 45px rgba(255, 0, 102, 1);
}

.header-toggle.active .toggle-icon:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.header-toggle.active .toggle-icon:nth-child(2) {
  opacity: 0;
  transform: translateX(-20px);
}

.header-toggle.active .toggle-icon:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ========== NAVIGATION SIDEBAR ========== */
.main-nav {
  position: fixed;
  top: 0;
  left: calc(-1 * var(--nav-width));
  width: var(--nav-width);
  height: 100vh;
  background: var(--nav-bg);
  z-index: 1000;
  transition: left 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 5px 0 30px rgba(0, 0, 0, 0.5);
  border-right: 1px solid rgba(13, 110, 253, 0.2);
}

.main-nav.active {
  left: 0;
}

/* Scroll personnalisé */
.main-nav::-webkit-scrollbar {
  width: 8px;
}

.main-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.main-nav::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #0066ff, #00ccff);
  border-radius: 10px;
}

.main-nav::-webkit-scrollbar-thumb:hover {
  background: #0080ff;
}

/* ========== CONTENU NAVIGATION ========== */
.nav-content {
  padding: 35px 25px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ========== HEADER AVEC AVATAR - PARFAITEMENT CENTRÉ ========== */
.nav-header {
  text-align: center;
  padding-bottom: 30px;
  border-bottom: 2px solid rgba(13, 110, 253, 0.3);
  margin-bottom: 35px;
  animation: slideDown 0.6s ease;
  position: relative;
  width: 100%;
  /* ✅ CORRECTION : Flexbox pour centrage parfait */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.nav-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: #0066ff;
  box-shadow: 0 0 10px #0066ff;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ✅ CORRECTION : Avatar CENTRÉ au milieu de la sidebar */
.nav-avatar {
  width: 110px;
  height: 110px;
  /* ✅ IMPORTANT : Centrage horizontal parfait */
  margin: 0 auto 20px auto;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #0066ff;
  box-shadow: 0 0 30px rgba(0, 102, 255, 0.7);
  transition: all 0.4s ease;
  position: relative;
  /* ✅ Display block pour garantir le centrage */
  display: block;
}

.nav-avatar::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: rotate(45deg);
  transition: all 0.5s;
}

.nav-avatar:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 0 40px rgba(0, 204, 255, 0.9);
  border-color: #00ccff;
}

.nav-avatar:hover::before {
  top: 50%;
  left: 50%;
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* ✅ Display block pour garantir le centrage de l'image */
  display: block;
  transition: transform 0.4s;
}

.nav-avatar:hover img {
  transform: scale(1.1);
}

/* ✅ CORRECTION : Titre parfaitement centré */
.nav-title {
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 600;
  /* ✅ Centrage horizontal total */
  margin: 0 auto 10px auto;
  width: 100%;
  letter-spacing: 0.5px;
  text-align: center;
  display: block;
}

/* ✅ CORRECTION : Sous-titre parfaitement centré */
.nav-subtitle {
  color: #a0a0a0;
  font-size: 0.85rem;
  line-height: 1.5;
  font-weight: 300;
  /* ✅ Centrage horizontal total */
  margin: 0 auto;
  width: 100%;
  text-align: center;
  display: block;
}

/* ========== MENU PRINCIPAL ========== */
.nav-menu {
  list-style: none;
  flex: 1;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin-bottom: 8px;
  animation: fadeInLeft 0.6s ease forwards;
  opacity: 0;
}

/* Animation décalée pour chaque item */
.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.15s; }
.nav-item:nth-child(3) { animation-delay: 0.2s; }
.nav-item:nth-child(4) { animation-delay: 0.25s; }
.nav-item:nth-child(5) { animation-delay: 0.3s; }
.nav-item:nth-child(6) { animation-delay: 0.35s; }
.nav-item:nth-child(7) { animation-delay: 0.4s; }
.nav-item:nth-child(8) { animation-delay: 0.45s; }

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 500;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(180deg, #0066ff, #00ccff);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    rgba(0, 102, 255, 0.15), 
    rgba(0, 204, 255, 0.05)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-link:hover {
  background: var(--nav-item-hover);
  color: #ffffff;
  padding-left: 28px;
  transform: translateX(5px);
}

.nav-link:hover::before {
  transform: scaleY(1);
}

.nav-link:hover::after {
  opacity: 1;
}

.nav-link.active {
  background: linear-gradient(90deg, 
    rgba(0, 102, 255, 0.3), 
    rgba(0, 204, 255, 0.2)
  );
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 5px 15px rgba(0, 102, 255, 0.3);
}

.nav-link.active::before {
  transform: scaleY(1);
}

.nav-link i {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
  z-index: 1;
  transition: all 0.3s ease;
}

.nav-link:hover i {
  transform: scale(1.2) rotate(5deg);
}

.nav-link span {
  font-weight: 500;
  z-index: 1;
  letter-spacing: 0.3px;
}

/* Icônes colorées selon section */
.nav-link[href="#accueil"] i { color: #ffd700; }
.nav-link[href="#parcours-militaire"] i { color: #00d4ff; }
.nav-link[href="#certifications"] i { color: #f39c12; }
.nav-link[href="#experiences"] i { color: #9b59b6; }
.nav-link[href="#competences"] i { color: #28a745; }
.nav-link[href="#projets"] i { color: #ff6b6b; }
.nav-link[href="#veille"] i { color: #00bcd4; }
.nav-link[href="#contact"] i { color: #e74c3c; }

.nav-link.active i,
.nav-link:hover i {
  color: #ffffff;
  filter: drop-shadow(0 0 5px currentColor);
}

/* ========== RÉSEAUX SOCIAUX ========== */
.nav-social {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 25px 0;
  border-top: 2px solid rgba(13, 110, 253, 0.2);
  border-bottom: 2px solid rgba(13, 110, 253, 0.2);
  margin: 25px 0;
}

.social-link {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
  border-radius: 12px;
  font-size: 1.3rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: #0066ff;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.social-link i {
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.social-link:hover::before {
  width: 120%;
  height: 120%;
}

.social-link:hover {
  transform: translateY(-8px) scale(1.1);
  box-shadow: 0 10px 25px rgba(0, 102, 255, 0.5);
  border-color: #0066ff;
}

.social-link:hover i {
  transform: scale(1.2) rotate(10deg);
}

/* Couleurs spécifiques réseaux sociaux */
.social-link[aria-label="GitHub"]:hover::before {
  background: #333;
}

.social-link[aria-label="LinkedIn"]:hover::before {
  background: #0077b5;
}

.social-link[aria-label="Email"]:hover::before {
  background: #ea4335;
}

.social-link[aria-label="Twitter"]:hover::before {
  background: #1da1f2;
}

/* ========== FOOTER NAV ========== */
.nav-footer {
  text-align: center;
  padding-top: 20px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

.nav-footer p {
  margin: 5px 0;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.footer-version {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

/* ========== OVERLAY (MOBILE) ========== */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
  backdrop-filter: blur(8px);
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  :root {
    --nav-width: 280px;
  }

  .header-toggle {
    /* ✅ Position droite conservée sur mobile */
    top: 20px;
    right: 20px;
    width: var(--toggle-size-mobile);
    height: var(--toggle-size-mobile);
    border: 2px solid rgba(255, 255, 255, 0.7);
  }

  .toggle-icon {
    width: 24px;
  }

  .nav-content {
    padding: 25px 20px;
  }

  .nav-avatar {
    width: 90px;
    height: 90px;
  }

  .nav-title {
    font-size: 1.3rem;
  }

  .nav-subtitle {
    font-size: 0.85rem;
  }

  .nav-link {
    padding: 14px 18px;
    font-size: 0.95rem;
  }

  .social-link {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  :root {
    --nav-width: 100%;
  }

  .header-toggle {
    top: 15px;
    right: 15px;
    width: 42px;
    height: 42px;
  }

  .toggle-icon {
    width: 22px;
    height: 2.5px;
  }

  .nav-avatar {
    width: 80px;
    height: 80px;
  }

  .nav-title {
    font-size: 1.2rem;
  }

  .nav-link {
    padding: 12px 16px;
    gap: 15px;
  }

  .nav-link i {
    font-size: 1.2rem;
    width: 24px;
  }
}

/* ========== ÉTAT BODY QUAND NAV OUVERTE ========== */
body.nav-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  body.nav-open {
    position: fixed;
    width: 100%;
  }
}

/* ========== ANIMATIONS SUPPLÉMENTAIRES ========== */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.main-nav.active .nav-avatar {
  animation: pulse 2s ease-in-out infinite;
}

/* Effet de vague sur le menu */
@keyframes wave {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.nav-link:hover span {
  animation: wave 0.6s ease;
}