/**
 * Modern Chat UI Styles for Signal
 */

:root {
  --primary-color: #4285f4;
  --user-bubble-bg: #4285f4;
  --agent-bubble-bg: #f1f3f4;
  --user-text-color: #ffffff;
  --agent-text-color: #202124;
  --bg-color: #ffffff;
  --border-color: #e0e0e0;
  --input-bg: #f8f9fa;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: #202124;
  line-height: 1.6;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

/* Header Options (Proactivity, Affective Dialog checkboxes) */
.header-options {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

.header-checkbox {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  cursor: pointer;
  user-select: none;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.header-checkbox:hover {
  opacity: 1;
}

.header-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #ffffff;
}

.header-checkbox span {
  white-space: nowrap;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.5rem;
}

.mode-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.mode-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mode-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 22px;
  transition: background-color 0.3s ease;
}

.mode-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.mode-switch input:checked + .mode-slider {
  background-color: rgba(255, 255, 255, 0.55);
}

.mode-switch input:checked + .mode-slider::before {
  transform: translateX(18px);
}

.mode-label {
  font-size: 0.8125rem;
  font-weight: 500;
  opacity: 0.9;
}

/* Persona Input */
.persona-input {
  margin-top: 0.5rem;
}

.persona-input textarea {
  width: 100%;
  max-width: 600px;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  background-color: rgba(255, 255, 255, 0.12);
  color: white;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.4;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.persona-input textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.persona-input textarea:focus {
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(255, 255, 255, 0.18);
}

.persona-input.hidden {
  display: none;
}

/* Digital Twin Info */
.digital-twin-info { max-width: 600px; margin: 0.5rem 0 0; text-align: left; }
.digital-twin-info.hidden { display: none; }

.info-toggle {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 0.8rem; cursor: pointer; display: flex; align-items: center;
  gap: 0.375rem; padding: 0.25rem 0; transition: color 0.15s;
}
.info-toggle:hover { color: rgba(255,255,255,1); }

.info-icon {
  width: 1.125rem; height: 1.125rem; border-radius: 50%;
  border: 1.5px solid currentColor; display: flex; align-items: center;
  justify-content: center; font-size: 0.7rem; font-weight: 700;
  font-style: italic;
}

.info-content {
  display: none; background: rgba(255,255,255,0.1); border-radius: 0.5rem;
  padding: 0.75rem 1rem; margin-top: 0.375rem; font-size: 0.8rem;
  color: rgba(255,255,255,0.85); line-height: 1.5;
}
.info-content.visible { display: block; }
.info-content p { margin-bottom: 0.5rem; }
.info-content p:last-of-type { margin-bottom: 0.375rem; }
.info-content a {
  color: rgba(255,255,255,0.7); text-decoration: underline; font-size: 0.75rem;
}
.info-content a:hover { color: white; }
.info-content strong { color: white; }

.mode-toggle.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.persona-input.disabled textarea {
  opacity: 0.5;
  pointer-events: none;
}

.connection-status {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34a853;
}

.status-indicator.disconnected {
  background-color: #ea4335;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Main Layout: Split view for chat and console */
.main-layout {
  flex: 1;
  display: flex;
  max-width: 2200px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  gap: 0;
}

/* Main Container: Chat area (left panel) */
.container {
  flex: 5;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
  position: relative;
}

.console-panel.visible {
  display: flex;
}

/* Messages Area */
#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
}

/* Scroll styling */
#messages::-webkit-scrollbar {
  width: 8px;
}

#messages::-webkit-scrollbar-track {
  background: transparent;
}

#messages::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 4px;
}

#messages::-webkit-scrollbar-thumb:hover {
  background: #bdc1c6;
}

/* Message Bubbles */
.message {
  display: flex;
  margin-bottom: 0.5rem;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  justify-content: flex-end;
}

.message.agent {
  justify-content: flex-start;
}

.bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1.25rem;
  word-wrap: break-word;
  box-shadow: var(--shadow);
  position: relative;
}

.message.user .bubble {
  background-color: var(--user-bubble-bg);
  color: var(--user-text-color);
  border-bottom-right-radius: 0.25rem;
}

.message.agent .bubble {
  background-color: var(--agent-bubble-bg);
  color: var(--agent-text-color);
  border-bottom-left-radius: 0.25rem;
}

.bubble-text {
  margin: 0;
  line-height: 1.5;
}

