/* Regex Tester - new two-column layout */

.rx-tool .rx-panels {
  margin: 0 -8px;
}
.rx-tool [class*='col-'] {
  padding: 0 8px;
}

.rx-input-panel,
.rx-output-panel {
  height: 100%;
}

.rx-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rx-status,
.rx-count {
  font-size: 12px;
  color: var(--text-secondary, #5f6b7a);
  white-space: nowrap;
}

.rx-count {
  font-weight: 600;
  color: var(--brand-color, #2f6fed);
}

.rx-body {
  display: flex;
  flex-direction: column;
}

.rx-field {
  margin-bottom: 14px;
}

.rx-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-primary, #212529);
}

.rx-hint {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-secondary, #5f6b7a);
}

.rx-pattern-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.rx-delim {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: var(--bg-subtle, #f1f3f5);
  border: 1px solid var(--border-color, #dde1e6);
  font-family: Consolas, Menlo, monospace;
  font-size: 14px;
  color: var(--text-secondary, #5f6b7a);
}

.rx-delim:first-of-type {
  border-radius: 6px 0 0 6px;
  border-right: none;
}

.rx-pattern-input {
  border-radius: 0;
  font-family: Consolas, Menlo, monospace;
}

.rx-flags-input {
  border-radius: 0 6px 6px 0;
  max-width: 76px;
  font-family: Consolas, Menlo, monospace;
}

.rx-flag-btns {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.rx-flag {
  min-width: 34px;
  padding: 4px 10px;
  border: 1px solid var(--border-color, #dde1e6);
  background: var(--panel-bg, #fff);
  color: var(--text-secondary, #5f6b7a);
  border-radius: 6px;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.rx-flag:hover {
  border-color: var(--brand-color, #2f6fed);
  color: var(--brand-color, #2f6fed);
}

.rx-flag.is-active {
  background: var(--brand-color, #2f6fed);
  border-color: var(--brand-color, #2f6fed);
  color: #fff;
}

.rx-presets {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.rx-preset {
  border: 1px solid var(--border-color, #dde1e6);
  background: var(--panel-bg, #fff);
  color: var(--text-primary, #212529);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.rx-preset:hover {
  border-color: var(--brand-color, #2f6fed);
  color: var(--brand-color, #2f6fed);
}

.rx-textarea {
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 170px;
}

.rx-replace-row {
  display: flex;
  gap: 8px;
}

.rx-replace-row .form-control {
  flex: 1;
  min-width: 0;
  font-family: Consolas, Menlo, monospace;
}

.rx-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.rx-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary, #5f6b7a);
  cursor: pointer;
  margin-left: auto;
}

.rx-live input {
  cursor: pointer;
}

.rx-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 8px;
  padding: 10px 12px;
  transition: opacity 0.25s ease;
}

.rx-message.is-fading {
  opacity: 0;
}

.rx-message.hidden {
  display: none;
}

.rx-msg-error {
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.35);
  color: #c0392b;
}

.rx-msg-success {
  background: rgba(40, 167, 69, 0.08);
  border: 1px solid rgba(40, 167, 69, 0.35);
  color: #1e7e34;
}

.rx-msg-info {
  background: rgba(47, 111, 237, 0.07);
  border: 1px solid rgba(47, 111, 237, 0.3);
  color: var(--brand-color, #2f6fed);
}

[data-theme='dark'] .rx-msg-error {
  color: #f08a8a;
}

[data-theme='dark'] .rx-msg-success {
  color: #7fd88f;
}

[data-theme='dark'] .rx-msg-info {
  color: #7fb0ff;
}

/* ---- output side ---- */
.rx-highlight {
  border: 1px solid var(--border-color, #e3e6ea);
  border-radius: 8px;
  min-height: 140px;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--code-bg, #f8f9fa);
  color: var(--text-primary, #212529);
}

.rx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 110px;
  color: var(--text-secondary, #5f6b7a);
  text-align: center;
}

.rx-empty i {
  font-size: 30px;
  opacity: 0.4;
}

.rx-empty p {
  margin: 0;
  font-size: 12.5px;
  max-width: 300px;
  line-height: 1.5;
}

.rx-error {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #c0392b;
}

.rx-error i {
  font-size: 20px;
}

.rx-error p {
  margin: 0;
  font-size: 12.5px;
}

.rx-mark {
  background: rgba(255, 193, 7, 0.45);
  border-radius: 3px;
  padding: 0 1px;
  color: inherit;
}

[data-theme='dark'] .rx-mark {
  background: rgba(240, 180, 41, 0.35);
}

.rx-dim {
  opacity: 0.5;
}

.rx-detail {
  margin-top: 14px;
}

.rx-detail-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary, #5f6b7a);
  margin-bottom: 8px;
}

.rx-detail-scroll {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border-color, #e3e6ea);
  border-radius: 8px;
}

.rx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rx-table th,
.rx-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color, #eef0f3);
  vertical-align: top;
}

.rx-table th {
  position: sticky;
  top: 0;
  background: var(--bg-subtle, #f1f3f5);
  color: var(--text-secondary, #5f6b7a);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  z-index: 1;
}

.rx-table code {
  font-size: 12px;
}

.rx-output-panel .result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.rx-meta-stack {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.rx-meta {
  font-size: 12px;
  color: var(--text-secondary, #5f6b7a);
  font-family: Consolas, Menlo, monospace;
  word-break: break-all;
}

.rx-output-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rx-cheatsheet {
  margin-top: 14px;
  border: 1px solid var(--border-color, #e3e6ea);
  border-radius: 8px;
  background: var(--bg-subtle, #f8f9fa);
}

.rx-cheatsheet summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #212529);
  list-style: none;
}

.rx-cheatsheet summary::-webkit-details-marker {
  display: none;
}

.rx-cheatsheet summary::after {
  content: '\25BE';
  float: right;
  color: var(--text-secondary, #5f6b7a);
}

.rx-cheatsheet[open] summary::after {
  content: '\25B4';
}

.rx-cheatsheet-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 12px 12px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary, #5f6b7a);
}

.rx-cs-col {
  border: 1px solid var(--border-color, #e3e6ea);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--panel-bg, #fff);
}

.rx-cs-title {
  display: block;
  font-weight: 700;
  color: var(--text-primary, #212529);
  margin-bottom: 4px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ---- responsive ---- */
@media (max-width: 991px) {
  .rx-panels [class*='col-'] {
    margin-bottom: 16px;
  }
}

@media (max-width: 575px) {
  .rx-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .rx-actions .btn {
    width: 100%;
  }
  .rx-live {
    margin-left: 0;
    justify-content: center;
  }
  .rx-replace-row {
    flex-wrap: wrap;
  }
  .rx-replace-row .btn {
    width: 100%;
  }
  .rx-cheatsheet-grid {
    grid-template-columns: 1fr;
  }
  .rx-output-panel .result-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .rx-output-actions .btn {
    flex: 1;
  }
}
