/* ─────────────────────────────────────────────────────────────────────────────
   RECATOOLS — Regex Tester & Debugger (RT-DEV-009)
   Tool-specific styles only — inherits from /assets/css/tool-page.css
───────────────────────────────────────────────────────────────────────────── */

/* ── Pattern input row ────────────────────────────────────────────────────── */

.rt-pattern-row {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 0.5rem;
}

.rt-pattern-wrap {
    flex: 1;
    display: flex;
    align-items: stretch;
    background: #0D1B2A;
    border: 2px solid #3a3530;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.rt-pattern-wrap:focus-within {
    border-color: #E8472F;
}

.rt-pattern-wrap.has-error {
    border-color: #dc3545;
}

.rt-pattern-slash {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.125rem;
    font-weight: 600;
    color: #E8472F;
    background: #231f1c;
    user-select: none;
    flex-shrink: 0;
}

.rt-pattern-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f0ede8;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    padding: 12px 8px;
    caret-color: #E8472F;
    min-width: 0;
}

.rt-pattern-input::placeholder {
    color: #64748B;
}

.rt-flags-display {
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #E8472F;
    background: #231f1c;
    user-select: none;
    flex-shrink: 0;
    min-width: 2.5rem;
}

/* ── Flag toggle buttons ─────────────────────────────────────────────────── */

.rt-flags-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.rt-flags-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted, #64748B);
    margin-right: 0.25rem;
}

.rt-flag-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 4px 14px;
    border: 2px solid #d0cdc8;
    border-radius: 999px;
    background: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
    color: #64748B;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
}

.rt-flag-btn .rt-flag-key {
    font-size: 0.875rem;
    font-weight: 700;
}

.rt-flag-btn .rt-flag-desc {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.75;
}

.rt-flag-btn.active {
    border-color: #E8472F;
    background: #E8472F;
    color: #fff;
}

.rt-flag-btn:hover:not(.active) {
    border-color: #E8472F;
    color: #E8472F;
}

/* ── Error message under pattern ─────────────────────────────────────────── */

.rt-error-msg {
    font-size: 0.8125rem;
    color: #dc3545;
    margin-top: 0.35rem;
    font-family: 'Courier New', Courier, monospace;
    min-height: 1.2em;
}

/* ── Match badge ─────────────────────────────────────────────────────────── */

.rt-match-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    background: #f0ede8;
    color: #64748B;
    margin-left: 0.5rem;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.rt-match-badge.has-matches {
    background: #d4edda;
    color: #155724;
}

.rt-match-badge.no-matches {
    background: #f8d7da;
    color: #721c24;
}

.rt-match-badge.error {
    background: #f8d7da;
    color: #721c24;
}

/* ── Test string section ─────────────────────────────────────────────────── */

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

.rt-test-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
}

.rt-exec-time {
    font-size: 0.75rem;
    font-family: 'Courier New', Courier, monospace;
    color: var(--muted, #64748B);
}

.rt-test-input {
    width: 100%;
    min-height: 120px;
    max-height: 240px;
    padding: 12px 14px;
    border: 2px solid #E2E4E8;
    border-radius: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--text-primary, #0D1B2A);
    background: #fafaf8;
    resize: vertical;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.rt-test-input:focus {
    outline: none;
    border-color: #E8472F;
    background: #fff;
}

/* ── Highlighted output ─────────────────────────────────────────────────── */

.rt-highlight-wrap {
    margin-top: 0.75rem;
    padding: 12px 14px;
    background: #fafaf8;
    border: 1.5px solid #E2E4E8;
    border-radius: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text-primary, #0D1B2A);
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 48px;
}

.rt-match-mark {
    cursor: default;
    border-radius: 3px;
    padding: 0 2px;
}

.rt-hl-placeholder {
    color: #b0aca6;
    font-style: italic;
    font-family: 'IBM Plex Sans', sans-serif;
}

/* ── Tabs: Match Details / Replace ──────────────────────────────────────── */

.rt-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #E2E4E8;
    margin-bottom: 1rem;
}

.rt-tab-btn {
    padding: 8px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -2px;
}

.rt-tab-btn.active {
    color: #E8472F;
    border-bottom-color: #E8472F;
}

.rt-tab-btn:hover:not(.active) {
    color: #E8472F;
}

/* ── Match details table ────────────────────────────────────────────────── */

.rt-match-table-wrap {
    overflow-x: auto;
    margin-top: 0.25rem;
    border: 1.5px solid #E2E4E8;
    border-radius: 10px;
}

.rt-match-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    font-family: 'IBM Plex Sans', sans-serif;
}

