﻿
/* ================================================================ */
/* ACE EDITOR: Formatter Integration                                 */
/* ================================================================ */
.ace-panel {
    position: relative;
    width: 100%;
    height: 600px;
    border: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.ace-panel .ace_editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0 0 10px 10px;
}

.ace-panel-sm {
    height: 300px;
}

.wt-section .ace-panel {
    height: 360px;
    border-radius: 0;
}

.wt-section .ace-panel .ace_editor {
    border-radius: 0;
}

@media (max-width: 960px) {
    .ace-panel {
        height: 350px;
    }
}

/* ================================================================ */
/* GROUP 1: FORMATTER TOOLS                                          */
/* ================================================================ */

.jf-action-strip::before, .jf-action-strip::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--strip);
}

.xf-action-strip::before, .xf-action-strip::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--strip);
}

.sf-action-strip::before, .sf-action-strip::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--strip);
}

.hf-action-strip::before, .hf-action-strip::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--strip);
}

.cf-action-strip::before, .cf-action-strip::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--strip);
}

/* ================================================================ */
/* Regex Tester                                                      */
/* ================================================================ */

.rgx-page {
    padding: 0;
}

.rgx-header {
    margin-bottom: 24px;
}

    .rgx-header h1 {
        font-weight: 700;
        color: var(--text-heading);
        font-size: 28px;
        margin: 0 0 6px;
    }

        .rgx-header h1 i {
            color: var(--text-label);
        }

    .rgx-header p {
        color: var(--text-muted);
        font-size: 14px;
        margin: 0;
    }

/* Pattern input */
.rgx-pattern-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.rgx-pattern-wrap {
    flex: 1;
    min-width: 280px;
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color .2s, box-shadow .2s;
    overflow: hidden;
}

    .rgx-pattern-wrap:focus-within {
        border-color: var(--text-faint);
        box-shadow: 0 0 0 3px var(--focus-shadow);
    }

.rgx-pattern-slash {
    padding: 0 8px 0 12px;
    color: var(--text-faint);
    font-size: 18px;
    font-weight: 700;
    user-select: none;
}

.rgx-pattern-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 6px;
    font-size: 14px;
    color: var(--text);
    background: transparent;
}

    .rgx-pattern-input::placeholder {
        color: var(--text-placeholder);
    }

/* Flags */
.rgx-flags {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.rgx-flag-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    transition: all .15s;
    user-select: none;
}

    .rgx-flag-label:hover {
        border-color: var(--border-medium);
        background: var(--surface-sunken);
    }

    .rgx-flag-label input {
        display: none;
    }

.rgx-flag-active {
    color: var(--text);
    border-color: var(--accent);
    background: var(--surface-badge);
}

/* Test string textarea */
.rgx-textarea {
    width: 100%;
    min-height: 160px;
    font-size: 14px;
    line-height: 1.6;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    resize: vertical;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    margin-bottom: 12px;
}

    .rgx-textarea:focus {
        border-color: var(--text-faint);
        box-shadow: 0 0 0 3px var(--focus-shadow);
    }

    .rgx-textarea::placeholder {
        color: var(--text-placeholder);
    }

/* Toolbar */
.rgx-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.rgx-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

    .rgx-btn i {
        font-size: 15px;
    }

.rgx-btn-primary {
    background: var(--accent);
    color: #fff;
}

    .rgx-btn-primary:hover {
        background: var(--accent-hover);
        box-shadow: 0 4px 16px var(--accent-shadow);
        transform: translateY(-1px);
    }

.rgx-btn-out {
    background: var(--btn-out-bg);
    border: 1px solid var(--btn-out-border);
    color: var(--btn-out-color);
}

    .rgx-btn-out:hover {
        background: var(--btn-out-hover-bg);
        border-color: var(--btn-out-hover-border);
        color: var(--btn-out-hover-color);
    }

.rgx-btn-red {
    background: var(--red-btn-bg);
    border: 1px solid var(--red-btn-border);
    color: var(--red-btn-color);
}

    .rgx-btn-red:hover {
        background: #ef4444;
        color: #fff;
    }

.rgx-spacer {
    flex: 1;
}

/* Error */
.rgx-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-left: 4px solid var(--error-border-left);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--error-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

    .rgx-error i {
        font-size: 18px;
        color: var(--error-icon);
    }

/* Results section */
.rgx-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Highlighted output */
.rgx-highlighted {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 14px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}
/* Regex match highlights – functional colors, kept as-is */
.rgx-highlight {
    background: var(--regex-match-bg);
    border-radius: 3px;
    padding: 1px 2px;
}

/* Match list */
.rgx-match-list {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    max-height: 300px;
    overflow-y: auto;
}

.rgx-match-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--surface-hover-alt);
    font-size: 13px;
    transition: background .15s;
}

    .rgx-match-item:hover {
        background: var(--surface-sunken);
    }

    .rgx-match-item:last-child {
        border-bottom: none;
    }

.rgx-match-index {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-faint);
    background: var(--surface-badge);
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.rgx-match-value {
    color: var(--text);
    word-break: break-all;
    flex: 1;
}

.rgx-match-groups {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Stats */
.rgx-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.rgx-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-badge);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-label);
}

/* Empty state */
.rgx-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-faint);
}

    .rgx-empty i {
        font-size: 40px;
        display: block;
        margin-bottom: 10px;
        color: var(--text-placeholder);
    }

    .rgx-empty p {
        font-size: 14px;
        margin: 0;
    }


/* ================================================================ */
/* Text Compare                                                     */
/* ================================================================ */
.tc {
    padding: 0;
}

