/* Universal Voice Bar — persistent bottom bar */

.voice-bar {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 1000;
  font-family: inherit;
}

/* Collapsed state — just the toggle button */
.voice-bar.collapsed .vb-panel { display: none; }

.vb-toggle-btn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  min-height: 48px;
  transition: background 0.15s, transform 0.15s;
}

.vb-toggle-btn:hover { background: #1d4ed8; transform: scale(1.03); }
.voice-bar.expanded .vb-toggle-btn { display: none; }

/* Expanded state — bottom drawer */
.voice-bar.expanded {
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
}

.vb-panel {
  display: flex;
  flex-direction: column;
  height: 55vh;
  max-height: 500px;
  background: var(--bg-primary, #1a1a1a);
  border: 1px solid var(--border-color, #333);
  border-bottom: none;
  border-radius: 0.75rem 0.75rem 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  overflow: hidden;
}

/* Header */
.vb-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #333);
  background: var(--bg-secondary, #222);
  min-height: 44px;
}

.vb-mode {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary, #aaa);
}

.vb-mode.active {
  color: #4ade80;
}

.vb-header button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #aaa);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vb-header button:hover { background: var(--bg-primary, #1a1a1a); color: #fff; }

/* Messages */
.vb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.vb-msg {
  padding: 0.5rem 0.75rem;
  border-radius: 0.625rem;
  max-width: 88%;
  font-size: 0.9375rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.vb-msg--user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
}

.vb-msg--assistant {
  align-self: flex-start;
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e5e5e5);
}

.vb-msg--system {
  align-self: center;
  font-size: 0.8125rem;
  color: var(--text-secondary, #888);
  text-align: center;
  font-style: italic;
}

.vb-msg--intent {
  align-self: center;
  font-size: 0.75rem;
  color: #4ade80;
  padding: 0.25rem 0.75rem;
  background: #1a3a1a;
  border-radius: 999px;
}

/* Form preview card */
.vb-form-preview {
  align-self: flex-start;
  background: #1a2a3a;
  border: 1px solid #2563eb;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  max-width: 90%;
}

.vb-form-preview dt {
  color: var(--text-secondary, #aaa);
  font-size: 0.75rem;
}

.vb-form-preview dd {
  margin: 0 0 0.25rem 0;
  color: var(--text-primary, #e5e5e5);
}

/* Input area */
.vb-input {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem;
  border-top: 1px solid var(--border-color, #333);
  background: var(--bg-primary, #1a1a1a);
}

.vb-mic-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 2px solid var(--border-color, #444);
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e5e5e5);
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.vb-mic-btn:hover { border-color: #2563eb; }
.vb-mic-btn.listening {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
  animation: vb-pulse 1.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .vb-mic-btn.listening { animation: none; }
}

@keyframes vb-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.vb-input form {
  flex: 1;
  display: flex;
  gap: 0.25rem;
}

.vb-input input {
  flex: 1;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border-color, #444);
  border-radius: 0.375rem;
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e5e5e5);
  font-size: 0.9375rem;
  min-height: 40px;
}

.vb-input input:focus {
  outline: 2px solid #2563eb;
  outline-offset: -1px;
}

.vb-input .vb-send {
  padding: 0.5rem 0.75rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.vb-input .vb-send:hover { background: #1d4ed8; }

/* Mobile: full width */
@media (max-width: 480px) {
  .voice-bar.expanded {
    max-width: 100%;
  }
  .vb-panel {
    height: 60vh;
    border-radius: 0.75rem 0.75rem 0 0;
  }
}

/* Document card in chat */
.vb-document-card {
  align-self: flex-start;
  background: #1a2a3a;
  border: 1px solid #2563eb;
  border-radius: 0.5rem;
  padding: 0.5rem;
  max-width: 95%;
  overflow: hidden;
}

.vb-doc-header {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-primary, #e5e5e5);
}

.vb-doc-icon { font-size: 1rem; }

.vb-doc-image-wrap {
  border-radius: 0.375rem;
  overflow: hidden;
  margin-bottom: 0.375rem;
  background: #111;
  cursor: zoom-in;
}

.vb-doc-image {
  width: 100%;
  height: auto;
  display: block;
  max-height: 300px;
  object-fit: contain;
}

.vb-doc-desc {
  font-size: 0.75rem;
  color: var(--text-secondary, #aaa);
  line-height: 1.4;
  margin-bottom: 0.375rem;
}

.vb-doc-actions {
  display: flex;
  gap: 0.375rem;
}

.vb-doc-btn {
  flex: 1;
  text-align: center;
  padding: 0.375rem 0.5rem;
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e5e5e5);
  border: 1px solid var(--border-color, #444);
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vb-doc-btn:hover { border-color: #2563eb; color: #4a9eff; }

/* Full-screen image overlay */
.vb-doc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.vb-doc-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}

/* Make room for the voice bar toggle on pages */
body { padding-bottom: 5rem; }
