/* ================================================
   Widget Fhano & Caro — scenesdemariage.fr
   Assistants vocaux — Fhano (gauche) & Caro (droite)
   ================================================ */

/* Variable unique : taille avatar = 10vw, min 60px, max 110px */
:root {
  --fc-size: clamp(60px, 10vw, 110px);
}

/* ---- Avatars positionnés séparément — collés en bas ---- */
#fc-avatar-fhano,
#fc-avatar-caro {
  position: fixed;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

#fc-avatar-fhano { left: 8px; }
#fc-avatar-caro  { right: 8px; }

/* ---- Bouton avatar (photo — fond transparent) ---- */
.fc-avatar-btn {
  width: var(--fc-size);
  height: auto;
  border-radius: 0;
  border: none;
  padding: 0;
  cursor: pointer;
  overflow: visible;
  background: transparent;
  box-shadow: none;
  display: block;
  transition: transform 0.2s, filter 0.2s;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
}

.fc-avatar-btn img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  object-fit: contain;
}

.fc-avatar-btn:hover {
  transform: scale(1.06) translateY(-4px);
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.55));
}

.fc-avatar-btn:active {
  transform: scale(0.97);
}

/* ---- Label sous avatar — masqué (photo suffit) ---- */
.fc-avatar-label {
  display: none;
}

/* ---- Animation "en train de parler" (drop-shadow pulsé) ---- */
.fc-avatar-btn.speaking {
  animation: fc-pulse-glow 1.2s ease-in-out infinite;
}

#fc-avatar-fhano .fc-avatar-btn.speaking { --fc-ring-glow: rgba(100,179,224,0.7); }
#fc-avatar-caro  .fc-avatar-btn.speaking { --fc-ring-glow: rgba(240,160,190,0.7); }

@keyframes fc-pulse-glow {
  0%   { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45)) drop-shadow(0 0 0px var(--fc-ring-glow, rgba(255,255,255,0.5))); }
  50%  { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45)) drop-shadow(0 0 14px var(--fc-ring-glow, rgba(255,255,255,0.5))); }
  100% { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45)) drop-shadow(0 0 0px var(--fc-ring-glow, rgba(255,255,255,0.5))); }
}

/* ---- Panel de contrôle (positionné au-dessus de l'avatar) ---- */
/* bottom = taille avatar + 8px de marge */
.fc-panel {
  position: fixed;
  bottom: calc(var(--fc-size) + 8px);
  z-index: 9998;
  background: rgba(18, 18, 36, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 16px 18px 14px;
  width: 230px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  animation: fc-slide-in 0.25s ease;
  /* Transition d'opacité pour le fade */
  transition: opacity 1s ease;
}

/* Fade à 10% après 3s de lecture */
.fc-panel--faded {
  opacity: 0.10;
}

/* Retour à l'opacité complète au survol */
.fc-panel--faded:hover {
  opacity: 1;
  transition: opacity 0.2s ease;
}

#fc-panel-fhano { left: 24px; }
#fc-panel-caro  { right: 24px; }

.fc-panel[hidden] { display: none !important; }

@keyframes fc-slide-in {
  from { opacity: 0; transform: translateY(14px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- En-tête du panel ---- */
.fc-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.fc-panel-photo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.fc-panel-info {
  flex: 1;
  min-width: 0;
}

.fc-panel-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  display: block;
}

.fc-panel-status {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 17px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.2s;
}
.fc-close-btn:hover { color: #fff; }

#fc-panel-fhano { --fc-accent: #64b3e0; }
#fc-panel-caro  { --fc-accent: #f0a0be; }

/* ---- Vitesse ---- */
.fc-speed-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.fc-speed-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
}

.fc-speed-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.18);
  outline: none;
  cursor: pointer;
}
.fc-speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--fc-accent, #64b3e0);
  cursor: pointer;
  transition: transform 0.15s;
}
.fc-speed-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

.fc-speed-val {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  min-width: 28px;
  text-align: right;
}

/* ---- Boutons lecture ---- */
.fc-play-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}

.fc-play-btn, .fc-stop-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  width: 42px;
  height: 38px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fc-play-btn:hover, .fc-stop-btn:hover { background: rgba(255,255,255,0.18); }
