/* 正则表达式模块样式 - 与主界面风格一致 */

/* 面板覆盖层 */
.regex-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.regex-panel-overlay.show {
    opacity: 1;
}

/* 主面板 - 使用白色背景 */
.regex-panel {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.regex-panel.show {
    transform: scale(1);
}

/* 面板头部 */
.regex-panel-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
    border-radius: 12px 12px 0 0;
}

.regex-panel-header h2 {
    margin: 0;
    color: #1a1a1a;
    font-size: 20px;
    font-weight: 600;
}

.regex-panel-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
    border-radius: 6px;
}

.regex-panel-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

/* 标签页 */
.regex-panel-tabs {
    display: flex;
    padding: 0 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    background: none;
    border: none;
    color: #6b7280;
    padding: 15px 20px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    font-size: 14px;
    font-weight: 500;
}

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

.tab-btn.active {
    color: #1a1a1a;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #3b82f6;
}

/* 内容区域 */
.regex-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
}

.tab-content {
    display: none;
}

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

/* 工具栏 */
.scripts-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

/* 按钮样式 */
.btn-primary {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: #3b82f6;
    color: white;
    font-weight: 500;
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
    color: #4b5563;
    font-weight: 500;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* 脚本列表 */
.scripts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.script-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s;
}

.script-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.script-item.disabled {
    opacity: 0.5;
}

.script-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.script-status {
    font-size: 12px;
    color: #6b7280;
}

.script-name {
    flex: 1;
    color: #1a1a1a;
    font-weight: 500;
    font-size: 15px;
}

.script-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: white;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.btn-icon:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.btn-icon.danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.btn-icon svg {
    width: 14px;
    height: 14px;
    stroke: #6b7280;
}

.btn-icon:hover svg {
    stroke: #1a1a1a;
}

.btn-icon.danger:hover svg {
    stroke: #dc2626;
}

.script-details {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    font-size: 13px;
}

.script-details code {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #4b5563;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.empty-state svg {
    stroke: #d1d5db;
    margin-bottom: 20px;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 15px;
}

/* 角色提示 */
.character-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
}

.character-notice svg {
    stroke: #d97706;
}

/* 编辑器表单 */
.editor-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #1a1a1a;
    font-size: 14px;
    resize: vertical;
    transition: all 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.required {
    color: #dc2626;
}

.form-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* 复选框组 */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #4b5563;
    font-size: 14px;
}

.checkbox-label:hover {
    color: #1a1a1a;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* 测试区域 */
.test-area {
    background: #f9fafb;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.btn-test {
    margin: 10px 0;
    padding: 8px 16px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-test:hover {
    background: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.test-output {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    min-height: 50px;
}

.test-success {
    color: #059669;
}

.test-error {
    color: #dc2626;
}

.test-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 5px;
}

.test-result {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-all;
    color: #1a1a1a;
}

/* 编辑器操作按钮 */
.editor-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Toast提示 - 使用主界面风格 */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #dc2626;
}

.toast-warning {
    background: #f59e0b;
}

.toast-info {
    background: #3b82f6;
}

/* 滚动条样式 */
.regex-panel-content::-webkit-scrollbar {
    width: 8px;
}

.regex-panel-content::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.regex-panel-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.regex-panel-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 暗色模式支持（如果需要） */
.dark .regex-panel {
    background: #1a1a1a;
}

.dark .regex-panel-header {
    background: #242424;
    border-bottom-color: #333;
}

.dark .regex-panel-header h2 {
    color: #e5e5e5;
}

.dark .regex-panel-tabs {
    background: #242424;
    border-bottom-color: #333;
}

.dark .tab-btn {
    color: #9ca3af;
}

.dark .tab-btn:hover,
.dark .tab-btn.active {
    color: #e5e5e5;
}

.dark .regex-panel-content {
    background: #1a1a1a;
}

.dark .script-item {
    background: #242424;
    border-color: #333;
}

.dark .script-item:hover {
    background: #2a2a2a;
    border-color: #404040;
}

.dark .script-name {
    color: #e5e5e5;
}

.dark .form-group label {
    color: #e5e5e5;
}

.dark .form-group input[type="text"],
.dark .form-group textarea {
    background: #242424;
    border-color: #333;
    color: #e5e5e5;
}

.dark .form-group input[type="text"]:focus,
.dark .form-group textarea:focus {
    border-color: #3b82f6;
}

.dark .test-area {
    background: #242424;
    border-color: #333;
}

.dark .test-output {
    background: #1a1a1a;
    border-color: #333;
}

.dark .test-result {
    color: #e5e5e5;
}