/* ============================================================
   🧰 FLOATING TOOLBAR - Barre verticale rétractable
   public/css/floating-toolbar.css
   
   Languette centrée au milieu droit de l'écran.
   La barre verticale slide entre la languette et le bord,
   poussant la languette vers la gauche.
   ============================================================ */

:root {
  --ftb-bg: rgb(31, 35, 46);
  --ftb-bg-hover: rgba(30, 36, 54, 0.98);
  --ftb-accent: #f0b90b;
  --ftb-accent-glow: rgba(240, 185, 11, 0.3);
  --ftb-text: #e1e5ee;
  --ftb-sub-size: 46px;
  --ftb-gap: 10px;
  --ftb-tab-w: 28px;
  --ftb-tab-h: 56px;
  --ftb-bar-w: 75px;
}

/* ── CONTAINER ── */

.ftb-container {
  position: fixed;
  top: 60%;
  right: 10px;
  transform: translateY(-50%);
  z-index: 9997;
  display: flex;
  flex-direction: row;
  align-items: center;
  pointer-events: none;
}

.ftb-container > * {
  pointer-events: auto;
}

/* ── LANGUETTE (à gauche de la barre) ── */

.ftb-main-btn {
  width: var(--ftb-tab-w);
  height: var(--ftb-tab-h);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  padding: 0;
  flex-shrink: 0;
  right: -10px;
  border-radius: 12px 0 0 12px;
  background: linear-gradient(135deg, var(--ftb-accent), #d4a00a);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.35), 0 0 12px var(--ftb-accent-glow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ftb-main-btn:hover {
  width: 34px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.45), 0 0 20px var(--ftb-accent-glow);
}

.ftb-main-btn:active {
  transform: scale(0.95);
}

/* Quand ouvert : languette fusionne avec la barre */
.ftb-container.ftb-open .ftb-main-btn {
  background: var(--ftb-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-right: none;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.3);
  border-radius: 12px 0 0 12px;
}

/* Flèche SVG */
.ftb-arrow {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ftb-arrow svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #1a1a2e;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Fermé : ← | Ouvert : → */
.ftb-container.ftb-open .ftb-arrow {
  transform: rotate(180deg);
}
.ftb-container.ftb-open .ftb-arrow svg {
  stroke: var(--ftb-text);
}

/* Badge principal */
.ftb-main-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 2px solid #0f1219;
  font-family: system-ui, -apple-system, sans-serif;
}

.ftb-main-badge.ftb-visible {
  display: flex;
  animation: ftbBadgePop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ftbBadgePop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── BARRE VERTICALE (entre languette et bord droit) ── */

.ftb-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ftb-gap);
  background: var(--ftb-bg);
  border-right: none;
  border-left: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  /* Fermé : largeur 0 + overflow hidden pour masquer les items */
  width: 0;
  padding: 10px 0;
  overflow: hidden;
  opacity: 0;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease;
}

/* Ouvert : overflow visible pour laisser les tooltips dépasser */
.ftb-container.ftb-open .ftb-bar {
  width: var(--ftb-bar-w);
  padding: 15px;
  border-radius: 20px;
  opacity: 1;
  overflow: visible;
  z-index: 20;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              overflow 0s 0.35s;
}

/* ── ITEMS dans la barre ── */

.ftb-item {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transform: scale(0.5);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger ouverture */
.ftb-container.ftb-open .ftb-item {
  transform: scale(1);
  opacity: 1;
}
.ftb-container.ftb-open .ftb-item:nth-child(1) { transition-delay: 0.1s; }
.ftb-container.ftb-open .ftb-item:nth-child(2) { transition-delay: 0.16s; }
.ftb-container.ftb-open .ftb-item:nth-child(3) { transition-delay: 0.22s; }
.ftb-container.ftb-open .ftb-item:nth-child(4) { transition-delay: 0.28s; }

/* Stagger fermeture */
.ftb-container:not(.ftb-open) .ftb-item:nth-child(4) { transition-delay: 0.02s; }
.ftb-container:not(.ftb-open) .ftb-item:nth-child(3) { transition-delay: 0.04s; }
.ftb-container:not(.ftb-open) .ftb-item:nth-child(2) { transition-delay: 0.06s; }
.ftb-container:not(.ftb-open) .ftb-item:nth-child(1) { transition-delay: 0.08s; }

/* Bouton rond */
.ftb-sub-btn {
  width: var(--ftb-sub-size);
  height: var(--ftb-sub-size);
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ftb-text);
  font-size: 18px;
  transition: all 0.25s ease;
  position: relative;
}

.ftb-sub-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.12);
  border-color: rgba(255, 255, 255, 0.15);
}

.ftb-sub-btn:active {
  transform: scale(0.95);
}

/* Couleurs par action */
.ftb-sub-btn[data-action="chat"]       { color: #60a5fa; }
.ftb-sub-btn[data-action="support"]    { color: var(--ftb-accent); }
.ftb-sub-btn[data-action="trophy"]     { color: #fbbf24; }
.ftb-sub-btn[data-action="vote-reset"] { color: #34d399; }

.ftb-sub-btn[data-action="chat"]:hover {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.08);
}
.ftb-sub-btn[data-action="support"]:hover {
  border-color: var(--ftb-accent-glow);
  background: rgba(240, 185, 11, 0.08);
}
.ftb-sub-btn[data-action="trophy"]:hover {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}
.ftb-sub-btn[data-action="vote-reset"]:hover {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
}

/* Label tooltip — à gauche */
.ftb-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: var(--ftb-bg);
  color: var(--ftb-text);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0;
  transition: all 0.2s ease;
  pointer-events: none;
  font-family: system-ui, -apple-system, sans-serif;
}

.ftb-label::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right: none;
  border-left-color: var(--ftb-bg);
}

.ftb-item:hover .ftb-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  z-index: 20;
}

/* Badge sub-bouton */
.ftb-sub-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 2px solid rgba(20, 24, 36, 0.95);
  font-family: system-ui, -apple-system, sans-serif;
}

.ftb-sub-badge.ftb-visible {
  display: flex;
}

/* Mini timer vote-reset */
.ftb-mini-timer {
  display: none;
  font-size: 9px;
  font-weight: 700;
  color: #34d399;
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 18, 25, 0.9);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.ftb-mini-timer.ftb-visible {
  display: none;
}

/* ── PULSE sur la languette ── */

.ftb-main-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  z-index: -1;
  animation: ftbPulse 3s ease-in-out infinite;
  opacity: 0;
}

@keyframes ftbPulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50%      { opacity: 0.3; transform: scale(1.15, 1.1); }
}

.ftb-container.ftb-open .ftb-main-btn::before {
  animation: none;
  opacity: 0;
}

/* ── RESPONSIVE ── */

@media (max-width: 480px) {
  :root {
    --ftb-sub-size: 42px;
    --ftb-gap: 8px;
    --ftb-tab-w: 24px;
    --ftb-tab-h: 48px;
    --ftb-bar-w: 56px;
  }

  .ftb-label {
    display: none;
  }

  .ftb-arrow svg {
    width: 13px;
    height: 13px;
  }
}