/* Tool-specific styles only - base styles are in tool-layout.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #0a0a0a;
    color: #e5e7eb;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #141414;
    border-bottom: 1px solid #2a2a2a;
    z-index: 100;
}

    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

    margin-top: 60px;
    padding: 48px 24px;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    max-width: 720px;
    margin: 0 auto;
}

.tool-main {
    flex: 1;
    padding: 32px 24px 120px;
}

.tool-container {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group > label {
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
}

.pattern-input-container {
    display: flex;
    align-items: center;
    background-color: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 0 12px;
    transition: border-color 150ms ease;
}

.pattern-input-container:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.pattern-delimiter {
    color: #3b82f6;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    user-select: none;
    flex-shrink: 0;
}

.pattern-input-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 1.1rem;
    padding: 12px 8px;
    outline: none;
    min-width: 0;
}

.pattern-input-container input::placeholder {
    color: #6b7280;
}

.pattern-error {
    background-color: #1a0a0a;
    border: 1px solid #ef4444;
    border-radius: 6px;
    padding: 10px 12px;
    color: #ff5370;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
}

.flags-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.flag-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #2a2a2a;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    transition: all 150ms ease;
    user-select: none;
}

.flag-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.flag-btn.flag-active {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #3b82f6;
}

.test-string-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.test-string-header label {
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
}

.char-count {
    font-size: 12px;
    color: #6b7280;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
}

.test-string-wrapper {
    position: relative;
    min-height: 200px;
}

.test-string-wrapper textarea {
    width: 100%;
    min-height: 200px;
    background-color: transparent;
    color: transparent;
    caret-color: #ffffff;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    position: relative;
    z-index: 2;
    transition: border-color 150ms ease;
}

.test-string-wrapper textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.test-string-wrapper textarea::placeholder {
    color: #6b7280;
}

.highlighted-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #0a0a0a;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
    z-index: 1;
    color: #e5e7eb;
    pointer-events: none;
}

.highlighted-display mark,
.highlighted-display .match-highlight {
    background-color: rgba(59, 130, 246, 0.25);
    border-bottom: 2px solid rgba(59, 130, 246, 0.5);
    border-radius: 2px;
    padding: 1px 0;
    color: inherit;
}

.highlighted-display .match-highlight-alt {
    background-color: rgba(139, 92, 246, 0.25);
    border-bottom: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 2px;
    padding: 1px 0;
    color: inherit;
}

.input-actions {
    display: flex;
    gap: 12px;
}

.button-primary {
    background-color: #3b82f6;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: background-color 150ms ease;
    text-align: center;
}

.button-secondary {
    background-color: #1a1a1a;
    color: #e5e7eb;
    border: 1px solid #2a2a2a;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
    text-align: center;
}

.button-outline {
    background: transparent;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
    text-align: center;
}

.button-outline:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.button-small {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

.output-section {
    background-color: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.output-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 1px solid #2a2a2a;
    padding-bottom: 12px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #e5e7eb;
    background-color: #1a1a1a;
}

.tab-btn.tab-active {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.tab-btn.tab-pro {
    color: #6b7280;
}

.match-count {
    font-size: 13px;
    color: #888;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
}

.tab-content {
    display: none;
}

.tab-content.tab-content-active {
    display: block;
}

.empty-state {
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    padding: 32px 16px;
}

.matches-output {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.match-item {
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 10px 14px;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 13px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.match-index {
    color: #6b7280;
    font-size: 11px;
    flex-shrink: 0;
    min-width: 60px;
}

.match-value {
    color: #3b82f6;
    font-weight: 500;
    word-break: break-all;
}

.match-length {
    color: #6b7280;
    font-size: 11px;
    flex-shrink: 0;
    margin-left: auto;
}

.match-zero-length {
    color: #f59e0b;
    font-size: 11px;
    font-style: italic;
}

.groups-output {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-match {
    margin-bottom: 4px;
    border-left: 3px solid #3b82f6;
    padding-left: 16px;
}

.group-match-header {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.group-entry {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 13px;
}

.group-label {
    color: #888;
    font-size: 12px;
    flex-shrink: 0;
    min-width: 90px;
}

.group-label-named {
    color: #3b82f6;
}

.group-value {
    color: #c3e88d;
    word-break: break-all;
}

.group-value-full {
    color: #e5e7eb;
    font-weight: 500;
}

.cheatsheet-output {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.cheat-category {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cheat-title {
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cheat-item {
    display: flex;
    gap: 12px;
    padding: 3px 0;
    font-size: 13px;
    align-items: baseline;
}

.cheat-token {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    color: #f78c6c;
    min-width: 80px;
    flex-shrink: 0;
}

.cheat-desc {
    color: #888;
}

.replace-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.replace-preview {
    background-color: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: #e5e7eb;
    max-height: 300px;
    overflow-y: auto;
}

.explain-output {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.explain-item {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #1a1a1a;
    align-items: baseline;
}

.explain-item:last-child {
    border-bottom: none;
}

.explain-token {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    color: #f78c6c;
    min-width: 120px;
    flex-shrink: 0;
    font-size: 14px;
}

.explain-desc {
    color: #e5e7eb;
    font-size: 14px;
    line-height: 1.5;
}

.library-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.library-controls {
    display: flex;
    gap: 12px;
}

.library-search-input {
    flex: 1;
    background-color: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 10px 14px;
    color: #e5e7eb;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 150ms ease;
}

.library-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.library-search-input::placeholder {
    color: #6b7280;
}

.library-section .select-input {
    background-color: #0a0a0a;
    border: 1px solid #2a2a2a;
    color: #e5e7eb;
    padding: 10px 36px 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    flex-shrink: 0;
}

.library-section .select-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.library-section .select-input option {
    background-color: #1a1a1a;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.library-item {
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 150ms ease;
}

.library-item:hover {
    border-color: #3b82f6;
}

.library-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.library-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 14px;
}

.library-category-badge {
    font-size: 11px;
    color: #6b7280;
    background-color: #0a0a0a;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.library-pattern {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    color: #3b82f6;
    font-size: 12px;
    word-break: break-all;
    line-height: 1.4;
}

.library-desc {
    color: #888;
    font-size: 13px;
    line-height: 1.4;
}

.library-use-btn {
    align-self: flex-start;
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
}

.library-use-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.benchmark-section {
    border-top: 1px solid #2a2a2a;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.benchmark-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.benchmark-label {
    font-size: 14px;
    font-weight: 500;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.benchmark-result {
    background-color: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bench-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bench-stat-label {
    color: #888;
}

.bench-fast {
    color: #10b981;
}

.bench-slow {
    color: #f59e0b;
}

.bench-danger {
    color: #ef4444;
}

.output-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid #2a2a2a;
    padding-top: 16px;
}

.pro-badge {
    color: #0a0a0a;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-left: 4px;
}

.pro-cta-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.pro-cta-text {
    font-size: 14px;
    color: #d1d5db;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
}

.modal-overlay.modal-hidden {
    display: none;
}

.modal-overlay.modal-visible {
    display: flex;
}

.modal {
    background-color: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 0;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
}

.modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #e5e7eb;
}

.modal-content {
    padding: 24px;
}

.modal-feature-name {
    color: #888;
    font-size: 14px;
    margin-bottom: 20px;
}

.pro-features-list {
    margin-bottom: 24px;
}

.pro-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.feature-check {
    width: 20px;
    height: 20px;
    background-color: #059669;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.feature-text {
    font-size: 15px;
    color: #e5e7eb;
}

.modal-cta {
    width: 100%;
    display: block;
}

.timeout-warning {
    background-color: #1a1400;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 10px 14px;
    color: #fbbf24;
    font-size: 13px;
    line-height: 1.4;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #2a2a2a;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 20px;
    color: #e5e7eb;
    font-size: 14px;
    z-index: 300;
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
}

.toast.toast-visible {
    opacity: 1;
}

.footer {
    background-color: #0a0a0a;
    border-top: 1px solid #2a2a2a;
    padding: 32px 24px;
    text-align: center;
    margin-top: auto;
}

.footer p {
    font-size: 14px;
    color: #6b7280;
}

.library-list::-webkit-scrollbar,
.replace-preview::-webkit-scrollbar {
    width: 6px;
}

.library-list::-webkit-scrollbar-track,
.replace-preview::-webkit-scrollbar-track {
    background: transparent;
}

.library-list::-webkit-scrollbar-thumb,
.replace-preview::-webkit-scrollbar-thumb {
    background-color: #2a2a2a;
    border-radius: 3px;
}

.library-list::-webkit-scrollbar-thumb:hover,
.replace-preview::-webkit-scrollbar-thumb:hover {
    background-color: #3a3a3a;
}

@media (max-width: 768px) {
        padding: 32px 16px;
    }

        font-size: 28px;
        line-height: 36px;
    }

        font-size: 14px;
    }

    .tool-main {
        padding: 24px 16px 100px;
    }

    .tool-container {
        gap: 32px;
    }

    .output-section {
        padding: 16px;
    }

    .output-tabs {
        gap: 2px;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .cheatsheet-output {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .library-controls {
        flex-direction: column;
    }

    .explain-item {
        flex-direction: column;
        gap: 4px;
    }

    .explain-token {
        min-width: 0;
    }

    .match-item {
        flex-wrap: wrap;
        gap: 6px;
    }

    .pro-cta-content {
        flex-direction: column;
        gap: 10px;
    }

        padding: 0 16px;
    }

    .output-actions {
        flex-direction: column;
    }

    .output-actions .button-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .flags-row {
        gap: 6px;
    }

    .flag-btn {
        padding: 5px 10px;
        font-size: 13px;
    }

    .match-index {
        min-width: 50px;
    }

    .group-label {
        min-width: 70px;
    }

    .benchmark-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}