/**
 * Profile Menu Button - Bouton + flottant avec menu profil
 * Design: Noir translucide, simple, minimaliste
 */

/* Conteneur principal du bouton + */
.profile-menu-btn-container {
  position: fixed;
  top: calc(90px + env(safe-area-inset-top)); /* Juste en dessous du header + safe area PWA */
  right: 20px;
  z-index: 9998; /* En dessous du popup pedia (9999) mais au-dessus du reste */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Positionnement mobile adaptatif */
@media (max-width: 768px) {
  .profile-menu-btn-container {
    top: calc(90px + env(safe-area-inset-top)); /* Header = 64px + marge + safe area */
    right: calc(16px + env(safe-area-inset-right));
  }

  /* Position alternative quand la sphère pedia est en haut à droite */
  .profile-menu-btn-container.alt-position {
    top: calc(90px + env(safe-area-inset-top));
    left: calc(16px + env(safe-area-inset-left));
    right: auto;
  }
}

/* Le bouton + circulaire */
.profile-menu-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); /* Noir translucide (45% opacité) */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 24px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

/* Effet hover sur desktop */
@media (hover: hover) {
  .profile-menu-btn:hover {
    background: rgba(0, 0, 0, 0.65); /* Légèrement plus opaque au hover */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
  }
}

/* État actif (menu ouvert) */
.profile-menu-btn.active {
  background: rgba(0, 0, 0, 0.7); /* Plus opaque quand ouvert */
  transform: rotate(45deg);
}

/* Animation du symbole + vers × */
.profile-menu-btn-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-menu-btn.active .profile-menu-btn-icon {
  transform: rotate(90deg);
}

/* Menu déroulant */
.profile-menu-dropdown {
  position: absolute;
  top: 60px;
  right: 0;
  background: rgba(0, 0, 0, 0.65); /* Translucide comme le bouton */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  padding: 8px;
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* Menu visible */
.profile-menu-dropdown.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: all;
}

/* Positionnement mobile du menu */
@media (max-width: 768px) {
  .profile-menu-dropdown {
    min-width: 260px;
    right: 0;
  }

  /* Menu à gauche quand le bouton est en position alternative */
  .profile-menu-btn-container.alt-position .profile-menu-dropdown {
    left: 0;
    right: auto;
  }
}

/* Items du menu */
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

/* Effet hover sur les items */
@media (hover: hover) {
  .profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
  }
}

/* État actif sur mobile (touch) */
.profile-menu-item:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.98);
}

/* Icône de l'item (SVG) */
.profile-menu-item-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-menu-item-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: 0.9;
}

/* Texte de l'item */
.profile-menu-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

/* Titre de l'item */
.profile-menu-item-title {
  font-weight: 500;
  font-size: 14px;
  color: white;
}

/* Sous-titre de l'item (nom de l'enfant) */
.profile-menu-item-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

/* Séparateur entre les items */
.profile-menu-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

/* Animation d'apparition */
@keyframes profileMenuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation de disparition */
@keyframes profileMenuSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Cache le bouton sur certaines pages */
.profile-menu-btn-container.hidden {
  display: none !important;
}

/* Cache le bouton au scroll vers le bas (comme le header) */
.profile-menu-btn-container.hide-on-scroll {
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
}

/* Réduction de mouvement pour accessibilité */
@media (prefers-reduced-motion: reduce) {
  .profile-menu-btn-container,
  .profile-menu-btn,
  .profile-menu-dropdown,
  .profile-menu-item {
    transition: none !important;
    animation: none !important;
  }
}
