/* ===== Regex Tester Gizmo ===== */

.regex-full { max-width: 760px; margin: 0 auto; }

/* === Pattern row === */
.regex-full__patternrow {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 1rem 0 0.5rem;
}

.regex-full__slash {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.regex-full__pattern {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: 'JetBrains Mono', monospace;
}

.regex-full__pattern:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* === Flags === */
.regex-full__flags {
    display: flex;
    gap: 0.3rem;
}

.regex-flag {
    cursor: pointer;
    user-select: none;
}

.regex-flag input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.regex-flag span {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 26px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 700;
    transition: all 0.15s ease;
}

.regex-flag:hover span {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.regex-flag input:checked + span {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* === Test string === */
.regex-full__label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0.75rem 0 0.35rem;
}

.regex-full__test {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.5;
    resize: vertical;
}

.regex-full__test:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* === Status / error === */
.regex-full__status {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    min-height: 1.1rem;
}

.regex-full__error {
    font-size: 0.8125rem;
    color: var(--danger);
    font-family: 'JetBrains Mono', monospace;
    margin: 0.5rem 0;
}

/* === Sections === */
.regex-full__section { margin-bottom: 1.25rem; }

.regex-full__heading {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

/* === Highlight view === */
.regex-full__highlight {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 260px;
    overflow-y: auto;
    color: var(--text-primary);
}

.regex-mark {
    background: var(--accent-primary);
    color: #fff;
    border-radius: 3px;
    padding: 0 1px;
}

/* === Match list === */
.regex-full__matches {
    max-height: 300px;
    overflow-y: auto;
}

.regex-match {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8125rem;
}

.regex-match__num {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.regex-match__text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent-primary);
    overflow-wrap: anywhere;
}

.regex-match__index {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.regex-match__groups {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-left: 1.5rem;
}

.regex-match__group {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.1rem 0.4rem;
    overflow-wrap: anywhere;
}

.regex-full__empty {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0.25rem 0;
}

/* === Replace === */
.regex-full__replace {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.5rem;
}

.regex-full__replace:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.regex-full__replace-out {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 200px;
    overflow-y: auto;
    color: var(--text-primary);
    margin: 0;
    min-height: 1.5rem;
}

/* === Cheatsheet === */
.regex-cheat {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.35rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.regex-cheat code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
}