.tc-header {
    margin-bottom: 14px;
}

    .tc-header h1 {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
        font-size: 24px;
        font-weight: 800;
        color: var(--tc-text);
    }

    .tc-header p {
        margin: 6px 0 0;
        color: var(--tc-muted);
        font-size: 13px;
    }

.tc-editors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.tc-editor-wrap {
    border: 1px solid var(--tc-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--tc-surface);
}

.tc-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--tc-border);
    background: var(--tc-surface-2);
}

    .tc-editor-head label {
        margin: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        font-weight: 700;
        color: var(--tc-text);
    }

.tc-editor-wrap textarea {
    width: 100%;
    min-height: 260px;
    border: 0;
    padding: 12px;
    resize: vertical;
    outline: none;
    font-size: 14px;
    line-height: 1.6;
    background: var(--tc-surface);
    color: var(--tc-text);
}

    .tc-editor-wrap textarea::placeholder {
        color: var(--tc-muted);
    }

.tc-upload,
.tc-btn,
.tc-btn-muted,
.tc-view-btn,
.tc-dd-item {
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.tc-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--btn-sec-bg);
    border-color: var(--btn-sec-border);
    color: var(--btn-sec-color);
}

    .tc-upload svg,
    .tc-btn svg,
    .tc-btn-muted svg,
    .tc-view-btn svg {
        width: 14px;
        height: 14px;
    }

    .tc-upload:hover,
    .tc-btn:hover,
    .tc-btn-muted:hover,
    .tc-view-btn:hover {
        transform: translateY(-1px);
    }

.tc-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.tc-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: var(--tc-accent);
    border-color: var(--tc-accent);
    color: #fff;
    box-shadow: 0 8px 16px rgba(109, 93, 252, 0.26);
}

.tc-btn-muted,
.tc-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    background: var(--btn-sec-bg);
    border-color: var(--btn-sec-border);
    color: var(--btn-sec-color);
}

    .tc-btn-muted:hover,
    .tc-view-btn:hover,
    .tc-upload:hover {
        background: var(--btn-sec-hover-bg);
        border-color: var(--btn-sec-hover-border);
        color: var(--btn-sec-hover-color);
    }

.tc-diffstat {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    background: var(--tc-surface-2);
}

    .tc-diffstat .ds-add,
    .tc-diffstat .ds-del,
    .tc-diffstat .ds-mod {
        font-size: 12px;
        font-weight: 800;
        letter-spacing: .2px;
    }

    .tc-diffstat .ds-add {
        color: #18864a;
    }

    .tc-diffstat .ds-del {
        color: #c23434;
    }

    .tc-diffstat .ds-mod {
        color: #b26f11;
    }

.ds-blocks {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.ds-block {
    width: 12px;
    height: 8px;
    border-radius: 3px;
}

.ds-block-add {
    background: var(--tc-add-strong);
}

.ds-block-del {
    background: var(--tc-del-strong);
}

.ds-block-mod {
    background: #f2c47f;
}

.ds-block-neutral {
    background: #d0d7de;
}

.tc-view-wrap {
    position: relative;
}

.tc-view-dd {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    background: var(--tc-surface);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
    padding: 6px;
    z-index: 20;
}

.tc-dd-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--tc-text);
    padding: 7px 8px;
    text-align: left;
}

    .tc-dd-item:hover {
        background: var(--tc-surface-2);
    }

.tc-dd-check {
    width: 14px;
    color: var(--tc-accent);
    font-weight: 800;
}

.gh-diff {
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--tc-surface);
}

.gh-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.gh-pane {
    overflow: auto;
    max-height: 62vh;
}

    .gh-pane + .gh-pane {
        border-left: 0;
    }

.gh-pane-head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .3px;
    color: var(--tc-text);
    background: var(--tc-surface-2);
    border-bottom: 0;
}

.gh-diff table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.gh-diff td {
    padding: 5px 10px;
    vertical-align: top;
    font-family: var(--mirror-font);
    font-size: 13px;
    line-height: 1.2;
    white-space: pre-wrap;
    color: var(--tc-text);
    word-break: break-word;
    border-bottom: 0;
}

    .gh-diff td.ln {
        width: 50px;
        text-align: right;
        color: var(--tc-muted);
        user-select: none;
        border-right: 0;
    }

    .gh-diff td.sg {
        width: 32px;
        text-align: center;
        color: var(--tc-muted);
        user-select: none;
    }

.gh-diff tr.d-ctx td {
    background: transparent;
}

.gh-diff tr.d-ins td {
    background: var(--tc-add);
}

.gh-diff tr.d-del td {
    background: var(--tc-del);
}

.gh-diff tr.d-mod td {
    background: var(--tc-mod);
}

.gh-diff tr.d-empty td {
    background: var(--tc-surface-2);
    color: transparent;
}

.w-ins {
    background: var(--tc-add-strong);
    color: #083b1f;
    border-radius: 4px;
    padding: 1px 2px;
}

.w-del {
    background: var(--tc-del-strong);
    color: #4b1010;
    border-radius: 4px;
    padding: 1px 2px;
}

.gh-unified {
    max-height: 62vh;
    overflow: auto;
}

    .gh-unified td.ln-old,
    .gh-unified td.ln-new {
        width: 52px;
    }

@media (max-width: 991.98px) {
    .tc-editors,
    .gh-split {
        grid-template-columns: 1fr;
    }

    .gh-pane + .gh-pane {
        border-left: 0;
        border-top: 0;
    }

    .tc-diffstat {
        margin-left: 0;
    }
}
