/* Action Wheel - FAB et Menu Contextuel */

.action-wheel-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary, var(--accent-primary));
  color: var(--text-on-accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  /* Au-dessus de la barre latérale (feuille basse au téléphone, z-index 100) */
  z-index: 103;
}

.action-wheel-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.action-wheel-fab:active {
  transform: scale(0.95);
}

.action-wheel-fab.is-open {
  transform: rotate(45deg);
  background: var(--color-text-muted, #666);
}

.action-wheel-fab .fab-icon {
  transition: transform 0.2s ease;
  pointer-events: none;
}

/* Menu radial */
.action-wheel-menu {
  position: fixed;
  display: none;
  z-index: 102;
}

.action-wheel-menu.is-visible {
  display: block;
}

.action-wheel-menu.is-radial {
  /* Position relative au FAB */
}

.action-wheel-menu.is-context {
  /* Position au clic droit */
}

/* Overlay de fond */
.action-wheel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 101;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.action-wheel-overlay.is-visible {
  display: block;
  opacity: 1;
}

/* Items du menu */
.action-wheel-item {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-border, #e5e5e5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: opacity 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, left 0.25s ease, top 0.25s ease;
  opacity: 0;
  pointer-events: none;
  /* Position initiale au centre */
  left: -24px;
  top: -24px;
}

.action-wheel-menu.is-visible .action-wheel-item {
  opacity: 1;
  pointer-events: auto;
}

.action-wheel-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-color: var(--color-primary, var(--accent-primary));
}

.action-wheel-item:active {
  opacity: 0.8;
}

/* Couleurs par type d'action */
.action-wheel-item[data-action="soutien"] {
  border-color: #3b82f6;
}
.action-wheel-item[data-action="soutien"]:hover {
  background: #eff6ff;
}

.action-wheel-item[data-action="femme"] {
  border-color: #ec4899;
}
.action-wheel-item[data-action="femme"]:hover {
  background: #fdf2f8;
}

.action-wheel-item[data-action="medicaments"] {
  border-color: #8b5cf6;
}
.action-wheel-item[data-action="medicaments"]:hover {
  background: #f5f3ff;
}

.action-wheel-item[data-action="decision"] {
  border-color: #f59e0b;
}
.action-wheel-item[data-action="decision"]:hover {
  background: #fffbeb;
}

.action-wheel-item[data-action="evenements"] {
  border-color: #10b981;
}
.action-wheel-item[data-action="evenements"]:hover {
  background: #ecfdf5;
}

.action-wheel-item[data-action="observation"] {
  border-color: var(--color-primary, var(--accent-primary));
  background: var(--color-primary, var(--accent-primary));
  color: var(--text-on-accent);
}
.action-wheel-item[data-action="observation"]:hover {
  background: var(--color-primary-dark, var(--accent-primary-hover));
  border-color: var(--color-primary-dark, var(--accent-primary-hover));
}

/* Tooltip pour les items */
.action-wheel-item::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface, #333);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.action-wheel-item:hover::after {
  opacity: 1;
}

/* Positions de la roue : 3 rangées de 2 au-dessus et à gauche du FAB, qui est
   dans le coin bas droit. Le cercle complet sortait de l'écran à droite et en bas,
   sur ordinateur comme au téléphone (D2, L3-PAR). Centre du menu = centre du FAB. */
.action-wheel-menu.is-radial {
  --item-size: 48px;
  --half-item: calc(var(--item-size) / 2);
  --step: calc(var(--item-size) + 8px);
  /* Première rangée : demi-FAB (28 px) + 8 px + demi-bouton */
  --first-row: calc(36px + var(--half-item));
}

/* Position initiale au centre pour animation */
.action-wheel-menu.is-radial .action-wheel-item {
  left: calc(-1 * var(--half-item));
  top: calc(-1 * var(--half-item));
}

/* Positions finales quand visible */
.action-wheel-menu.is-radial.is-visible .action-wheel-item:nth-child(1) {
  /* Observation - au-dessus du FAB */
  left: calc(-1 * var(--half-item));
  top: calc(-1 * var(--first-row) - var(--half-item));
  transition-delay: 0.02s;
}

.action-wheel-menu.is-radial.is-visible .action-wheel-item:nth-child(2) {
  /* Soutien - à gauche d'Observation */
  left: calc(-1 * var(--step) - var(--half-item));
  top: calc(-1 * var(--first-row) - var(--half-item));
  transition-delay: 0.04s;
}

.action-wheel-menu.is-radial.is-visible .action-wheel-item:nth-child(3) {
  /* Femme - 2e rangée */
  left: calc(-1 * var(--half-item));
  top: calc(-1 * var(--first-row) - var(--step) - var(--half-item));
  transition-delay: 0.06s;
}

.action-wheel-menu.is-radial.is-visible .action-wheel-item:nth-child(4) {
  /* Medicaments - 2e rangée, à gauche */
  left: calc(-1 * var(--step) - var(--half-item));
  top: calc(-1 * var(--first-row) - var(--step) - var(--half-item));
  transition-delay: 0.08s;
}

.action-wheel-menu.is-radial.is-visible .action-wheel-item:nth-child(5) {
  /* Decision - 3e rangée */
  left: calc(-1 * var(--half-item));
  top: calc(-1 * var(--first-row) - 2 * var(--step) - var(--half-item));
  transition-delay: 0.10s;
}

.action-wheel-menu.is-radial.is-visible .action-wheel-item:nth-child(6) {
  /* Evenements - 3e rangée, à gauche */
  left: calc(-1 * var(--step) - var(--half-item));
  top: calc(-1 * var(--first-row) - 2 * var(--step) - var(--half-item));
  transition-delay: 0.12s;
}

/* Menu contextuel (grid layout) */
.action-wheel-menu.is-context {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, 48px);
  gap: 8px;
}

.action-wheel-menu.is-context .action-wheel-item {
  position: relative;
  transform: none;
  opacity: 1;
}

.action-wheel-menu.is-context .action-wheel-item::after {
  bottom: auto;
  top: calc(100% + 4px);
}

/* Responsive */
@media (max-width: 480px) {
  .action-wheel-fab {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .action-wheel-item {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .action-wheel-menu.is-radial {
    --item-size: 44px;
    /* FAB de 48 px : demi-FAB (24 px) + 8 px + demi-bouton */
    --first-row: calc(32px + var(--half-item));
  }
}
