/**
 * ITPlatform Tools — Regex Generator (Linux & Infrastructure)
 * Tool-specific CSS — ONLY what base.css V2 does not cover.
 *
 * base.css handles: .tool-container, .tool-header, .tool-interface,
 * .tool-result, .tool-explanation, .tool-best-practices, .tool-context,
 * .tool-button, .copy-button, .tool-input, .field-group, .field-help,
 * .checkbox-group, .checkbox-label, .result-label, .result-value,
 * .tool-table, .badge-*, .alert, .alert-warning.
 *
 * This file adds:
 * - .tool-result override (white-space: normal, sans-serif font)
 * - .interface-block separator pattern (reused from cron-generator)
 * - .result-block / .result-block-header pattern
 * - .result-mono for monospace result values
 * - .explanation-table column widths
 * - .test-area styles (highlight container, match counter)
 * - .no-selection-msg
 * - .posix-note
 * - .match-badge (found / none variants)
 * - Responsive adjustments
 */


/* ============================================================
   Override: .tool-result
   base.css sets white-space: pre-wrap + font-mono globally.
   This tool uses structured blocks — neutralize here and apply
   monospace selectively via .result-mono.
   ============================================================ */
.tool-result {
  white-space: normal;
  font-family: var(--font-sans);
}


/* ============================================================
   Reduce section spacing (from 48px to 28px) — same as cron
   ============================================================ */
.tool-interface,
.tool-result,
.tool-explanation,
.tool-best-practices,
.tool-context {
  margin-bottom: 28px;
}

.tool-interface {
  padding: var(--space-lg);
}


/* ============================================================
   Interface blocks — logical grouping with separator
   ============================================================ */
.interface-block {
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.interface-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.block-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--space-md) 0;
}

/* Compact field-group inside tool-interface */
.tool-interface .field-group {
  margin-bottom: var(--space-md);
}

.tool-interface .field-group:last-child {
  margin-bottom: 0;
}

.tool-interface .field-help {
  margin: 2px 0 var(--space-xs) 0;
}

/* Checkbox group compact spacing inside interface */
.tool-interface .checkbox-group {
  gap: var(--space-xs);
}


/* ============================================================
   Result blocks — sub-sections inside .tool-result
   ============================================================ */
.result-block {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.result-block:last-child,
.result-block-last {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.result-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.result-block .result-label {
  margin-bottom: 0;
}

/* Monospace output value (overrides .result-value default sans-serif) */
.result-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  word-break: break-all;
  white-space: pre-wrap;
  line-height: var(--leading-relaxed);
}


/* ============================================================
   POSIX note — small help text below the badge
   ============================================================ */
.posix-note {
  margin: var(--space-xs) 0 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}


/* ============================================================
   Explanation table — token column fixed width
   ============================================================ */
.explanation-table td.token-cell {
  width: 220px;
  vertical-align: top;
  white-space: nowrap;
}

.explanation-table td {
  vertical-align: top;
  line-height: var(--leading-relaxed);
}

/* ReDoS alert inside explanation — compact */
.redos-note {
  font-size: var(--text-sm);
}


/* ============================================================
   No-selection placeholder
   ============================================================ */
.no-selection-msg {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
  padding: var(--space-md) 0;
}


/* ============================================================
   Test area — highlight container
   ============================================================ */
.test-area {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border-light);
}

.test-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.test-area-header h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
}

.test-area-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Match counter badge strip */
.match-counter-row {
  min-height: 24px;
  margin: var(--space-sm) 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.match-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
}

.match-badge.match-found {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.match-badge.match-none {
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
}

/* Highlight container — mirrors textarea look, uses pre-wrap for newlines */
.test-highlight-container {
  min-height: 120px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text);
}

/* Match highlight */
.test-highlight-container mark {
  background: #fde047;
  color: var(--color-text);
  border-radius: 2px;
  padding: 0 1px;
}


/* ============================================================
   Responsive adjustments
   ============================================================ */
@media (max-width: 640px) {
  .explanation-table td.token-cell {
    width: 140px;
    white-space: normal;
  }

  .result-block-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .test-area-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
