/* ============================================================
   regex-checker / style.css
   Prefix: rxc-
   ============================================================ */

.rxc-container {
    max-width: 700px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Section Cards --- */
.rxc-section {
    background: #fdfdfd;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    border: 1px solid #eee;
    margin-bottom: 16px;
}

.rxc-section-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #6f42c1;
}

/* --- Regex Input --- */
.rxc-regex-wrap {
    display: flex;
    align-items: center;
    border: 2px solid #6f42c1;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    margin-bottom: 10px;
}

.rxc-regex-slash {
    padding: 10px 12px;
    font-size: 20px;
    font-weight: 700;
    color: #6f42c1;
    background: #f8f4ff;
    user-select: none;
    line-height: 1;
    flex-shrink: 0;
}

.rxc-regex-input {
    flex: 1;
    border: none;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    font-size: 14px;
    padding: 10px 8px;
    outline: none;
    background: transparent;
    min-width: 0;
    color: #222;
}

.rxc-regex-input::placeholder {
    color: #bbb;
}

/* Error */
.rxc-error {
    display: none;
    color: #cb2431;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    background: #fff5f5;
    border: 1px solid #fdb8c0;
    border-radius: 4px;
    margin-bottom: 10px;
}

.rxc-error.visible {
    display: block;
}

/* Timeout warning */
.rxc-timeout {
    display: none;
    color: #856404;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    margin-bottom: 10px;
}

.rxc-timeout.visible {
    display: block;
}

/* --- Flags --- */
.rxc-flags-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.rxc-flags-label {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    margin-right: 4px;
}

.rxc-flag-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1.5px solid #ddd;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
    color: #555;
    position: relative;
}

.rxc-flag-label:hover {
    border-color: #6f42c1;
    color: #6f42c1;
}

.rxc-flag-label:has(input:checked) {
    border-color: #6f42c1;
    background: #f0e6ff;
    color: #6f42c1;
}

.rxc-flag-label input[type="checkbox"] {
    accent-color: #6f42c1;
    width: 13px;
    height: 13px;
}

.rxc-flag-tip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    padding: 5px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

.rxc-flag-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.rxc-flag-label:hover .rxc-flag-tip {
    display: block;
}

/* --- Snippets --- */
.rxc-snippet-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 12px;
    overflow-x: auto;
}

.rxc-snippet-tab {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #888;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
    margin-bottom: -2px;
}

.rxc-snippet-tab:hover {
    color: #6f42c1;
}

.rxc-snippet-tab.active {
    color: #6f42c1;
    border-bottom-color: #6f42c1;
}

.rxc-snippet-panel {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
}

.rxc-snippet-panel.active {
    display: flex;
}

.rxc-snippet-btn {
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    color: #444;
}

.rxc-snippet-btn:hover {
    border-color: #6f42c1;
    color: #6f42c1;
    background: #f8f4ff;
}

/* --- Test String --- */
.rxc-textarea {
    width: 100%;
    height: 150px;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.65;
    padding: 10px 12px;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
    color: #222;
    background: #fff;
    tab-size: 4;
}

.rxc-textarea:focus {
    border-color: #6f42c1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.1);
}

/* Highlight preview */
.rxc-highlight-preview {
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.65;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 40px;
    margin-top: 8px;
    color: #222;
}

.rxc-match-even {
    background: #fff3cd;
    border-radius: 2px;
}

.rxc-match-odd {
    background: #ffd8a8;
    border-radius: 2px;
}

/* --- Match count badge --- */
.rxc-match-count {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.rxc-match-count.has-match {
    background: #e6ffec;
    color: #22863a;
}

.rxc-match-count.no-match {
    background: #fff5f5;
    color: #cb2431;
}

/* --- Match List --- */
.rxc-match-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rxc-match-item {
    padding: 8px 12px;
    border-left: 3px solid #6f42c1;
    background: #fafafa;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
}

.rxc-match-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.rxc-match-idx {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    white-space: nowrap;
}

.rxc-match-text {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    background: #f0e6ff;
    padding: 1px 6px;
    border-radius: 3px;
    color: #4b0082;
    word-break: break-all;
}

.rxc-match-pos {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

.rxc-match-groups {
    margin-top: 5px;
    padding-left: 8px;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rxc-group {
    font-size: 11px;
    color: #666;
}

.rxc-group code {
    font-family: monospace;
    background: #eee;
    padding: 0 4px;
    border-radius: 2px;
    font-size: 11px;
}

.rxc-no-match {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    padding: 20px;
}

.rxc-match-truncated {
    text-align: center;
    color: #888;
    font-size: 12px;
    font-style: italic;
    padding: 6px;
}

/* --- Replace Section --- */
.rxc-replace-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.rxc-replace-wrap label {
    font-size: 12px;
    font-weight: 700;
    color: #666;
    white-space: nowrap;
}

.rxc-replace-input {
    flex: 1;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    padding: 7px 10px;
    border: 1.5px solid #ccc;
    border-radius: 5px;
    transition: border-color 0.2s;
    min-width: 0;
}

.rxc-replace-input:focus {
    border-color: #6f42c1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.1);
}

.rxc-replace-preview {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    line-height: 1.65;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    background: #f9fff9;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 40px;
    color: #222;
}

.rxc-replaced {
    background: #c8f7c5;
    border-radius: 2px;
}

.rxc-copy-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    color: #555;
    margin-top: 8px;
}

.rxc-copy-btn:hover {
    border-color: #6f42c1;
    color: #6f42c1;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .rxc-flags-row {
        gap: 4px;
    }

    .rxc-flag-label {
        padding: 3px 7px;
        font-size: 11px;
    }

    .rxc-snippet-tab {
        padding: 7px 10px;
        font-size: 11px;
    }
}