/* Interrupted message styling */
.message.interrupted .bubble {
  opacity: 0.6;
  background-color: #e8eaed;
  border-left: 3px solid #f4b400;
}

.message.interrupted .bubble::after {
  content: 'interrupted';
  display: block;
  font-size: 0.75rem;
  color: #5f6368;
  font-style: italic;
  margin-top: 0.25rem;
}

/* Transcription message styling */
.message.transcription.user .bubble {
  opacity: 0.9;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.message.transcription.user .bubble::before {
  content: '🎤';
  opacity: 0.8;
  margin-right: 0.25rem;
}

/* Typing indicator */
.typing-indicator {
  display: inline-block;
  margin-left: 0.25rem;
  color: #5f6368;
}

.typing-indicator::after {
  content: '...';
  animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* Replay button on user speech bubbles after reconnect */
.replay-btn {
  display: block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--user-bubble-bg, #4285f4);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--user-bubble-bg, #4285f4);
  border-radius: 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.replay-btn:hover {
  background: var(--user-bubble-bg, #4285f4);
  color: #fff;
}

/* Image bubble styling */
.bubble.image-bubble {
  padding: 0.25rem;
  max-width: 80%;
}

.bubble-image {
  max-width: 100%;
  max-height: 300px;
  width: auto;
  height: auto;
  border-radius: 0.75rem;
  display: block;
  object-fit: contain;
}

/* Input Form */
.input-container {
  border-top: 1px solid var(--border-color);
  background-color: white;
  padding: 1.5rem 2rem;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

#messageForm {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.input-wrapper {
  flex: 1;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

#message {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  font-size: 1rem;
  font-family: inherit;
  background-color: var(--input-bg);
  transition: all 0.2s ease;
  outline: none;
}

#message:focus {
  border-color: var(--primary-color);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

/* Buttons */
button {
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

#sendButton {
  background-color: var(--primary-color);
  color: white;
}

#sendButton:hover:not(:disabled) {
  background-color: #3367d6;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

#sendButton:disabled {
  background-color: #dadce0;
  color: #80868b;
  cursor: not-allowed;
  opacity: 0.6;
}

#startAudioButton {
  background-color: #34a853;
  color: white;
}

#startAudioButton:hover:not(:disabled) {
  background-color: #2d8e47;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

#startAudioButton:disabled {
  background-color: #dadce0;
  color: #80868b;
  cursor: not-allowed;
  opacity: 0.6;
}

#cameraButton {
  background-color: #ea4335;
  color: white;
}

#cameraButton:hover:not(:disabled) {
  background-color: #d33426;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

#cameraButton:disabled {
  background-color: #dadce0;
  color: #80868b;
  cursor: not-allowed;
  opacity: 0.6;
}


/* ===================== */
/* Signal Pulse Pills    */
/* ===================== */

.signal-pulse {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.7rem;
  font-weight: 500;
  background: rgba(234, 67, 53, 0.08);
  color: #c5221f;
  animation: signal-fade-in 0.3s ease-out;
}

.signal-excitement,
.signal-strong-positive {
  background: rgba(52, 168, 83, 0.08);
  color: #137333;
}

.signal-worry,
.signal-fear {
  background: rgba(251, 188, 4, 0.08);
  color: #e37400;
}

@keyframes signal-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* System Messages */
.system-message {
  text-align: center;
  color: #5f6368;
  font-size: 0.875rem;
  padding: 0.5rem;
  margin: 1rem 0;
  font-style: italic;
}

/* ===================== */
/* Insights Panel        */
/* ===================== */

#insights-app {
  flex: 3;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: flex 0.3s ease;
}

#insights-app:empty {
  flex: 0;
}

.insights-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #fafbfc;
  border-right: 1px solid var(--border-color);
  overflow: hidden;
}

.insights-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #f0f2f5;
  border-bottom: 1px solid var(--border-color);
}

.insights-header h2 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.insights-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Clarity Meter */
.clarity-meter {
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.clarity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.clarity-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #5f6368;
}

.clarity-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #202124;
}

.clarity-bar {
  height: 8px;
  background-color: #e8eaed;
  border-radius: 4px;
  overflow: hidden;
}

.clarity-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease-out, background-color 0.3s ease;
}

