/* Regex Tester & Match Debugger — content styles.
   Prefix: --rx-  /  .rx-

   Reference point: a single vertical debugging console — pattern bar on
   top, one test-string editor with inline highlight marks growing directly
   out of the text (not a second output pane), a match list beneath it,
   then a replace preview. Deliberately different structure from this
   cluster's other split-pane tool (json-to-csv-and-yaml-converter):
   one column throughout, light-mode-following editor (no fixed dark
   console), highlight colour instead of a second surface to tell matches
   apart from the rest of the text.

   THIS FILE STYLES THE CONTENT AREA ONLY. Chrome is owned by chrome.css. */

:root {
  --rx-surface: #ffffff;
  --rx-panel:   #f4f5f3;
  --rx-line:    #dcdfda;
  --rx-text:    #14181a;
  --rx-muted:   #616b63;
  --rx-mono:    ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

.rx-wrap {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ── Pattern bar ─────────────────────────────────────────────────────────── */

.rx-pattern-bar {
  margin-bottom: 1rem;
}

.rx-pattern-field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rx-muted);
}

.rx-pattern-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--rx-line);
  border-radius: 2px;
  background: var(--rx-surface);
  overflow: hidden;
}

.rx-slash {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  font-family: var(--rx-mono);
  font-size: 1rem;
  color: var(--rx-muted);
  background: var(--rx-panel);
}

.rx-pattern-input input {
  border: 0;
  outline: none;
  padding: 0.625rem 0.5rem;
  font-family: var(--rx-mono);
  font-size: 0.9375rem;
  color: var(--rx-text);
  background: transparent;
}

#rxPattern { flex: 1 1 auto; min-width: 0; }
.rx-flags { width: 5rem; flex: 0 0 auto; }

.rx-pattern-input:focus-within {
  outline: 2px solid var(--tf-accent);
  outline-offset: -1px;
}

.rx-error {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  font-family: var(--rx-mono);
  color: #b3261e;
}

/* ── Editor panel with inline highlighting ──────────────────────────────── */

.rx-editor-panel {
  border: 1px solid var(--rx-line);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: var(--rx-surface);
}

.rx-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--rx-panel);
  border-bottom: 1px solid var(--rx-line);
}

.rx-pane-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--rx-muted);
}

.rx-summary {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tf-accent);
}

.rx-highlight-wrap {
  position: relative;
  height: 12rem;
}

.rx-backdrop,
.rx-testinput {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0.875rem 1rem;
  border: 0;
  font-family: var(--rx-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
}

.rx-backdrop {
  color: var(--rx-text);
  pointer-events: none;
  z-index: 0;
}

.rx-mark {
  background: var(--tf-accent-wash);
  border-bottom: 2px solid var(--tf-accent);
  border-radius: 1px;
  color: inherit;
}

.rx-testinput {
  z-index: 1;
  background: transparent;
  color: transparent;
  caret-color: var(--rx-text);
  resize: vertical;
  outline: none;
}

.rx-testinput:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: -2px;
}

/* ── Primary action button ──────────────────────────────────────────────── */

.rx-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--tf-accent-ink);
  background: var(--tf-accent);
  border: 1px solid var(--tf-accent);
  border-radius: 2px;
  cursor: pointer;
  margin-bottom: 1.5rem;
}

.rx-btn:hover  { background: var(--tf-accent-hover);  border-color: var(--tf-accent-hover); }
.rx-btn:active { background: var(--tf-accent-active); border-color: var(--tf-accent-active); }

.rx-btn:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* ── Match list ──────────────────────────────────────────────────────────── */

.rx-results {
  margin-bottom: 1.5rem;
}

.rx-results-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rx-muted);
}

.rx-match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  max-height: 16rem;
  overflow-y: auto;
}

.rx-match-item {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--rx-line);
  border-radius: 2px;
  background: var(--rx-surface);
}

.rx-match-head {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.rx-match-index {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--rx-muted);
  flex: 0 0 auto;
}

.rx-match-full {
  font-family: var(--rx-mono);
  font-size: 0.8125rem;
  color: var(--rx-text);
  word-break: break-all;
}

.rx-match-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.rx-group-chip {
  padding: 0.125rem 0.5rem;
  font-family: var(--rx-mono);
  font-size: 0.75rem;
  color: var(--rx-text);
  background: var(--rx-panel);
  border: 1px solid var(--rx-line);
  border-radius: 2px;
}

/* ── Replace preview ─────────────────────────────────────────────────────── */

.rx-replace {
  margin-bottom: 1.5rem;
}

.rx-field {
  margin-bottom: 0.75rem;
}

.rx-field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rx-muted);
}

.rx-field label code {
  font-family: var(--rx-mono);
  background: var(--rx-panel);
  padding: 0.05rem 0.3rem;
  border-radius: 1px;
}

.rx-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.625rem 0.75rem;
  font-family: var(--rx-mono);
  font-size: 0.875rem;
  color: var(--rx-text);
  background: var(--rx-surface);
  border: 1px solid var(--rx-line);
  border-radius: 2px;
}

.rx-field input:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: -1px;
}

.rx-pane-head-lite {
  padding: 0.375rem 0;
}

.rx-editor.rx-replace-output {
  margin: 0;
  padding: 0.875rem 1rem;
  min-height: 6rem;
  max-height: 14rem;
  overflow: auto;
  font-family: var(--rx-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--rx-text);
  background: var(--rx-panel);
  border: 1px solid var(--rx-line);
  border-radius: 2px;
}

/* ── Ad slots ───────────────────────────────────────────────────────────── */

.rx-ad {
  min-height: 280px;
  margin: 2rem auto 0;
  max-width: 52rem;
  padding-inline: 1.5rem;
}

@media (max-width: 26rem) {
  .rx-wrap,
  .rx-ad { padding-inline: 1rem; }
}

/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --rx-surface: var(--tf-surface);
  --rx-panel: var(--tf-surface);
  --rx-line: var(--tf-rule);
  --rx-text: var(--tf-ink);
  --rx-muted: var(--tf-ink-soft);
}
