/* Regex Dialect Transpiler & Compatibility Matrix Stylesheet */

.regex-transpiler-shell {
  max-width: 1200px;
  margin: 0 auto;
}

.transpiler-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* Toolbar & Dialect Switcher */
.transpiler-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface, #1e2430);
  border: 1px solid var(--border, #2d3748);
  border-radius: 8px;
}

.engine-selectors-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}

.engine-selector-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.selector-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.engine-btn-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 6px;
  gap: 3px;
  flex-wrap: wrap;
}

.btn-engine {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.btn-engine:hover {
  color: var(--text, #f8fafc);
  background: rgba(255, 255, 255, 0.05);
}

.btn-engine.active {
  background: var(--accent, #38bdf8);
  color: #090a0f;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(56, 189, 248, 0.3);
}

.conversion-arrow {
  font-size: 1.2rem;
  color: var(--text-muted, #64748b);
  font-weight: 700;
}

/* Presets Toolbar */
.preset-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.preset-label {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  margin-right: 4px;
  font-weight: 600;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border, #334155);
  color: var(--text, #e2e8f0);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent, #38bdf8);
  color: #fff;
}

/* Workspace Split Panes */
.transpiler-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .transpiler-workspace {
    grid-template-columns: 1fr;
  }
}

.workspace-panel {
  display: flex;
  flex-direction: column;
  background: var(--surface, #1e2430);
  border: 1px solid var(--border, #2d3748);
  border-radius: 8px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border, #2d3748);
}

.panel-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text, #f1f5f9);
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.btn-panel-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border, #334155);
  color: var(--text-muted, #cbd5e1);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-panel-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-panel-action.btn-copy {
  background: var(--accent, #38bdf8);
  color: #090a0f;
  border: none;
}

.btn-panel-action.btn-copy:hover {
  opacity: 0.9;
}

.editor-wrap {
  position: relative;
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.regex-textarea {
  width: 100%;
  min-height: 90px;
  background: #0f141c;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 0.85rem;
  border: 1px solid var(--border, #2d3748);
  border-radius: 6px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

.regex-textarea:focus {
  border-color: var(--accent, #38bdf8);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.test-textarea {
  width: 100%;
  min-height: 80px;
  background: #0f141c;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  padding: 0.85rem;
  border: 1px solid var(--border, #2d3748);
  border-radius: 6px;
  resize: vertical;
  margin-top: 0.75rem;
  outline: none;
  box-sizing: border-box;
}

.test-textarea:focus {
  border-color: #64748b;
}

.sublabel {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.regex-output-pre {
  margin: 0;
  padding: 0.85rem;
  background: #0f141c;
  border: 1px solid var(--border, #2d3748);
  border-radius: 6px;
  min-height: 90px;
  overflow-x: auto;
  box-sizing: border-box;
}

.regex-output-pre code {
  color: #4ade80;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.live-match-box {
  margin-top: 0.75rem;
  background: #0f141c;
  border: 1px solid var(--border, #2d3748);
  border-radius: 6px;
  padding: 0.85rem;
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
}

mark.regex-match {
  background: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  border-radius: 3px;
  padding: 1px 3px;
  border-bottom: 2px solid #38bdf8;
  font-weight: 700;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border, #2d3748);
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-success {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-warning {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-error {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.badge-success {
  color: #4ade80;
  font-weight: 600;
}

.badge-neutral {
  color: #94a3b8;
}

.badge-error {
  color: #f87171;
  font-size: 0.78rem;
}

/* 5-Engine Compatibility Matrix Grid */
.matrix-section {
  padding: 1.5rem;
  background: var(--surface, #1e2430);
  border: 1px solid var(--border, #2d3748);
  border-radius: 8px;
}

.section-header-wrap {
  margin-bottom: 1.25rem;
}

.section-header-wrap h3 {
  margin: 0 0 0.35rem 0;
  font-size: 1.15rem;
  color: #f8fafc;
}

.section-header-wrap p {
  margin: 0;
  color: var(--text-muted, #94a3b8);
  font-size: 0.88rem;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.matrix-card {
  background: #0f141c;
  border: 1px solid var(--border, #2d3748);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s ease;
}

.matrix-card.active-target {
  border-color: var(--accent, #38bdf8);
  box-shadow: 0 0 0 1px var(--accent, #38bdf8);
}

.matrix-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.engine-title-wrap strong {
  display: block;
  font-size: 0.95rem;
  color: #f8fafc;
}

.engine-eco {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

.matrix-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.matrix-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-linear {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-backtrack {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-compatible {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.badge-warning {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.badge-incompatible {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.matrix-code-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow-x: auto;
}

.matrix-code-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-all;
}

.matrix-diag-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

.matrix-diag-list li {
  margin-bottom: 2px;
}

.matrix-diag-list li.diag-error {
  color: #f87171;
}

.matrix-diag-list li.diag-warning {
  color: #fbbf24;
}

.matrix-diag-list li.diag-info {
  color: #38bdf8;
}

/* Diagnostics & Advisories Panel */
.transpiler-insights {
  padding: 1.5rem;
  background: var(--surface, #1e2430);
  border: 1px solid var(--border, #2d3748);
  border-radius: 8px;
}

.insights-header h3 {
  margin: 0 0 1rem 0;
  font-size: 1.15rem;
  color: #f8fafc;
}

.advisories-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.advisory-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 6px;
  background: #0f141c;
  border-left: 4px solid var(--border, #475569);
}

.advisory-card.advisory-empty {
  border-left-color: #475569;
  color: var(--text-muted, #94a3b8);
  font-size: 0.88rem;
}

.advisory-card.advisory-error {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.advisory-card.advisory-warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.advisory-card.advisory-info {
  border-left-color: #38bdf8;
  background: rgba(56, 189, 248, 0.05);
}

.advisory-icon {
  font-size: 1.1rem;
  line-height: 1.2;
}

.advisory-body {
  flex: 1;
}

.advisory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.advisory-header strong {
  font-size: 0.9rem;
  color: #f8fafc;
}

.advisory-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-muted, #cbd5e1);
}

.advisory-body p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, #94a3b8);
}

/* Cheatsheet & Dialect Comparison Grid */
.cheatsheet-section {
  padding: 1.5rem;
  background: var(--surface, #1e2430);
  border: 1px solid var(--border, #2d3748);
  border-radius: 8px;
}

.cheatsheet-header h3 {
  margin: 0 0 1rem 0;
  font-size: 1.15rem;
  color: #f8fafc;
}

.cheatsheet-table-wrap {
  overflow-x: auto;
}

.cheatsheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.cheatsheet-table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  color: #cbd5e1;
  border-bottom: 1px solid var(--border, #334155);
}

.cheatsheet-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted, #94a3b8);
}

.cheatsheet-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 5px;
  border-radius: 3px;
  color: #38bdf8;
  font-size: 0.8rem;
}

.tag-support {
  color: #4ade80;
  font-weight: 700;
}

.tag-forbidden {
  color: #f87171;
  font-weight: 700;
}

.tag-adapted {
  color: #fbbf24;
  font-weight: 700;
}

/* Why RE2 & ReDoS Section */
.why-re2-section {
  padding: 1.5rem;
  background: var(--surface, #1e2430);
  border: 1px solid var(--border, #2d3748);
  border-radius: 8px;
}

.section-title-wrap h2 {
  margin: 0 0 0.35rem 0;
  font-size: 1.25rem;
  color: #f8fafc;
}

.section-subtitle {
  margin: 0 0 1.25rem 0;
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
}

.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.benefit-card {
  background: #0f141c;
  border: 1px solid var(--border, #2d3748);
  border-radius: 6px;
  padding: 1.1rem;
}

.benefit-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.benefit-card h3 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  color: #f8fafc;
}

.benefit-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, #94a3b8);
}

/* FAQ Accordion */
.transpiler-faq {
  padding: 1.5rem;
  background: var(--surface, #1e2430);
  border: 1px solid var(--border, #2d3748);
  border-radius: 8px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: #0f141c;
  border: 1px solid var(--border, #2d3748);
  border-radius: 6px;
  overflow: hidden;
}

.faq-question {
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.faq-question:hover {
  background: rgba(255, 255, 255, 0.03);
}

.faq-answer {
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border, #2d3748);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted, #94a3b8);
}

.faq-answer p {
  margin: 0;
}