.clarity-fill.clarity-low {
  background: linear-gradient(90deg, #ea4335, #fbbc04);
}

.clarity-fill.clarity-mid {
  background: linear-gradient(90deg, #fbbc04, #34a853);
}

.clarity-fill.clarity-high {
  background: linear-gradient(90deg, #34a853, #137333);
}

.clarity-description {
  font-size: 0.75rem;
  color: #80868b;
  margin-top: 0.375rem;
}

/* Empty state */
.insights-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #80868b;
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.insights-empty p {
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Sections */
.insights-section {
  margin-bottom: 1.25rem;
}

.insights-section h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.625rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #e8eaed;
}

.section-count {
  background: #e8eaed;
  color: #5f6368;
  padding: 0.0625rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.7rem;
  margin-left: 0.375rem;
}

/* Insight Cards (Vue — light theme) */
.insight-card-vue {
  background: white;
  border-left: 3px solid var(--primary-color);
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0 0.375rem 0.375rem 0;
  box-shadow: var(--shadow);
}

.insight-card-vue.insight-pain {
  border-left-color: #ea4335;
}

.insight-card-vue.insight-gain {
  border-left-color: #34a853;
}

.insight-card-vue.insight-jtbd {
  border-left-color: #4285f4;
}

.insight-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.insight-badge {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  border-radius: 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-high { background: rgba(234, 67, 53, 0.1); color: #c5221f; }
.badge-medium { background: rgba(251, 188, 4, 0.1); color: #e37400; }
.badge-low { background: rgba(52, 168, 83, 0.1); color: #137333; }

.insight-description {
  font-size: 0.8rem;
  color: #202124;
  line-height: 1.4;
}

.insight-evidence {
  border-left: 2px solid #dadce0;
  background: #f8f9fa;
  padding: 0.375rem 0.625rem;
  margin: 0.375rem 0 0;
  border-radius: 0 0.25rem 0.25rem 0;
  font-style: italic;
  font-size: 0.75rem;
  color: #5f6368;
  line-height: 1.4;
}

/* Follow-up question items */
.insight-followups { display: flex; flex-direction: column; gap: 0.375rem; margin-top: 0.5rem; }

.followup-item {
  display: flex; align-items: flex-start; gap: 0.375rem;
  background: #f1f3f4; border: 1px solid #dadce0; border-radius: 1rem;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem; font-size: 0.75rem; color: #5f6368;
  line-height: 1.3; transition: all 0.2s ease;
}

.followup-text { flex: 1; }

.followup-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }

.followup-action-btn {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1px solid #dadce0;
  background: white; cursor: pointer; font-size: 0.7rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0; transition: all 0.15s;
}

.followup-ask:hover { background: #e6f4ea; border-color: #34a853; color: #137333; }
.followup-ignore:hover { background: #fce8e6; border-color: #ea4335; color: #c5221f; }

/* Asked state */
/* Hide follow-ups in Assisted Mode (user is not the interviewer) */
.assisted-mode .insight-followups { display: none; }

.followup-item.followup-asked {
  background: #e6f4ea; border-color: #34a853; color: #137333;
  text-decoration: line-through; text-decoration-color: rgba(19, 115, 51, 0.4);
}

.followup-status-icon.asked { color: #34a853; font-size: 0.8rem; flex-shrink: 0; }

/* Add Insight Form */
.add-insight-trigger {
  background: none; border: 1px dashed #dadce0; border-radius: 0.375rem;
  padding: 0.375rem 0.75rem; font-size: 0.75rem; color: #80868b;
  cursor: pointer; width: 100%; text-align: left;
  transition: all 0.15s;
}
.add-insight-trigger:hover { border-color: #bdc1c6; color: #5f6368; background: #f8f9fa; }

.add-insight-form {
  display: flex; flex-direction: column; gap: 0.375rem;
  padding: 0.5rem; background: white; border: 1px solid #dadce0;
  border-radius: 0.375rem; box-shadow: var(--shadow);
}

.add-insight-input {
  width: 100%; padding: 0.375rem 0.5rem; border: 1px solid #dadce0;
  border-radius: 0.25rem; font-size: 0.75rem; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.add-insight-input:focus { border-color: var(--primary-color); }

.add-insight-select {
  padding: 0.25rem 0.375rem; border: 1px solid #dadce0;
  border-radius: 0.25rem; font-size: 0.7rem; font-family: inherit;
  background: white; outline: none; color: #5f6368;
}

.add-insight-actions { display: flex; gap: 0.375rem; }

.add-insight-submit {
  padding: 0.25rem 0.625rem; font-size: 0.7rem; border-radius: 0.25rem;
  border: none; background: var(--primary-color); color: white;
  cursor: pointer; font-family: inherit; transition: background 0.15s;
}
.add-insight-submit:hover:not(:disabled) { background: #3367d6; }
.add-insight-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.add-insight-cancel {
  padding: 0.25rem 0.625rem; font-size: 0.7rem; border-radius: 0.25rem;
  border: 1px solid #dadce0; background: white; color: #5f6368;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.add-insight-cancel:hover { background: #f1f3f4; border-color: #bdc1c6; }

/* JTBD Groups */
.jtbd-group-vue {
  margin-bottom: 0.75rem;
}

.jtbd-dimension-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--primary-color);
  margin-bottom: 0.375rem;
}

/* Process Diagram */
.process-diagram-vue {
  background: white;
  border-left: 3px solid #9334e8;
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0 0.375rem 0.375rem 0;
  box-shadow: var(--shadow);
}

.process-diagram-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.process-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #202124;
}

.process-type-badge {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  border-radius: 0.75rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(147, 52, 232, 0.1);
  color: #9334e8;
}

.mermaid-container {
  background: #f8f9fa;
  border-radius: 0.375rem;
  padding: 0.5rem;
  overflow-x: auto;
  min-height: 2rem;
}

.mermaid-container svg {
  max-width: 100%;
  height: auto;
}

.process-stats {
  font-size: 0.7rem;
  color: #80868b;
  margin-top: 0.375rem;
}

/* Completion banner */
.completion-banner {
  background: linear-gradient(135deg, #34a853 0%, #1e8e3e 100%);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.completion-banner strong {
  font-size: 0.875rem;
}

.completion-banner p {
  font-size: 0.8rem;
  margin-top: 0.375rem;
  opacity: 0.9;
}

.completion-actions {
  margin-top: 0.5rem;
}

.completion-actions button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.completion-actions button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Vue TransitionGroup animations */
.insight-enter-enter-active {
  transition: all 0.4s ease-out;
}

.insight-enter-leave-active {
  transition: all 0.2s ease-in;
}

.insight-enter-enter-from {
  opacity: 0;
  transform: translateX(-20px);
}

.insight-enter-leave-to {
  opacity: 0;
  transform: translateX(20px);
}

/* ===================== */
/* Thinking Indicator    */
/* ===================== */

.thinking-bubble {
  background-color: var(--agent-bubble-bg);
  opacity: 0.8;
}

/* ===================== */
/* Audio Wave Indicator  */
/* ===================== */

.audio-wave-bubble {
  background-color: var(--agent-bubble-bg);
  padding: 0.75rem 1.25rem;
}

.audio-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}

.audio-wave .wave-bar {
  width: 3px;
  height: 4px;
  background-color: var(--primary-color);
  border-radius: 2px;
  animation: waveAnim 1.2s ease-in-out infinite;
}

.audio-wave .wave-bar:nth-child(1) { animation-delay: 0s; }
.audio-wave .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-wave .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-wave .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-wave .wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes waveAnim {
  0%, 100% {
    height: 4px;
  }
  50% {
    height: 20px;
  }
}

.thinking-dots::after {
  content: '';
  animation: thinkingDots 1.4s infinite steps(4, end);
}

@keyframes thinkingDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* Debug toggle button */
.debug-toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.375rem;
  cursor: pointer;
  color: #80868b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.debug-toggle:hover {
  color: #202124;
  background: #f1f3f4;
  border-color: #bdc1c6;
}

.debug-toggle.active {
  color: #4285f4;
  border-color: #4285f4;
  background: rgba(66, 133, 244, 0.08);
}

/* Console Panel (right, dev-only) */
.console-panel {
  flex: 2;
  min-width: 0;
  display: none;
  flex-direction: column;
  background-color: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  overflow: hidden;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #2d2d2d;
  border-bottom: 1px solid #3e3e3e;
}

.console-header h2 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: #cccccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.console-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.console-checkbox {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #999999;
  cursor: pointer;
  user-select: none;
}

.console-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #4285f4;
}

.console-checkbox span {
  white-space: nowrap;
}

.console-clear-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  background-color: #3e3e3e;
  color: #cccccc;
  border: 1px solid #4e4e4e;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.console-clear-btn:hover {
  background-color: #4e4e4e;
  border-color: #5e5e5e;
}

.console-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Console entry */
.console-entry {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-left: 3px solid transparent;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 0.25rem;
  transition: background-color 0.2s ease;
}

.console-entry.outgoing {
  border-left-color: #4285f4;
}

.console-entry.incoming {
  border-left-color: #34a853;
}

.console-entry.error {
  border-left-color: #ea4335;
  background-color: rgba(234, 67, 53, 0.15);
}

/* Expandable console entries */
.console-entry.expandable {
  cursor: pointer;
}

.console-entry.expandable:hover {
  background-color: rgba(255, 255, 255, 0.10);
}

.console-entry.expanded {
  background-color: rgba(255, 255, 255, 0.08);
}

.console-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}

.console-entry-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.console-entry-emoji {
  font-size: 0.9rem;
  line-height: 1;
  display: inline-block;
  user-select: none;
  min-width: 16px;
  text-align: center;
}

.console-expand-icon {
  font-size: 0.6rem;
  color: #858585;
  width: 12px;
  display: inline-block;
  transition: transform 0.2s ease;
  user-select: none;
}

.console-entry-type {
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.console-entry.outgoing .console-entry-type {
  color: #4285f4;
}

.console-entry.incoming .console-entry-type {
  color: #34a853;
}

.console-entry.error .console-entry-type {
  color: #ea4335;
}

.console-entry-author {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  text-transform: lowercase;
  letter-spacing: 0.3px;
  border: 1px solid;
}

/* Default style (for agents) */
.console-entry-author {
  background-color: rgba(156, 220, 254, 0.15);
  color: #9cdcfe;
  border-color: rgba(156, 220, 254, 0.3);
}

/* User author badge */
.console-entry-author[data-author="user"] {
  background-color: rgba(66, 133, 244, 0.2);
  color: #80b3ff;
  border-color: rgba(66, 133, 244, 0.4);
}

/* System author badge */
.console-entry-author[data-author="system"] {
  background-color: rgba(133, 133, 133, 0.2);
  color: #b0b0b0;
  border-color: rgba(133, 133, 133, 0.3);
}

.console-entry-timestamp {
  color: #858585;
  font-size: 0.65rem;
}

.console-entry-content {
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.7rem;
  line-height: 1.4;
  padding-left: 2.5rem; /* Indent to align with header after emoji and icon */
}

.console-entry-content:empty {
  display: none;
}

/* Style for quoted text in summaries (transcriptions, text responses) */
.console-entry-content::first-line {
  color: #e0e0e0;
}

.console-entry-json {
  background-color: #252526;
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-top: 0.5rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  transition: all 0.3s ease;
}

.console-entry-json.collapsed {
  display: none;
}

.console-entry-json pre {
  margin: 0;
  color: #9cdcfe;
}

/* Highlight key fields in JSON */
.json-key {
  color: #9cdcfe;
}

.json-string {
  color: #ce9178;
}

.json-number {
  color: #b5cea8;
}

.json-boolean {
  color: #569cd6;
}

.json-null {
  color: #569cd6;
}

/* Console scrollbar */
.console-content::-webkit-scrollbar {
  width: 8px;
}

.console-content::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.console-content::-webkit-scrollbar-thumb {
  background: #3e3e3e;
  border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

/* JSON scrollbar */
.console-entry-json::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.console-entry-json::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.console-entry-json::-webkit-scrollbar-thumb {
  background: #3e3e3e;
  border-radius: 3px;
}

.console-entry-json::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

/* Responsive Design */

/* Tablet: hide dev console, expand insights */
@media (min-width: 769px) and (max-width: 1024px) {
  #insights-app {
    flex: 2;
  }
}

@media (max-width: 768px) {
  header {
    padding: 1rem 1.5rem;
  }

  h1 {
    font-size: 1.25rem;
  }

  .connection-status {
    position: static;
    margin-top: 0.5rem;
  }

  /* Stack all three panels vertically on mobile */
  .main-layout {
    flex-direction: column;
  }

  #insights-app {
    max-height: 250px;
    border-right: none;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
  }

  .console-panel {
    max-height: 200px;
    border-top: 1px solid var(--border-color);
  }

  .container {
    border-right: none;
  }

  #messages {
    padding: 1rem;
  }

  .bubble {
    max-width: 85%;
  }

  .input-container {
    padding: 1rem;
  }

  #messageForm {
    flex-direction: column;
    gap: 0.75rem;
  }

  .input-wrapper {
    width: 100%;
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}

/* Loading state */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Camera Preview Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  max-height: 90%;
  width: 640px;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #202124;
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #5f6368;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background-color: #f1f3f4;
  color: #202124;
}

.modal-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  border-radius: 0 0 1rem 1rem;
}

#cameraPreview {
  width: 100%;
  max-height: 480px;
  border-radius: 0.5rem;
  object-fit: contain;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  background-color: white;
  border-radius: 0 0 1rem 1rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary:hover {
  background-color: #3367d6;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: white;
  color: #5f6368;
  padding: 0.875rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-secondary:hover {
  background-color: #f8f9fa;
  border-color: #bdc1c6;
}

/* Discovery Complete Banner */
.discovery-complete-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #34a853 0%, #1e8e3e 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.banner-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-report-primary {
  background: white;
  color: #1e8e3e;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-report-primary:hover {
  background: #f1f3f4;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-report-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-report-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Report Panel (replaces console) */
.report-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.report-panel .report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #2d2d2d;
  border-bottom: 1px solid #3e3e3e;
}

.report-panel .report-header h2 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: #cccccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.report-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #80b3ff;
  border-bottom: 1px solid #3e3e3e;
  padding-bottom: 0.375rem;
  margin: 1.25rem 0 0.75rem;
}

.report-section:first-child h3 {
  margin-top: 0;
}

.insight-card {
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid #4285f4;
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0 0.25rem 0.25rem 0;
  font-size: 0.8rem;
  color: #d4d4d4;
  line-height: 1.5;
}

.insight-card blockquote {
  border-left: 2px solid #1a73e8;
  background: rgba(26, 115, 232, 0.1);
  padding: 0.375rem 0.625rem;
  margin: 0.375rem 0 0;
  border-radius: 0 0.25rem 0.25rem 0;
  font-style: italic;
  font-size: 0.75rem;
  color: #9aa0a6;
}

.severity-badge, .importance-badge {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  border-radius: 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 0.375rem;
}

.severity-high, .importance-high { background: rgba(197, 34, 31, 0.2); color: #f28b82; }
.severity-medium, .importance-medium { background: rgba(227, 116, 0, 0.2); color: #fdd663; }
.severity-low, .importance-low { background: rgba(19, 115, 51, 0.2); color: #81c995; }

.jtbd-group {
  margin-bottom: 0.75rem;
}

.jtbd-card {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0;
  border-radius: 0.25rem;
  font-style: italic;
  font-size: 0.8rem;
  color: #d4d4d4;
}

.jtbd-card blockquote {
  border-left: 2px solid #1a73e8;
  background: rgba(26, 115, 232, 0.1);
  padding: 0.375rem 0.625rem;
  margin: 0.375rem 0 0;
  border-radius: 0 0.25rem 0.25rem 0;
  font-size: 0.75rem;
  color: #9aa0a6;
}

.report-content .signal-group {
  margin-bottom: 0.625rem;
  padding: 0.375rem 0;
}

.signal-count {
  background: #3e3e3e;
  color: #9aa0a6;
  padding: 0.0625rem 0.375rem;
  border-radius: 0.75rem;
  font-size: 0.65rem;
  font-weight: 500;
  margin-left: 0.25rem;
}

.report-content .signal-excerpt {
  color: #9aa0a6;
  font-size: 0.75rem;
  padding-left: 0.75rem;
  margin-top: 0.125rem;
}

.research-type-badge {
  background: #3e3e3e;
  color: #9aa0a6;
  padding: 0.0625rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Report content scrollbar */
.report-content::-webkit-scrollbar {
  width: 8px;
}

.report-content::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.report-content::-webkit-scrollbar-thumb {
  background: #3e3e3e;
  border-radius: 4px;
}

.report-content::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

/* Print styles for report */
@media print {
  header, .input-container, .console-panel, .insights-panel, .connection-status, .header-options {
    display: none !important;
  }
  .main-layout {
    display: block;
  }
  .container {
    border: none;
  }
  .message, .system-message {
    break-inside: avoid;
  }
}
