/* ══════════════════════════════════════════════════════════════
   RECORDER ENGINE — shared styles for new privacy/security features
   Extends the existing design tokens (--primary, --ink, etc.)
   defined inline on each page. Loaded after the page's own <style>.
   ══════════════════════════════════════════════════════════════ */

/* Network Activity Indicator */
#netIndicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
  cursor: default;
  white-space: nowrap;
}

#netIndicator.warn {
  background: #fff8e1;
  border-color: #ffe082;
  color: #8a5a00;
}

#netIndicator .net-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

#netIndicator.warn .net-dot {
  background: var(--warning);
}

#netIndicator .net-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.net-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  width: 280px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  z-index: 250;
  display: none;
}

.net-popover.open {
  display: block;
}

.net-popover strong {
  color: var(--ink);
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.net-indicator-wrap {
  position: relative;
  display: inline-block;
}

/* Offline / Air-gap badge */
#offlineBadge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  background: #eef2ff;
  border: 1px solid #C7D9FF;
  color: #155EEF;
  white-space: nowrap;
}

#offlineBadge.offline {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 14px 0 0;
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  background: var(--success-soft);
  border: 1px solid var(--success-soft-border);
  color: var(--success);
  border-radius: var(--radius-pill);
  padding: 5px 13px;
  white-space: nowrap;
}

/* Redaction tool */
#redactWrap {
  position: relative;
  display: none;
  margin-top: 20px;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

#redactWrap.visible {
  display: block;
}

#redactCanvasView {
  width: 100%;
  display: block;
  cursor: crosshair;
}

.redact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #18181b;
  padding: 12px 16px;
}

.redact-toolbar .left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.redact-hint {
  color: #aaa;
  font-size: 12px;
}

.redact-chip {
  background: #2a2a2e;
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.redact-chip:hover {
  background: #3a3a3f;
}

.redact-chip.primary {
  background: var(--primary);
}

.redact-chip.primary:hover {
  background: var(--primary-hover);
}

.redact-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.redact-count {
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  background: #2a2a2e;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
}

/* Checksum panel */
#checksumPanel {
  margin-top: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  display: none;
}

#checksumPanel.visible {
  display: block;
}

#checksumPanel .checksum-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

#checksumPanel .checksum-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

#checksumPanel code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  word-break: break-all;
  flex: 1;
  color: var(--ink);
}

.copy-chip {
  background: #111;
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.copy-chip:hover {
  background: #333;
}

.copy-chip.copied {
  background: var(--success);
}

/* Auto-clear notice */
.autoclear-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}

.autoclear-note svg {
  flex-shrink: 0;
  color: var(--muted);
}

/* Trim / cut panel */
#trimPanel {
  display: none;
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px 16px;
}

.trim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.trim-range-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.trim-track-wrap {
  padding: 14px 0 6px;
}

.trim-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

.trim-track-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

.trim-handle {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  transform: translateY(-50%);
  background: var(--white);
  border: 2.5px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: ew-resize;
  touch-action: none;
}

.trim-handle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.trim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* Caption burn-in toggle */
.caption-burn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--white);
  border: 1px solid var(--border);
}

.caption-burn-toggle input {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
}

/* Transcript panel (on-device Whisper output) */
#transcriptPanel {
  margin-top: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  display: none;
}

#transcriptPanel.visible {
  display: block;
}

#transcriptPanel .transcript-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  min-height: 16px;
}

#transcriptPanel .transcript-text {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

#transcriptPanel .transcript-text:empty {
  display: none;
}

/* Crash-safe recovery banner */
#recoveryBanner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #8a5a00;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.recovery-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Feature page hero badge row (used on landing pages) */
.use-case-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.use-case-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.use-case-card .uc-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #EAF1FF;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.use-case-card h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.use-case-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.page-crosslinks {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.page-crosslinks p.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 12px;
}

.crosslink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.crosslink-grid a {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.crosslink-grid a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Recording library — persistent storage panel */
.library-panel {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px 16px;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.library-mode-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-mode-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.library-mode-select select {
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  background: var(--white);
  color: var(--ink);
}

.library-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin: 6px 0 10px;
}

.library-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--warning-soft-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.library-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.library-disk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.library-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.library-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.library-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-item-meta {
  font-size: 11.5px;
  color: var(--muted);
}

.library-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.library-item-actions button {
  border: none;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  cursor: pointer;
}

.library-play-btn {
  background: #eef2ff;
  color: #155EEF;
}

.library-play-btn:hover {
  background: #D6E4FF;
}

.library-delete-btn {
  background: #fef2f2;
  color: #b42318;
}

.library-delete-btn:hover {
  background: #fde2e1;
}

.library-empty {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: 10px 0 2px;
  margin: 0;
}

@media (max-width: 600px) {
  .net-popover {
    right: auto;
    left: 0;
    width: 240px;
  }

  .trust-bar {
    justify-content: flex-start;
  }
}