.regex-tester {
    padding-top: 60px;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.maximized .regex-tester {
    padding-top: 0;
    height: 100vh;
}

.editor-wrapper {
    margin: 0 auto;
    width: 95%;
    max-width: 1400px;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

.toolbar {
    padding: 10px 20px;
    background-color: inherit;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.toolbar h1 {
    margin: 0;
    font-size: 1.5em;
}

.buttons button {
    margin: 0 5px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #007AFF;
    color: white;
    transition: all 0.3s ease;
}

.buttons button:hover {
    background-color: #0056b3;
}

body.dark-mode .buttons button {
    background-color: #0A84FF;
}

body.dark-mode .buttons button:hover {
    background-color: #0056b3;
}

body.dark-mode .toolbar {
    border-bottom-color: #444;
}

.regex-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 正则输入区 */
.regex-input-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

body.dark-mode .regex-input-section {
    background: #2d2d2d;
    border-color: #444;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

body.dark-mode .input-group label {
    color: #ddd;
}

.regex-input-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #007AFF;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 16px;
}

body.dark-mode .regex-input-wrapper {
    background: #1e1e1e;
    border-color: #0A84FF;
}

.regex-delimiter {
    color: #007AFF;
    font-weight: bold;
    font-size: 18px;
}

body.dark-mode .regex-delimiter {
    color: #0A84FF;
}

#regex-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    background: transparent;
    color: #e74c3c;
    padding: 0 8px;
}

body.dark-mode #regex-input {
    color: #ff6b6b;
}

#regex-flags {
    width: 50px;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    background: transparent;
    color: #27ae60;
    text-align: center;
}

body.dark-mode #regex-flags {
    color: #2ecc71;
}

.flags-hint {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.flag-item {
    padding: 4px 10px;
    background: #e9ecef;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    font-size: 14px;
    transition: all 0.2s;
}

.flag-item:hover {
    background: #007AFF;
    color: white;
}

.flag-item.active {
    background: #007AFF;
    color: white;
}

body.dark-mode .flag-item {
    background: #444;
    color: #ddd;
}

body.dark-mode .flag-item:hover,
body.dark-mode .flag-item.active {
    background: #0A84FF;
}

/* 模板区 */
.templates-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

body.dark-mode .templates-section {
    background: #2d2d2d;
    border-color: #444;
}

.templates-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

body.dark-mode .templates-section label {
    color: #ddd;
}

.templates-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.template-btn:hover {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
}

body.dark-mode .template-btn {
    background: #1e1e1e;
    border-color: #444;
    color: #ddd;
}

body.dark-mode .template-btn:hover {
    background: #0A84FF;
    border-color: #0A84FF;
}


/* 测试区 */
.test-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.test-input-area,
.result-area {
    display: flex;
    flex-direction: column;
}

.test-input-area label,
.result-area label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

body.dark-mode .test-input-area label,
body.dark-mode .result-area label {
    color: #ddd;
}

#match-count {
    font-weight: normal;
    color: #27ae60;
    font-size: 14px;
}

#test-input {
    flex: 1;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

body.dark-mode #test-input {
    background: #1e1e1e;
    border-color: #444;
    color: #ddd;
}

#result-output {
    flex: 1;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

body.dark-mode #result-output {
    background: #1e1e1e;
    border-color: #444;
    color: #ddd;
}

/* 高亮匹配 */
.match-highlight {
    background: #ffeb3b;
    color: #333;
    padding: 1px 2px;
    border-radius: 2px;
}

body.dark-mode .match-highlight {
    background: #f39c12;
    color: #000;
}

.match-highlight-group {
    background: #81c784;
    color: #333;
    padding: 1px 2px;
    border-radius: 2px;
}

/* 匹配详情 */
.match-details-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

body.dark-mode .match-details-section {
    background: #2d2d2d;
    border-color: #444;
}

.match-details-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

body.dark-mode .match-details-section label {
    color: #ddd;
}

#match-details {
    max-height: 300px;
    overflow-y: auto;
}

.match-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

body.dark-mode .match-item {
    background: #1e1e1e;
    border-color: #444;
}

.match-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

body.dark-mode .match-item-header {
    color: #aaa;
}

.match-item-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    color: #e74c3c;
    word-break: break-all;
}

body.dark-mode .match-item-value {
    color: #ff6b6b;
}

.match-groups {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #ddd;
}

body.dark-mode .match-groups {
    border-top-color: #444;
}

.group-item {
    font-size: 13px;
    margin: 4px 0;
}

.group-label {
    color: #666;
}

body.dark-mode .group-label {
    color: #aaa;
}

.group-value {
    color: #27ae60;
    font-family: monospace;
}

.no-match {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.regex-error {
    color: #e74c3c;
    background: #fdeaea;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
}

body.dark-mode .regex-error {
    background: #3d2020;
}

/* 最大化模式 */
body.maximized {
    overflow: hidden;
}

body.maximized .regex-tester {
    padding-top: 0;
    min-height: 100vh;
    height: 100vh;
    overflow: auto;
}

body.maximized .editor-wrapper {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    padding: 0;
}

body.maximized .toolbar {
    top: 0;
}

/* 响应式 */
@media (max-width: 768px) {
    .test-section {
        grid-template-columns: 1fr;
    }
    
    .templates-grid {
        justify-content: center;
    }
}