/* Ported verbatim from frontend/css/style.css -- native <dialog> styling
   (record/upload/help/settings) plus the Record dialog's active-recording
   UI. */

.settings-dialog {
  width: min(560px, 92vw);
  max-height: 85vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  /* A <dialog>'s default overflow is visible, so without this, content
     taller than max-height paints outside the box instead of scrolling. */
  overflow: hidden;
}
/* #settings-dialog specifically (not record/upload/help, which share the
   .settings-dialog class but stay single-column) needs more width for its
   two-column category nav + content layout below. An ID selector here
   naturally outranks the shared class above without touching it. */
#settings-dialog { width: min(760px, 92vw); }
.settings-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }

.settings-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 85vh;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-header h2 { margin: 0; font-size: 16px; }

/* Settings' own two-column body: a persistent left category nav + right
   content area. flex:1/min-height:0 here (not on .settings-content alone)
   is what lets .settings-content be the ONE scrolling region for the
   whole dialog, sized to whatever height remains below the header. */
.settings-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 200px;
  flex-shrink: 0;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
}
.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.settings-nav-btn:hover { background: var(--panel-hover); color: var(--text); }
.settings-nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.settings-nav-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.settings-nav-icon { font-size: 15px; flex-shrink: 0; }

.settings-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.settings-section { padding: 24px 28px; }
.settings-section h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.settings-subheading { margin: 20px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

/* Smaller screens: the persistent left nav becomes a horizontal, wrapping
   row above the content -- same technique as .ai-tabs, not a dropdown, so
   every category stays one visible click away. */
@media (max-width: 900px) {
  #settings-dialog { width: min(560px, 92vw); }
  .settings-body { flex-direction: column; }
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .settings-nav-btn { width: auto; }
}

.settings-subsection {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-elevated) 60%, transparent);
}
.settings-subsection .settings-subheading { margin-top: 0; }
.lmstudio-status-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
#lmstudio-models-line { margin: 8px 0 0; }

.theme-preview-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.theme-swatch { width: 22px; height: 22px; border-radius: 7px; border: 1px solid var(--border-strong); flex-shrink: 0; }

.help-list { margin: 8px 0 16px; padding-left: 20px; font-size: 13px; line-height: 1.6; color: var(--text); }
.help-list li { margin-bottom: 6px; }

/* Collapsed by default -- de-emphasizes developer-only settings without
   hiding them entirely. */
.settings-advanced { margin-top: 14px; }
.settings-advanced > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  user-select: none;
}
.settings-advanced > summary:hover { color: var(--text); }
.settings-advanced[open] > summary { margin-bottom: 10px; }
.settings-advanced .settings-subsection:first-of-type { margin-top: 10px; }

/* Record dialog */
.record-source-options {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0 0 14px;
}
.record-source-options legend { font-weight: 600; margin-bottom: 10px; }
.record-source-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  margin: 0 !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text) !important;
  cursor: pointer;
}
.record-source-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.record-source-option input { margin-top: 3px; }
.record-source-option span { display: grid; gap: 3px; }
.record-source-option small { color: var(--muted); line-height: 1.35; }
#record-idle label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
#record-idle select {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.record-start-btn { width: 100%; }

.save-recording-format-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}
.save-recording-format-wrap { position: relative; }
.format-select-control {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 12px 40px 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.format-select-control:hover { border-color: var(--accent); background: var(--panel-hover); }
.format-select-control:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.save-recording-format-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.save-recording-location-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.save-recording-location {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  margin-bottom: 16px;
}
.save-recording-location-icon { font-size: 18px; flex-shrink: 0; }
.save-recording-location-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text);
}
.save-recording-location-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.save-recording-location-btn:hover { border-color: var(--accent); background: var(--panel-hover); color: var(--accent); }
.save-recording-location-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Reused by the global recording bar (layout.css) -- the dialog itself
   no longer has an in-progress view of its own, see record-dialog.js. */
.record-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--danger);
  animation: record-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.record-dot.paused { animation: none; background: var(--warning); }

.record-live-transcript {
  max-height: 140px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 12px;
}
.record-live-transcript:empty::before {
  content: "Listening\2026";
  color: var(--muted);
  font-style: italic;
}
.record-live-transcript .live-seg { margin: 0 0 6px; }
.record-live-transcript .live-seg:last-child { margin-bottom: 0; }
