/* RegexTester — tool-specific styles.
   Shared styles (nav, panels, buttons) live in ../../css/style.css */

.rx { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Pattern ---------- */
.rx-pattern-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #141418;
  border: 1px solid #26262b;
  border-radius: 12px;
  padding: 0 12px;
  transition: border-color .15s, box-shadow .15s;
}
.rx-pattern-row:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(232, 70, 124, .18);
}
.rx-slash {
  flex: none;
  color: #4a4a52;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.2rem;
}
.rx-pattern {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--pink-light);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1rem;
  padding: 13px 0;
}
.rx-pattern::placeholder { color: #4a4a52; }

.rx-flags { flex: none; display: flex; gap: 3px; }
.rx-flag {
  width: 28px; height: 28px;
  border: 1px solid #26262b;
  border-radius: 7px;
  background: #1c1c20;
  color: #5c5c66;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.rx-flag:hover { color: #c4c4cc; border-color: #3a3a42; }
.rx-flag.active { background: var(--pink); border-color: var(--pink); color: #fff; }

.rx-error {
  margin-top: 10px;
  color: #fca5a5;
  font-size: .82rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.rx-error[hidden] { display: none; }

/* ---------- Layout ---------- */
.rx-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: start;
}
.rx-pane { display: flex; flex-direction: column; min-width: 0; }
.rx-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rx-head-actions { margin-left: auto; display: flex; gap: 6px; }

/* ---------- Editor with highlight layer ---------- */
.rx-editor { position: relative; }

.rx-highlight,
#rx-text {
  margin: 0;
  width: 100%;
  min-height: 360px;
  padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .86rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  border: none;
}

.rx-highlight {
  position: absolute;
  inset: 0;
  overflow: auto;
  color: transparent;
  pointer-events: none;
}
.rx-highlight mark {
  background: rgba(232, 70, 124, .3);
  color: transparent;
  border-radius: 2px;
}
.rx-highlight mark.is-empty {
  background: none;
  border-left: 2px solid var(--pink);
}

#rx-text {
  position: relative;
  background: transparent;
  color: var(--text);
  caret-color: var(--pink);
  outline: none;
  resize: vertical;
  display: block;
}
#rx-text::placeholder { color: #4a4a52; }

/* ---------- Matches ---------- */
.rx-count { margin-left: auto; color: var(--pink); font-size: .75rem; font-weight: 700; }
.rx-matches {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}
.rx-matches li {
  background: #141418;
  border: 1px solid #1c1c20;
  border-radius: 9px;
  padding: 8px 10px;
}
.rx-match-head { display: flex; align-items: baseline; gap: 8px; }
.rx-match-value {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .8rem;
  color: var(--pink-light);
  word-break: break-all;
}
.rx-match-at { flex: none; color: #4a4a52; font-size: .68rem; font-variant-numeric: tabular-nums; }

.rx-groups {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #1c1c20;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rx-group { display: flex; align-items: baseline; gap: 8px; font-size: .75rem; }
.rx-group span {
  flex: none;
  min-width: 26px;
  color: #74747e;
  font-weight: 600;
}
.rx-group code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #9ae6b4;
  word-break: break-all;
}
.rx-group code.is-undefined { color: #4a4a52; }

.rx-empty { color: #4a4a52; font-size: .82rem; }

/* ---------- Replace ---------- */
.rx-replace { display: flex; flex-direction: column; gap: 10px; }
.rx-replace-input {
  width: 100%;
  background: #141418;
  border: 1px solid #26262b;
  border-radius: 10px;
  color: var(--text);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .85rem;
  padding: 10px 12px;
  outline: none;
}
.rx-replace-input:focus { border-color: var(--pink); }
.rx-replace-input::placeholder { color: #4a4a52; }

.rx-replaced {
  margin: 0;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c4c4cc;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.6;
}
.rx-replaced:empty::after {
  content: "Type a replacement above.";
  color: #4a4a52;
  font-family: "Inter", system-ui, sans-serif;
}

@media (max-width: 880px) {
  .rx-grid { grid-template-columns: 1fr; }
  .rx-highlight, #rx-text { min-height: 220px; }
  .rx-pattern-row { flex-wrap: wrap; padding: 8px 12px; }
  .rx-pattern { padding: 6px 0; }
  .rx-flags { width: 100%; }
}