.rt-match-table thead th {
    background: #FFFFFF;
    padding: 9px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    color: var(--text-secondary, #64748B);
    text-transform: uppercase;
    border-bottom: 1.5px solid #E2E4E8;
    white-space: nowrap;
}

.rt-match-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0ede8;
    color: var(--text-primary, #0D1B2A);
    vertical-align: middle;
}

.rt-match-table tbody tr.rt-match-row {
    cursor: pointer;
    transition: background 0.1s;
}

.rt-match-table tbody tr.rt-match-row:hover {
    background: #fdf9f7;
}

.rt-match-table tbody tr.rt-match-row.expanded {
    background: #fef5f0;
}

.rt-match-table code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8125rem;
    background: #f0ede8;
    padding: 1px 5px;
    border-radius: 4px;
}

.rt-td-num {
    width: 40px;
    color: #E8472F;
    font-weight: 700;
    text-align: center;
}

.rt-td-pos {
    width: 60px;
    font-family: 'Courier New', Courier, monospace;
    color: #64748B;
}

.rt-td-toggle {
    width: 32px;
    text-align: center;
    color: #E8472F;
    font-size: 0.75rem;
}

.rt-row-toggle {
    font-size: 0.7rem;
    color: #E8472F;
}

/* ── Group detail row ───────────────────────────────────────────────────── */

.rt-detail-row td {
    background: #fef5f0 !important;
    padding: 10px 16px !important;
}

.rt-group-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.rt-group-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid currentColor;
    font-size: 0.8rem;
}

.rt-named-group {
    background: #e8f4f8;
    border-color: #5bc0de;
}

/* ── Replace section ────────────────────────────────────────────────────── */

.rt-replace-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    margin-bottom: 0.4rem;
    display: block;
}

.rt-replace-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #E2E4E8;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--text-primary, #0D1B2A);
    background: #fafaf8;
    transition: border-color 0.15s;
    box-sizing: border-box;
    margin-bottom: 0.75rem;
}

.rt-replace-input:focus {
    outline: none;
    border-color: #E8472F;
    background: #fff;
}

.rt-replace-hint {
    font-size: 0.75rem;
    color: var(--muted, #64748B);
    margin-top: -0.5rem;
    margin-bottom: 0.75rem;
}

.rt-replace-output-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #64748B);
    margin-bottom: 0.4rem;
}

.rt-replace-output {
    width: 100%;
    padding: 12px 14px;
    background: #FFFFFF;
    border: 1.5px solid #E2E4E8;
    border-radius: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--text-primary, #0D1B2A);
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 60px;
    box-sizing: border-box;
}

/* ── Section divider ────────────────────────────────────────────────────── */

.rt-section-divider {
    height: 1px;
    background: #E2E4E8;
    margin: 1.25rem 0;
}

/* ── Quick Patterns panel ───────────────────────────────────────────────── */

.rt-quick-patterns {
    background: #fff;
    border: 1.5px solid #E2E4E8;
    border-radius: 14px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.rt-quick-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    background: #fafaf8;
    border-bottom: 1.5px solid transparent;
    transition: border-color 0.15s;
}

.rt-quick-patterns.open .rt-quick-header {
    border-bottom-color: #E2E4E8;
}

.rt-quick-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rt-quick-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary, #0D1B2A);
    margin: 0;
}

.rt-quick-sub {
    font-size: 0.8rem;
    color: var(--muted, #64748B);
}

.rt-toggle-icon {
    font-size: 1.25rem;
    color: #E8472F;
    font-weight: 700;
    line-height: 1;
}

.rt-quick-panel {
    display: none;
    padding: 16px 20px 20px;
}

.rt-quick-patterns.open .rt-quick-panel {
    display: block;
}

.rt-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.rt-quick-btn {
    padding: 8px 14px;
    border: 1.5px solid #d0cdc8;
    border-radius: 8px;
    background: #fafaf8;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary, #0D1B2A);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.rt-quick-btn:hover {
    border-color: #E8472F;
    background: #fef5f0;
    color: #E8472F;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .rt-pattern-input {
        font-size: 0.875rem;
    }

    .rt-flags-display,
    .rt-pattern-slash {
        padding: 0 8px;
        font-size: 1rem;
    }

    .rt-flag-btn .rt-flag-desc {
        display: none;
    }

    .rt-match-table thead th:nth-child(3),
    .rt-match-table thead th:nth-child(4),
    .rt-match-table tbody td:nth-child(3),
    .rt-match-table tbody td:nth-child(4) {
        display: none;
    }

    .rt-quick-grid {
        grid-template-columns: 1fr 1fr;
    }

    .rt-tabs {
        overflow-x: auto;
    }
}

/* cache-buster: 2026-05-24T05:06:05Z */
