/* ==========================================================================
   ListenComponent — Standalone Voice-to-Insight Component Styles
   
   All classes prefixed with `lc-` to avoid collisions.
   Uses CSS variables from the parent GrowthCanvas theme system.
   ========================================================================== */

/* ==========================================================================
   Listen Button (rendered in headerEl)
   ========================================================================== */
.lc-listen-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-weight: 600;
}

.lc-listen-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.lc-listen-btn.listening {
  background: var(--bad, #e74c3c);
  animation: lc-pulse-listen 1.5s ease-in-out infinite;
}

.lc-listen-btn.paused {
  background: var(--warn, #f39c12);
}

@keyframes lc-pulse-listen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.02); }
}

/* Clear All Button */
.lc-clear-all-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all 0.2s;
}

.lc-clear-all-btn:hover {
  border-color: var(--bad, #e74c3c);
  color: var(--bad, #e74c3c);
  background: color-mix(in srgb, var(--bad, #e74c3c) 8%, var(--bg));
}

/* Waveform Strip */
.lc-waveform-strip {
  display: none;
  width: 180px;
  height: 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  padding: 3px 6px;
}

.lc-waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
}


/* ==========================================================================
   Suggested Follow-up Questions (optional)
   ========================================================================== */
.lc-suggested-questions {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), color-mix(in srgb, var(--accent) 2%, transparent));
  border: 1px solid var(--accent);
  border-radius: 10px;
  margin-bottom: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.lc-suggested-questions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.lc-suggested-questions-header:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.lc-suggested-questions-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex: 1;
}

.lc-suggested-icon {
  font-size: 16px;
}

.lc-suggested-toggle {
  font-size: 10px;
  color: var(--accent);
  transition: transform 0.2s;
}

.lc-suggested-questions.collapsed .lc-suggested-toggle {
  transform: rotate(-90deg);
}

.lc-suggested-questions-body {
  padding: 0 14px 14px 14px;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
  max-height: 200px;
  opacity: 1;
}

.lc-suggested-questions.collapsed .lc-suggested-questions-body {
  max-height: 0;
  opacity: 0;
  padding: 0 14px;
  overflow: hidden;
}

.lc-suggested-questions-list {
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
}

.lc-suggested-questions-list p {
  margin: 0 0 6px 0;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.lc-suggested-questions-list p:hover {
  background: var(--card);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.lc-suggested-questions-list p:last-child {
  margin-bottom: 0;
}

/* Theme overrides for suggested questions */
.theme-light .lc-suggested-questions {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0.01));
  border-color: #2563eb;
}
.theme-light .lc-suggested-questions-header h4 {
  color: #2563eb;
}
.theme-ocean .lc-suggested-questions {
  background: linear-gradient(135deg, rgba(17, 181, 228, 0.1), rgba(17, 181, 228, 0.02));
  border-color: #11b5e4;
}
.theme-ocean .lc-suggested-questions-header h4 {
  color: #11b5e4;
}


/* ==========================================================================
   Transcript Section
   ========================================================================== */
.lc-transcript-section {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}

.lc-transcript-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.lc-transcript-header:hover {
  background: var(--bg);
}

.lc-transcript-icon {
  font-size: 16px;
}

.lc-transcript-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.lc-transcript-toggle-icon {
  font-size: 10px;
  transition: transform 0.2s;
  color: var(--muted);
}

.lc-transcript-badge {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 8px;
}

.lc-transcript-collapsible {
  transition: max-height 0.3s ease, opacity 0.2s ease;
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  padding: 0 12px 12px 12px;
}

.lc-transcript-section.collapsed .lc-transcript-collapsible {
  max-height: 0;
  opacity: 0;
  padding: 0 12px;
}

.lc-transcript-section.collapsed .lc-transcript-toggle-icon {
  transform: rotate(-90deg);
}

.lc-transcript-section.collapsed .lc-transcript-display {
  display: none;
}

.lc-transcript-section.collapsed {
  margin-bottom: 8px;
}

.lc-transcript-display {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  position: relative;
}

.lc-transcript-display.empty {
  min-height: 60px;
  height: auto;
  font-style: italic;
  text-align: center;
  padding: 20px;
  color: var(--muted);
}

.lc-transcript-display p {
  margin: 0;
}

/* Transcript Session Blocks */
.lc-transcript-session {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lc-transcript-session:first-child {
  margin-top: 0;
}

.lc-active-session {
  border-color: var(--accent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent);
}

.lc-session-header,
.lc-session-header-active {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--line);
}

.lc-session-header:hover {
  background: var(--line);
}

.lc-session-toggle {
  font-size: 10px;
  transition: transform 0.2s;
  width: 12px;
  text-align: center;
}

.lc-session-title,
.lc-session-title-text {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.lc-recording-indicator {
  animation: lc-pulse-recording 1.5s infinite;
}

.lc-paused-indicator {
  opacity: 0.8;
}

.lc-delete-session-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.lc-delete-session-btn:hover {
  background: var(--bad, #e74c3c);
  color: white;
}

.lc-session-content {
  padding: 12px;
  max-height: 300px;
  overflow-y: auto;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.lc-session-content.collapsed {
  max-height: 0;
  padding: 0 12px;
  overflow: hidden;
}

.lc-session-content p {
  margin: 0;
  line-height: 1.6;
  color: var(--text);
}

/* Transcript Chunks */
.lc-transcript-chunk {
  padding: 10px 12px;
  background: var(--card);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.lc-timestamp {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}


/* ==========================================================================
   Insights Toolbar (status + auto-apply toggle)
   ========================================================================== */
.lc-insights-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px;
  margin: 4px 0 2px;
  border-bottom: 1px solid var(--line);
  gap: 8px;
  min-height: 28px;
}

.lc-toolbar-spacer {
  flex: 1;
}

/* Auto-apply toggle */
.lc-auto-apply-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  margin-left: auto;
}

.lc-auto-apply-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.lc-auto-apply-checkbox {
  display: none;
}

.lc-toggle-slider {
  position: relative;
  width: 28px;
  height: 16px;
  background: color-mix(in srgb, var(--muted) 30%, transparent);
  border-radius: 8px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.lc-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--text-secondary, #aaa);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.lc-auto-apply-checkbox:checked + .lc-toggle-slider {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
}

.lc-auto-apply-checkbox:checked + .lc-toggle-slider::after {
  transform: translateX(12px);
  background: var(--accent);
}

/* Status indicator */
.lc-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
}

.lc-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lc-status-text {
  color: var(--muted);
}

/* Idle - green */
.lc-status-indicator.idle .lc-status-dot {
  background: var(--ok, #27ae60);
}
.lc-status-indicator.idle .lc-status-text {
  color: var(--ok, #27ae60);
}

/* Recording - red with pulse */
.lc-status-indicator.recording .lc-status-dot {
  background: var(--bad, #e74c3c);
  animation: lc-pulse-recording 1.5s infinite;
}
.lc-status-indicator.recording .lc-status-text {
  color: var(--bad, #e74c3c);
}

/* Transcribing - amber */
.lc-status-indicator.transcribing .lc-status-dot {
  background: var(--warn, #f39c12);
  animation: lc-pulse-processing 1s infinite;
}
.lc-status-indicator.transcribing .lc-status-text {
  color: var(--warn, #f39c12);
}

/* Analyzing - accent/blue */
.lc-status-indicator.analyzing .lc-status-dot {
  background: var(--accent);
  animation: lc-pulse-processing 1s infinite;
}
.lc-status-indicator.analyzing .lc-status-text {
  color: var(--accent);
}

@keyframes lc-pulse-recording {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

@keyframes lc-pulse-processing {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}


/* ==========================================================================
   Insight Cards
   ========================================================================== */
.lc-insights-container {
  flex: 1;
  overflow-y: auto;
}

.lc-insight-card {
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  transition: border-color 0.3s ease, filter 0.3s ease;
}

.lc-insight-card:hover {
  border-color: var(--accent);
  filter: brightness(1.05);
}

.lc-insight-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.lc-insight-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.lc-insight-qnum {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.lc-insight-question {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
}

.lc-insight-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 2px;
}

.lc-insight-confidence {
  font-size: 11px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
}

.lc-insight-confidence.high { color: var(--ok, #27ae60); }
.lc-insight-confidence.medium { color: var(--warn, #f39c12); }
.lc-insight-confidence.low { color: var(--bad, #e74c3c); }

.lc-insight-answer {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 10px;
}

.lc-insight-suggestions {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--bg);
  border-radius: 4px;
}

/* Applied state */
.lc-insight-card.applied {
  border-color: var(--ok, #27ae60);
  opacity: 0.8;
}

.lc-applied-badge {
  display: none;
  font-size: 11px;
  color: var(--ok, #27ae60);
  font-weight: 600;
}

.lc-insight-card.applied .lc-applied-badge {
  display: inline-block;
}

/* Use Answer Button */
.lc-use-answer-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-block;
}

.lc-use-answer-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.lc-use-answer-btn:disabled {
  background: var(--ok, #27ae60);
  color: #fff;
  cursor: default;
  transform: none;
  opacity: 1;
}


/* ==========================================================================
   Additional Context (ported from interview UI)
   ========================================================================== */
.lc-additional-context {
  margin-top: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-height: 100px;
  overflow-y: auto;
}

.lc-additional-context-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  font-weight: 600;
}

.lc-ac-icon {
  font-size: 12px;
}

.lc-additional-context-text {
  font-style: italic;
  color: var(--text);
  opacity: 0.8;
}


/* ==========================================================================
   Timeout Notification
   ========================================================================== */
.lc-timeout-notification {
  background: color-mix(in srgb, var(--warn, #f39c12) 15%, var(--card));
  border: 1px solid var(--warn, #f39c12);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text);
}


/* ==========================================================================
   Responsive — Narrow viewports
   ========================================================================== */
@media (max-width: 768px) {
  .lc-waveform-strip {
    width: 120px;
  }

  .lc-insight-card {
    padding: 10px;
  }

  .lc-transcript-display {
    min-height: 80px;
    max-height: 250px;
  }

  .lc-session-content {
    max-height: 200px;
  }
}

/* ==========================================================================
   QA Panel Additional Context (left side, under each textarea)
   ========================================================================== */
.lc-qa-additional-context {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  line-height: 1.4;
}

.lc-qa-ctx-label {
  font-weight: 600;
  color: var(--accent);
  margin-right: 6px;
}

.lc-qa-ctx-text {
  color: var(--text);
  opacity: 0.85;
}