.fc-play-btn.paused {
  background: var(--fc-accent, #64b3e0);
  border-color: var(--fc-accent, #64b3e0);
  color: #111;
}

/* ---- Barre de progression ---- */
.fc-progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.fc-progress-fill {
  height: 100%;
  background: var(--fc-accent, #64b3e0);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s linear;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  /* Sur très petit écran le panel prend presque toute la largeur */
  .fc-panel {
    width: calc(100vw - 32px);
    max-width: 260px;
  }
  #fc-panel-fhano { left: 16px; right: auto; }
  #fc-panel-caro  { right: 16px; left: auto; }
}

/* ================================================
   Mode "pointer" — choisir le point de départ
   ================================================ */

/* Curseur crosshair sur toute la page */
body.fc-pick-mode,
body.fc-pick-mode * {
  cursor: crosshair !important;
}

/* Surbrillance au survol des blocs de texte */
body.fc-pick-mode p:hover,
body.fc-pick-mode h1:hover,
body.fc-pick-mode h2:hover,
body.fc-pick-mode h3:hover,
body.fc-pick-mode h4:hover,
body.fc-pick-mode h5:hover,
body.fc-pick-mode h6:hover,
body.fc-pick-mode li:hover,
body.fc-pick-mode blockquote:hover {
  background-color: rgba(247, 229, 151, 0.18) !important;
  outline: 2px dashed rgba(247, 229, 151, 0.65) !important;
  outline-offset: 3px;
  border-radius: 4px;
  transition: background-color 0.15s, outline 0.15s;
}

/* Banner haut de page */
#fc-pick-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: rgba(32, 42, 84, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(247, 229, 151, 0.5);
  color: #f7e597;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: 'Open Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  animation: fc-banner-in 0.25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}

@keyframes fc-banner-in {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

.fc-pick-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  animation: fc-pick-bounce 1.2s ease-in-out infinite;
}

@keyframes fc-pick-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}

.fc-pick-text {
  flex: 1;
  text-align: center;
}

#fc-pick-cancel {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer !important;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
#fc-pick-cancel:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

@media (max-width: 480px) {
  #fc-pick-banner {
    font-size: 0.78rem;
    padding: 10px 12px;
    gap: 8px;
  }
  .fc-pick-text { font-size: 0.75rem; }
}

/* ================================================
   Modale de bienvenue
   ================================================ */

#fc-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(1, 25, 74, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fc-wlc-in 0.4s ease;
}

#fc-welcome-overlay.fc-welcome--closing {
  animation: fc-wlc-out 0.4s ease forwards;
}

@keyframes fc-wlc-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fc-wlc-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

#fc-welcome-box {
  background: rgba(18, 18, 36, 0.97);
  border: 1px solid rgba(247, 229, 151, 0.3);
  border-radius: 24px;
  padding: 36px 40px 32px;
  max-width: 420px;
  width: calc(100vw - 48px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: fc-wlc-rise 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fc-wlc-rise {
  from { opacity: 0; transform: translateY(30px) scale(0.93); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

#fc-welcome-avatars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.fc-wlc-avatar {
  width: clamp(64px, 18vw, 96px);
  height: auto;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.5));
  animation: fc-wlc-float 3s ease-in-out infinite;
}

.fc-wlc-avatar:nth-child(2) {
  animation-delay: 0.5s;
}

@keyframes fc-wlc-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.fc-wlc-title {
  font-family: 'Adamina', 'Georgia', serif;
  font-size: clamp(1rem, 4vw, 1.25rem);
  color: #fff;
  line-height: 1.5;
  margin: 0 0 8px;
}

.fc-wlc-title strong {
  color: #f7e597;
  display: block;
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  letter-spacing: 0.5px;
}

.fc-wlc-sub {
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin: 0 0 28px;
}

/* Bouton "Entrer ✦" — doré, prominent */
#fc-welcome-enter {
  background: linear-gradient(135deg, #f7e597, #e8c94a);
  border: none;
  border-radius: 50px;
  color: #1a1a2e;
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 13px 40px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(247, 229, 151, 0.35);
}
#fc-welcome-enter:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(247, 229, 151, 0.55);
}
#fc-welcome-enter:active { transform: scale(0.97); }

/* ================================================
   Modale 2 — proposition de lecture
   ================================================ */

#fc-offer-modal {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  background: rgba(18, 18, 36, 0.97);
  border: 1px solid rgba(247, 229, 151, 0.3);
  border-radius: 20px;
  padding: 22px 28px 18px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: max-content;
  max-width: calc(100vw - 32px);
  animation: fc-offer-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fc-offer-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.93); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

#fc-offer-modal.fc-offer--closing {
  animation: fc-offer-out 0.3s ease forwards;
}

@keyframes fc-offer-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  to   { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.95); }
}

.fc-offer-title {
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.75);
  margin: 0 0 16px;
  white-space: nowrap;
}

.fc-offer-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
}

.fc-offer-btn {
  background: rgba(247, 229, 151, 0.1);
  border: 1px solid rgba(247, 229, 151, 0.4);
  border-radius: 50px;
  color: #f7e597;
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.fc-offer-btn img {
  width: 28px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.fc-offer-btn:hover {
  background: rgba(247, 229, 151, 0.22);
  transform: scale(1.04);
}
.fc-offer-btn:active { transform: scale(0.97); }

#fc-offer-skip {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.35);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
#fc-offer-skip:hover { color: rgba(255,255,255,0.6); }

/* ================================================
   Surbrillance du texte en cours de lecture
   ================================================ */

.fc-reading {
  background-color: rgba(247, 229, 151, 0.22) !important;
  outline: 2px solid rgba(247, 229, 151, 0.55) !important;
  outline-offset: 5px;
  border-radius: 5px;
  transition: background-color 0.35s ease, outline-color 0.35s ease;
  scroll-margin-top: 80px; /* éviter que le texte se cache sous la navbar */
}
