/* frb-voice.css — Custom FRB Voice Widget */
/* Styled to match FRB design system: Navy, Amber, Gold, Cream */

/* ── Floating trigger button ────────────────────────────────── */
.frb-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #c45a1e;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(196, 90, 30, 0.35), 0 2px 8px rgba(0,0,0,0.10);
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1),
              background 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.frb-trigger:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(196, 90, 30, 0.45), 0 3px 12px rgba(0,0,0,0.12);
}
.frb-trigger:active {
  transform: scale(0.96);
}
.frb-trigger svg {
  width: 26px;
  height: 26px;
  display: block;
}
.frb-trigger[data-active="true"] {
  background: #1a2744;
}

/* Subtle pulse animation when idle */
.frb-trigger::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #c45a1e;
  opacity: 0;
  animation: frb-pulse 3s ease-in-out infinite;
}
.frb-trigger[data-active="true"]::after {
  animation: none;
  opacity: 0;
}

@keyframes frb-pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.15); }
}

/* ── Panel ──────────────────────────────────────────────────── */
.frb-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9999;
  width: 360px;
  max-height: 500px;
  background: #f7f4ef;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(26, 39, 68, 0.18), 0 4px 16px rgba(26, 39, 68, 0.10);
  border: 1px solid rgba(26, 39, 68, 0.10);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.frb-panel[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Panel header ───────────────────────────────────────────── */
.frb-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a2744;
  border-bottom: 1px solid rgba(200, 169, 110, 0.2);
}
.frb-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.frb-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
  transition: background 300ms ease;
}
.frb-header-dot[data-status="connected"] {
  background: #16A34A;
}
.frb-header-dot[data-status="speaking"] {
  background: #c8a96e;
  animation: frb-dot-pulse 1s ease-in-out infinite;
}
@keyframes frb-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.frb-header-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}
.frb-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.frb-close:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.frb-close svg {
  width: 16px;
  height: 16px;
}

/* ── Transcript area ────────────────────────────────────────── */
.frb-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 300px;
  background: #f7f4ef;
}
.frb-transcript::-webkit-scrollbar {
  width: 4px;
}
.frb-transcript::-webkit-scrollbar-track {
  background: transparent;
}
.frb-transcript::-webkit-scrollbar-thumb {
  background: rgba(26, 39, 68, 0.15);
  border-radius: 2px;
}

/* ── Messages ───────────────────────────────────────────────── */
.frb-msg {
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 88%;
  animation: frb-msg-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes frb-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.frb-msg--ai {
  color: #1a2744;
  align-self: flex-start;
}
.frb-msg--user {
  color: #4a5568;
  align-self: flex-end;
  text-align: right;
  font-style: italic;
}
.frb-msg-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c45a1e;
  margin-bottom: 2px;
}
.frb-msg--user .frb-msg-label {
  color: #4a5568;
}

/* ── Empty state / prompt ───────────────────────────────────── */
.frb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 20px;
  gap: 12px;
  flex: 1;
}
.frb-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(196, 90, 30, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c45a1e;
}
.frb-empty-icon svg {
  width: 24px;
  height: 24px;
}
.frb-empty-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #4a5568;
  line-height: 1.5;
}
.frb-empty-hint {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: rgba(26, 39, 68, 0.45);
}

/* ── Controls footer ────────────────────────────────────────── */
.frb-controls {
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(26, 39, 68, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #f7f4ef;
}

.frb-mic-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #c45a1e;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, transform 120ms ease;
}
.frb-mic-btn:hover {
  background: #e07a3e;
}
.frb-mic-btn:active {
  transform: scale(0.94);
}
.frb-mic-btn[data-state="listening"] {
  background: #c45a1e;
  animation: frb-mic-glow 1.5s ease-in-out infinite;
}
.frb-mic-btn[data-state="speaking"] {
  background: #1a2744;
}
.frb-mic-btn[data-state="idle"] {
  background: #c45a1e;
}
.frb-mic-btn svg {
  width: 22px;
  height: 22px;
}

@keyframes frb-mic-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 90, 30, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(196, 90, 30, 0); }
}

.frb-end-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #DC2626;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, transform 120ms ease, opacity 180ms ease;
  opacity: 0;
  pointer-events: none;
}
.frb-end-btn[data-visible="true"] {
  opacity: 1;
  pointer-events: auto;
}
.frb-end-btn:hover {
  background: #B91C1C;
}
.frb-end-btn svg {
  width: 16px;
  height: 16px;
}

.frb-status {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: rgba(26, 39, 68, 0.45);
  text-align: center;
  min-width: 80px;
}

/* ── Visualiser bars ────────────────────────────────────────── */
.frb-visualiser {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
}
.frb-bar {
  width: 3px;
  height: 4px;
  background: #c8a96e;
  border-radius: 2px;
  transition: height 100ms ease;
}
.frb-visualiser[data-active="true"] .frb-bar {
  animation: frb-bar-bounce 0.8s ease-in-out infinite;
}
.frb-visualiser[data-active="true"] .frb-bar:nth-child(1) { animation-delay: 0s; }
.frb-visualiser[data-active="true"] .frb-bar:nth-child(2) { animation-delay: 0.1s; }
.frb-visualiser[data-active="true"] .frb-bar:nth-child(3) { animation-delay: 0.2s; }
.frb-visualiser[data-active="true"] .frb-bar:nth-child(4) { animation-delay: 0.3s; }
.frb-visualiser[data-active="true"] .frb-bar:nth-child(5) { animation-delay: 0.15s; }

@keyframes frb-bar-bounce {
  0%, 100% { height: 4px; }
  50% { height: 20px; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 420px) {
  .frb-panel {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
  }
  .frb-trigger {
    right: 16px;
    bottom: 16px;
  }
}
