/* =============================================================
   FaabaKoo — Assistant Vocal Intelligent
   ============================================================= */

/* ---------------------------------------------------------------
   Bouton flottant (FAB)
--------------------------------------------------------------- */
.fk-va-fab {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  border: none;
  cursor: pointer;
  z-index: 10010;
  box-shadow: 0 4px 22px rgba(22, 163, 74, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.fk-va-fab:hover { transform: scale(1.08); box-shadow: 0 6px 30px rgba(22, 163, 74, .55); }
.fk-va-fab:active { transform: scale(.96); }

/* Anneau de pulsation (masqué quand le panneau est ouvert) */
.fk-va-pulse,
.fk-va-pulse::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid #22c55e;
  pointer-events: none;
  animation: fk-va-pulse 2.4s ease-out infinite;
}

.fk-va-pulse::before {
  inset: -14px;
  animation-delay: .8s;
}

@keyframes fk-va-pulse {
  0%   { opacity: .75; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.65); }
}

.fk-va-fab--open .fk-va-pulse,
.fk-va-fab--open .fk-va-pulse::before { display: none; }

/* ---------------------------------------------------------------
   Panneau principal
--------------------------------------------------------------- */
.fk-va-panel {
  position: fixed;
  bottom: 5.75rem;
  right: 1.75rem;
  width: min(390px, calc(100vw - 2rem));
  height: min(570px, calc(100svh - 7rem));
  background: #fff;
  border-radius: 1.375rem;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, .18),
    0 4px 20px rgba(0, 0, 0, .08);
  z-index: 10009;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(.65) translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform .32s cubic-bezier(.34, 1.56, .64, 1),
    opacity   .22s ease;
}

.fk-va-panel.fk-va-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ---------------------------------------------------------------
   Header
--------------------------------------------------------------- */
.fk-va-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .875rem 1rem;
  background: linear-gradient(135deg, #14532d 0%, #16a34a 60%, #22c55e 100%);
  color: #fff;
  flex-shrink: 0;
}

.fk-va-header__info { flex: 1; min-width: 0; }
.fk-va-header__title {
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fk-va-header__sub { font-size: .68rem; opacity: .8; margin-top: 1px; }

.fk-va-header__btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  transition: background .2s;
  line-height: 1;
}
.fk-va-header__btn:hover { background: rgba(255, 255, 255, .32); }

/* ---------------------------------------------------------------
   Zone de messages
--------------------------------------------------------------- */
.fk-va-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
}

.fk-va-messages::-webkit-scrollbar { width: 4px; }
.fk-va-messages::-webkit-scrollbar-track { background: transparent; }
.fk-va-messages::-webkit-scrollbar-thumb { background: #d1fae5; border-radius: 2px; }

/* Bulle de message */
.fk-va-msg { max-width: 86%; animation: fk-va-msg-in .22s ease; }

@keyframes fk-va-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fk-va-msg--user  { align-self: flex-end; }
.fk-va-msg--assistant { align-self: flex-start; }

.fk-va-msg__bubble {
  padding: .625rem .9rem;
  font-size: .875rem;
  line-height: 1.55;
  border-radius: 1.1rem;
}

.fk-va-msg--user .fk-va-msg__bubble {
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #fff;
  border-radius: 1.1rem 1.1rem 0 1.1rem;
}

.fk-va-msg--assistant .fk-va-msg__bubble {
  background: #f3f4f6;
  color: #111827;
  border-radius: 0 1.1rem 1.1rem 1.1rem;
}

/* Bouton réécouter */
.fk-va-msg__replay {
  display: flex;
  align-items: center;
  gap: .3rem;
  background: none;
  border: none;
  color: #6b7280;
  font-size: .7rem;
  cursor: pointer;
  padding: .25rem .1rem;
  margin-top: .2rem;
  transition: color .2s;
}
.fk-va-msg__replay:hover { color: #16a34a; }

/* Indicateur de frappe (trois points) */
.fk-va-msg--typing .fk-va-msg__bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .75rem 1.1rem;
}

.fk-va-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: fk-va-bounce .9s ease-in-out infinite;
}
.fk-va-dot:nth-child(2) { animation-delay: .16s; }
.fk-va-dot:nth-child(3) { animation-delay: .32s; }

@keyframes fk-va-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-7px); }
}

