'use client';

import { useState } from 'react';
import { Scale } from 'lucide-react';
import { ForceBribePanel } from './ForceBribePanel';
import { useGameStore } from '@/stores/gameStore';

/**
 * Phase 9 (2026-04-20) — Bouton flottant "Corruption" qui ouvre ForceBribePanel.
 *
 * Placement volontairement flottant (bas-droit au-dessus de VacationControl)
 * pour un accès rapide depuis n'importe quelle vue carte.
 *
 * Phase 8.5 (2026-04-29) — passe politiqueUnlocked depuis useGameStore.player
 * pour le gating GIGN avocat personnel (mission politique requise).
 */
export function ForceBribeButton() {
  const [open, setOpen] = useState(false);
  const player = useGameStore((s) => s.player);
  const politiqueUnlocked = !!player?.politique_unlocked;

  return (
    <>
      <button type="button"
        onClick={() => setOpen(true)}
        className="fixed flex items-center gap-2 px-3 py-2 rounded-full shadow-lg hover:opacity-90"
        style={{
          bottom: 140, right: 16, zIndex: 1000,
          background: 'linear-gradient(180deg, rgba(156,163,175,0.95), rgba(75,85,99,0.95))',
          border: '1px solid rgba(209,213,219,0.6)',
          color: '#fff', fontSize: 11, fontWeight: 'bold',
        }}
        title="Corrompre Police / GIGN / FBI / DEA">
        <Scale size={14} />
        Corruption
      </button>
      <ForceBribePanel open={open} onClose={() => setOpen(false)} politiqueUnlocked={politiqueUnlocked} />
    </>
  );
}
