/* ============================================================================
   Pro UI — Settings surface (#pro-settings).
   Scoped ENTIRELY under #pro-settings so nothing collides with chat-slim.css's
   generic classes (.card/.row/.head/.body/.rail/.mode/.key/.link/etc.).
   Uses pro-tokens.css vars only — no hardcoded palette, no external assets.
   Ports A.I Vault settings.html look onto the live chat-slim daily driver.
   Shown by toggling [hidden] via the activeSurface state (operator wires JS).
   ============================================================================ */

/* ---- surface shell: full-bleed sibling inside .chat-shell -------------- */
#pro-settings {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 60% -10%, rgba(34, 211, 238, 0.07), transparent 60%),
    var(--pro-base);
  color: var(--pro-text);
  font-family: var(--pro-font-body);
  -webkit-font-smoothing: antialiased;
}
#pro-settings[hidden] { display: none; }
#pro-settings *,
#pro-settings *::before,
#pro-settings *::after { box-sizing: border-box; }

/* ---- header ------------------------------------------------------------ */
#pro-settings .ps-head {
  flex: none;
  padding: 26px 34px 18px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.08);
}
#pro-settings .ps-title {
  margin: 0;
  font-family: var(--pro-font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #eaf6fa;
}
#pro-settings .ps-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--pro-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#pro-settings .ps-audit {
  font-family: var(--pro-font-mono);
  font-size: 10.5px;
  color: var(--pro-success);
  letter-spacing: 0.06em;
}

/* ---- scrollable body + centered column --------------------------------- */
#pro-settings .ps-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 34px;
}
#pro-settings .ps-wrap {
  max-width: 680px;
  margin: 0 auto;
}

/* ---- grouped card blocks ----------------------------------------------- */
#pro-settings .ps-group { margin-bottom: 26px; }
#pro-settings .ps-glabel {
  font-family: var(--pro-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--pro-study);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#pro-settings .ps-glabel svg {
  width: 15px;
  height: 15px;
  flex: none;
  stroke: currentColor;
}
#pro-settings .ps-card {
  background: rgba(9, 15, 23, 0.6);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: 14px;
  overflow: hidden;
}

/* ---- rows -------------------------------------------------------------- */
#pro-settings .ps-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}
#pro-settings .ps-row:last-child { border-bottom: 0; }
#pro-settings .ps-info { min-width: 0; flex: 1; }
#pro-settings .ps-k {
  font-size: 14px;
  color: #e2e8ee;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
#pro-settings .ps-d {
  font-size: 12px;
  color: #6f7a83;
  margin-top: 2px;
}

/* mono machine-key chip beside a label */
#pro-settings .ps-key {
  font-family: var(--pro-font-mono);
  font-size: 10px;
  color: #48555e;
  letter-spacing: 0.03em;
}

/* amber "restart" badge */
#pro-settings .ps-badge {
  font-family: var(--pro-font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--pro-amber);
  border: 1px solid rgba(240, 182, 77, 0.35);
  border-radius: 20px;
  padding: 2px 7px;
  text-transform: uppercase;
  flex: none;
}

/* ---- controls: toggle switch ------------------------------------------- */
#pro-settings .ps-toggle {
  width: 40px;
  height: 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  position: relative;
  flex: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
#pro-settings .ps-toggle .ps-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #eef6f8;
  transition: left 0.15s ease, background 0.15s ease;
}
#pro-settings .ps-toggle.is-on {
  background: var(--pro-spine-cyan);
  border-color: transparent;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.45);
}
#pro-settings .ps-toggle.is-on .ps-knob {
  left: 20px;
  background: #04141a;
}
#pro-settings .ps-toggle:focus-visible {
  outline: 2px solid var(--pro-glow-cyan);
  outline-offset: 2px;
}

/* ---- controls: select + number/text field ------------------------------ */
#pro-settings .ps-select,
#pro-settings .ps-input {
  font-family: var(--pro-font-mono);
  font-size: 12.5px;
  color: #dbe3ea;
  background: rgba(6, 10, 16, 0.7);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 9px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}
#pro-settings .ps-select { cursor: pointer; }
#pro-settings .ps-select .ps-cy { color: var(--pro-glow-cyan); }
#pro-settings .ps-select svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  opacity: 0.75;
}
/* native controls inherit the chip look */
#pro-settings select.ps-select,
#pro-settings input.ps-input {
  appearance: none;
  -webkit-appearance: none;
  max-width: 190px;
}
#pro-settings input.ps-input::placeholder { color: var(--pro-text-faint); }
#pro-settings .ps-select:focus-within,
#pro-settings .ps-select:focus-visible,
#pro-settings .ps-input:focus-within,
#pro-settings input.ps-input:focus-visible,
#pro-settings select.ps-select:focus-visible {
  border-color: var(--pro-spine-cyan);
  outline: none;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35);
}

/* ---- controls: accent swatch ------------------------------------------- */
#pro-settings .ps-swatch {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--pro-spine-cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
  flex: none;
}

/* ---- controls: inline action link (Security group) --------------------- */
#pro-settings .ps-link {
  font-family: var(--pro-font-body);
  font-size: 12.5px;
  color: var(--pro-glow-cyan);
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
#pro-settings .ps-link svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  flex: none;
}
#pro-settings .ps-link.is-danger { color: var(--pro-danger-soft); }
#pro-settings .ps-link:hover { text-decoration: underline; }

/* ---- narrow viewports -------------------------------------------------- */
@media (max-width: 640px) {
  #pro-settings .ps-head { padding: 20px 18px 14px; }
  #pro-settings .ps-body { padding: 18px 16px; }
  #pro-settings .ps-row { flex-wrap: wrap; gap: 10px; }
  #pro-settings .ps-row .ps-select,
  #pro-settings .ps-row .ps-input,
  #pro-settings .ps-row .ps-link { margin-left: auto; }
}