/* ---------------------------------------------------------------
   Raccourcis (suggestions)
--------------------------------------------------------------- */
.fk-va-shortcuts {
  display: flex;
  gap: .35rem;
  padding: .5rem 1rem .375rem;
  overflow-x: auto;
  flex-shrink: 0;
  border-top: 1px solid #f0fdf4;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.fk-va-shortcuts::-webkit-scrollbar { display: none; }

.fk-va-shortcut {
  white-space: nowrap;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  border-radius: 2rem;
  padding: .3rem .8rem;
  font-size: .7rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .18s, border-color .18s;
  font-family: inherit;
}
.fk-va-shortcut:hover { background: #dcfce7; border-color: #86efac; }

/* ---------------------------------------------------------------
   Oscilloscope / indicateur d'écoute
--------------------------------------------------------------- */
.fk-va-wave {
  display: none;
  align-items: center;
  gap: 3px;
  padding: .375rem 1rem;
  flex-shrink: 0;
  background: #fff7f7;
  border-top: 1px solid #fee2e2;
}

.fk-va-wave.fk-va-wave--active { display: flex; }

.fk-va-wave-bar {
  width: 3px;
  border-radius: 2px;
  background: #dc2626;
  transform-origin: bottom center;
  animation: fk-va-wave .55s ease-in-out infinite alternate;
}
.fk-va-wave-bar:nth-child(1) { height: 8px;  animation-delay: 0s; }
.fk-va-wave-bar:nth-child(2) { height: 16px; animation-delay: .07s; }
.fk-va-wave-bar:nth-child(3) { height: 24px; animation-delay: .14s; }
.fk-va-wave-bar:nth-child(4) { height: 18px; animation-delay: .21s; }
.fk-va-wave-bar:nth-child(5) { height: 22px; animation-delay: .1s; }
.fk-va-wave-bar:nth-child(6) { height: 14px; animation-delay: .18s; }
.fk-va-wave-bar:nth-child(7) { height: 10px; animation-delay: .05s; }

@keyframes fk-va-wave {
  from { transform: scaleY(.35); }
  to   { transform: scaleY(1); }
}

.fk-va-wave__label {
  font-size: .7rem;
  color: #dc2626;
  font-weight: 500;
  margin-left: .5rem;
}

/* ---------------------------------------------------------------
   Barre de saisie
--------------------------------------------------------------- */
.fk-va-inputbar {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid #f3f4f6;
  background: #fff;
  flex-shrink: 0;
}

.fk-va-input {
  flex: 1;
  resize: none;
  border: 1.5px solid #e5e7eb;
  border-radius: 1.1rem;
  padding: .5rem .9rem;
  font-size: .875rem;
  font-family: inherit;
  line-height: 1.4;
  max-height: 100px;
  outline: none;
  transition: border-color .2s;
  background: #fafafa;
}
.fk-va-input:focus { border-color: #22c55e; background: #fff; }
.fk-va-input::placeholder { color: #9ca3af; }

.fk-va-btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .18s, background .18s;
  font-size: 1rem;
}

.fk-va-btn-send {
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #fff;
  box-shadow: 0 2px 10px rgba(22, 163, 74, .35);
}
.fk-va-btn-send:hover { transform: scale(1.1); }
.fk-va-btn-send:active { transform: scale(.95); }

.fk-va-btn-mic { background: #f3f4f6; color: #374151; }
.fk-va-btn-mic:hover { background: #fee2e2; color: #dc2626; }

.fk-va-btn-mic--listening {
  background: #dc2626 !important;
  color: #fff !important;
  animation: fk-va-mic-ring .85s ease-in-out infinite alternate;
}

@keyframes fk-va-mic-ring {
  from { box-shadow: 0 0 0 0   rgba(220, 38, 38, .5); }
  to   { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* ---------------------------------------------------------------
   Tiroir de réglages
--------------------------------------------------------------- */
.fk-va-settings {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 20;
  transform: translateX(101%);
  transition: transform .3s cubic-bezier(.34, 1.2, .64, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fk-va-settings.fk-va-settings--open { transform: translateX(0); }

.fk-va-settings-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .875rem 1rem;
  background: linear-gradient(135deg, #14532d 0%, #16a34a 60%, #22c55e 100%);
  color: #fff;
  flex-shrink: 0;
}
.fk-va-settings-header h3 {
  flex: 1;
  font-size: .95rem;
  font-weight: 700;
  margin: 0;
}

.fk-va-settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.fk-va-setting-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: .6rem;
}

/* Genre */
.fk-va-gender-btns { display: flex; gap: .5rem; }

.fk-va-gender-btn {
  flex: 1;
  padding: .55rem;
  border: 2px solid #e5e7eb;
  border-radius: .75rem;
  background: #fff;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  color: #374151;
  font-family: inherit;
  transition: all .18s;
  text-align: center;
}
.fk-va-gender-btn.fk-va-gender-btn--active {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #15803d;
}
.fk-va-gender-btn:hover:not(.fk-va-gender-btn--active) { border-color: #d1d5db; background: #fafafa; }

/* Vitesse */
.fk-va-rate-slider {
  width: 100%;
  accent-color: #22c55e;
  cursor: pointer;
  margin: .25rem 0;
}

.fk-va-rate-presets { display: flex; gap: .375rem; flex-wrap: wrap; margin-top: .5rem; }

.fk-va-rate-preset {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  padding: .28rem .65rem;
  font-size: .73rem;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s;
}
.fk-va-rate-preset:hover,
.fk-va-rate-preset.fk-va-rate-preset--active {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
  font-weight: 600;
}

/* Toggle muet */
.fk-va-mute-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  user-select: none;
}

.fk-va-toggle-track {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #d1d5db;
  position: relative;
  flex-shrink: 0;
  transition: background .25s;
}
.fk-va-toggle-track.fk-va-toggle--on { background: #22c55e; }

.fk-va-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.fk-va-toggle-track.fk-va-toggle--on .fk-va-toggle-thumb { transform: translateX(20px); }

.fk-va-mute-row span { font-size: .85rem; color: #374151; }
