/* Regex Tester 工具样式 */
.regex-tester-section {
    padding: 60px 0;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: #333;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.page-title i {
    color: #667eea;
}

.page-subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* 工作区 */
.workspace {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
}

/* 正则表达式输入区 */
.regex-input-section {
    margin-bottom: 25px;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.input-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.regex-input-container {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.regex-input-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.regex-delimiter {
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
    margin: 0 10px;
}

.regex-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1rem;
    color: #333;
}

.regex-input:focus {
    outline: none;
}

.regex-flags {
    width: 100px;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1rem;
    color: #667eea;
    text-align: center;
}

.regex-flags:focus {
    outline: none;
}

/* 标志部分 */
.flags-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.flag-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
}

.flag-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

/* 测试文本区 */
.test-text-section {
    margin-bottom: 25px;
}

.test-text {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: #f8f9fa;
    color: #333;
    transition: all 0.3s ease;
}

.test-text:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

/* 操作按钮面板 */
.action-panel {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.primary-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.secondary-btn {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.secondary-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
}

/* 结果部分 */
.results-section {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.results-header {
    background: #e9ecef;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.results-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.match-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
}

.match-count span {
    color: #667eea;
    font-weight: 700;
}

.results-content {
    padding: 20px;
    min-height: 200px;
    background: white;
    max-height: 500px;
    overflow-y: auto;
}

.empty-message {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 40px 0;
}

.no-matches {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 40px 0;
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #dc3545;
}

.error-message i {
    font-size: 1.2rem;
}

/* 匹配列表 */
.matches-list {
    display: grid;
    gap: 15px;
}

.match-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e0e0e0;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.match-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.match-index {
    font-size: 0.85rem;
    color: #666;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

.matched-text {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-all;
}

.highlight {
    background: #ffeb3b;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.match-groups {
    margin-top: 10px;
}

.match-groups h5 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.match-groups ul {
    margin: 0;
    padding-left: 20px;
}

.match-groups li {
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #666;
}

.match-groups code {
    background: #e9ecef;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
}

/* 模板部分 */
.templates-section {
    margin-bottom: 40px;
}

.templates-section h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.template-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.template-item h4 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.template-item p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 功能说明区 */
.feature-section {
    margin-bottom: 40px;
}

.feature-section h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.feature-item i {
    color: #667eea;
    font-size: 1.2rem;
}

.feature-item span {
    color: #333;
    font-weight: 500;
}

/* FAQ部分 */
.faq-section {
    margin-bottom: 40px;
}

.faq-section h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.faq-list {
    display: grid;
    gap: 15px;
}

.faq-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.faq-question {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.faq-answer {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

/* 案例说明 */
.case-section {
    margin-bottom: 40px;
}

.case-section h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.case-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.case-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
}

.case-title {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.case-description {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

/* 相关工具 */
.related-section {
    margin-bottom: 20px;
}

.related-section h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.related-tools {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tool-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    font-weight: 500;
}

.notification.show {
    transform: translateX(0);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .regex-tester-section {
        padding: 40px 0;
    }

    .workspace {
        padding: 20px;
    }

    .action-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .primary-btn,
    .secondary-btn {
        justify-content: center;
    }

    .flags-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    .feature-list {
        grid-template-columns: 1fr;
    }

    .case-list {
        grid-template-columns: 1fr;
    }

    .related-tools {
        flex-direction: column;
    }

    .tool-link {
        justify-content: center;
    }

    .regex-input-container {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }

    .regex-delimiter {
        display: none;
    }

    .regex-input,
    .regex-flags {
        width: 100%;
        text-align: left;
        padding: 10px;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        margin-bottom: 10px;
        background: white;
    }

    .regex-flags {
        margin-bottom: 0;
    }
}

/* 深色主题适配 */
body.dark-theme .regex-tester-section {
    background: #1a1a1a;
}

body.dark-theme .page-title {
    color: #fff;
}

body.dark-theme .page-subtitle {
    color: #aaa;
}

body.dark-theme .workspace {
    background: #2d2d2d;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

body.dark-theme .input-header h3 {
    color: #fff;
}

body.dark-theme .action-btn {
    background: #444;
    border-color: #555;
    color: #ccc;
}

body.dark-theme .action-btn:hover {
    background: #555;
    border-color: #667eea;
    color: #667eea;
}

body.dark-theme .regex-input-container {
    background: #333;
    border-color: #444;
}

body.dark-theme .regex-input-container:focus-within {
    border-color: #667eea;
}

body.dark-theme .regex-delimiter {
    color: #667eea;
}

body.dark-theme .regex-input {
    background: transparent;
    color: #fff;
}

body.dark-theme .regex-flags {
    background: transparent;
    color: #667eea;
}

body.dark-theme .flag-checkbox {
    color: #ccc;
}

body.dark-theme .test-text {
    background: #333;
    border-color: #444;
    color: #fff;
}

body.dark-theme .test-text:focus {
    border-color: #667eea;
    background: #2d2d2d;
}

body.dark-theme .secondary-btn {
    background: #333;
    border-color: #444;
    color: #ccc;
}

body.dark-theme .secondary-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

body.dark-theme .results-section {
    background: #333;
    border-color: #444;
}

body.dark-theme .results-header {
    background: #444;
    border-color: #555;
}

body.dark-theme .results-header h3 {
    color: #fff;
}

body.dark-theme .match-count {
    color: #aaa;
}

body.dark-theme .match-count span {
    color: #667eea;
}

body.dark-theme .results-content {
    background: #2d2d2d;
}

body.dark-theme .empty-message,
body.dark-theme .no-matches {
    color: #aaa;
}

body.dark-theme .error-message {
    background: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
    color: #dc3545;
}

body.dark-theme .match-item {
    background: #333;
    border-color: #444;
}

body.dark-theme .match-header h4 {
    color: #fff;
}

body.dark-theme .match-index {
    background: #444;
    color: #aaa;
}

body.dark-theme .matched-text {
    background: #2d2d2d;
    border-color: #444;
}

body.dark-theme .highlight {
    background: #ffc107;
    color: #333;
}

body.dark-theme .match-groups h5 {
    color: #fff;
}

body.dark-theme .match-groups li {
    color: #aaa;
}

body.dark-theme .match-groups code {
    background: #444;
    color: #ccc;
}

body.dark-theme .template-item {
    background: #2d2d2d;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border-color: #444;
}

body.dark-theme .template-item:hover {
    border-color: #667eea;
}

body.dark-theme .template-item h4 {
    color: #fff;
}

body.dark-theme .template-item p {
    color: #aaa;
}

body.dark-theme .feature-section h3,
body.dark-theme .faq-section h3,
body.dark-theme .case-section h3,
body.dark-theme .related-section h3 {
    color: #fff;
}

body.dark-theme .feature-item {
    background: #333;
    border-color: #444;
}

body.dark-theme .feature-item span {
    color: #ccc;
}

body.dark-theme .faq-item {
    background: #333;
    border-color: #444;
}

body.dark-theme .faq-question {
    color: #fff;
}

body.dark-theme .faq-answer {
    color: #aaa;
}

body.dark-theme .case-item {
    background: #2d2d2d;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border-color: #444;
}

body.dark-theme .case-title {
    color: #fff;
}

body.dark-theme .case-description {
    color: #aaa;
}

body.dark-theme .tool-link {
    background: #333;
    border-color: #444;
    color: #ccc;
}

body.dark-theme .tool-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}