/* ── Embed Dialog ────────────────────────────────────────────────────────── */

.embed-dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.embed-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(940px, 96vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px var(--shadow-lg);
  overflow: hidden;
}

.embed-dialog-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-label);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.embed-dialog-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.embed-dialog-left {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.embed-dialog-right {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

/* ── Segment list ─────────────────────────────────────────────────── */

.embed-seg-list {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.embed-seg-hint {
  margin: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.embed-seg-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.embed-seg-row:last-child {
  border-bottom: none;
}

.embed-seg-row:hover {
  background: var(--surface-raised, rgba(255,255,255,0.04));
}

.embed-seg-toggle {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent);
}

.embed-seg-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  flex: 1;
  word-break: break-word;
}

.embed-seg-row--excluded .embed-seg-text {
  text-decoration: line-through;
  color: var(--muted);
}

.embed-seg-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ── Trim checkboxes ──────────────────────────────────────────────── */

.embed-trim-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken, rgba(0,0,0,0.06));
}

.embed-trim-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

/* ── Options section ──────────────────────────────────────────────── */

.embed-options {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.embed-options-title {
  font-size: var(--fs-label);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.embed-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
}

.embed-option-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.embed-option-row--attribution {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.embed-attr-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text);
}

.embed-attr-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  padding: 4px 8px;
}

.embed-attr-input:disabled {
  opacity: 0.4;
}

.embed-option-row select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  padding: 3px 6px;
}

/* ── Duration indicator ───────────────────────────────────────────── */

.embed-duration {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.embed-duration--warn {
  color: #e07b3a;
}

.embed-duration--error {
  color: #d94f4f;
}

/* ── Right panel: preview ─────────────────────────────────────────── */

.embed-preview-label {
  font-size: var(--fs-label);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.embed-preview {
  background: #f0f0f0;
  border-radius: 8px;
  padding: 12px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Right panel: snippet ─────────────────────────────────────────── */

.embed-snippet-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.embed-snippet-label {
  font-size: var(--fs-label);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.embed-snippet-code {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 12px;
  background: var(--surface-sunken, rgba(0,0,0,0.1));
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  resize: none;
  width: 100%;
  color: var(--text);
  min-height: 72px;
}

.embed-snippet-link {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 12px;
  background: var(--surface-sunken, rgba(0,0,0,0.1));
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  width: 100%;
  color: var(--text);
  outline: none;
  cursor: text;
}

.embed-copy-btn {
  align-self: flex-end;
  font-size: 12px;
}

/* ── Footer actions ───────────────────────────────────────────────── */

.embed-dialog-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Widget preview styles (mirrors generated HTML .lq-* styles) ──── */

.embed-preview .lq-widget {
  font-family: var(--lq-preview-font, system-ui, sans-serif);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 20px 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.embed-preview .lq-transcript {
  font-size: 14px;
  line-height: 1.75;
  color: #1a1a2e;
}

.embed-preview .lq-quote {
  font-size: 2em;
  line-height: 0;
  position: relative;
  color: #c8a84b;
  font-family: Georgia, serif;
}

.embed-preview .lq-quote-open { top: .25em; margin-right: 2px; }
.embed-preview .lq-quote-close { top: .1em; margin-left: 2px; }

.embed-preview .lq-seg {
  border-radius: 3px;
  padding: 1px 2px;
  cursor: pointer;
  transition: background 0.15s;
}

.embed-preview .lq-seg:hover {
  background: #fef9ec;
}

.embed-preview .lq-seg.active {
  background: #fef3c7;
  color: #92400e;
}

.embed-preview .lq-ellipsis {
  color: #c8a84b;
  font-family: Georgia, serif;
  padding: 0 2px;
}

.embed-preview .lq-title {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  margin-bottom: 4px;
}

.embed-preview .lq-attribution {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  margin-top: -4px;
}

.embed-preview .lq-waveform {
  width: 100%;
  height: 40px;
  border-radius: 6px;
  display: block;
}

.embed-preview .lq-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.embed-preview .lq-play {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #c8a84b;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: default;
}

.embed-preview .lq-progress-wrap {
  flex: 1;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
}

.embed-preview .lq-progress-fill {
  height: 100%;
  background: #c8a84b;
  border-radius: 2px;
  width: 0%;
}

.embed-preview .lq-time {
  font-size: 11px;
  color: #6b7280;
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.embed-preview .lq-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
  font-size: 13px;
  flex-shrink: 0;
}

.embed-preview .lq-footer {
  font-size: 11px;
  color: #9ca3af;
  text-align: right;
}

.embed-preview .lq-footer a {
  color: #9ca3af;
  text-decoration: none;
  pointer-events: none;
}

/* ── Spinner ──────────────────────────────────────────────────────── */

.embed-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: embed-spin 0.7s linear infinite;
  vertical-align: middle;
}

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

.embed-error {
  font-size: 13px;
  color: #d94f4f;
  padding: 6px 0;
}
