/* CSS变量定义 */
:root {
    --primary-color: #333333;
    --primary-hover: #555555;
    --primary-active: #222222;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background-color: #ffffff;
    --white: #ffffff;
    --gray-50: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    --border-radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: #ffffff !important;
    background: #ffffff !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 页面头部样式 */
.header {
    background: var(--white);
    color: var(--gray-800);
    padding: 20px 0;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
}

.main-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-900);
}

.subtitle {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--gray-600);
}

.description {
    max-width: 600px;
    margin: 0 auto;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--gray-500);
}

/* 广告横幅样式 */
.ad-banner {
    padding: 25px 0;
    background: var(--white);
}

.ad-link {
    display: block;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.ad-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ad-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

/* 章节标题样式 */
.section-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 20px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* 快捷脚本样式 */
.quick-scripts {
    padding: 40px 0;
    background: var(--white);
}

.script-notice {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
}

.script-item {
    margin-bottom: 20px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.script-item h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
}

.code-block-container {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin: 12px 0;
}

.code-block {
    flex: 1;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 20px;
}

.code-block code {
    color: var(--gray-800);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    display: block;
    word-wrap: break-word;
}

.script-copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    height: fit-content;
}

.script-copy-btn:hover {
    background: var(--primary-hover);
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--primary-hover);
}

.regenerate-btn {
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 15px;
}

.regenerate-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.script-notes {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning-color);
}

.script-notes ul {
    margin-left: 20px;
    margin-top: 10px;
}

.script-notes li {
    margin-bottom: 5px;
}

/* 配置模式样式 */
.config-modes {
    padding: 40px 0;
    background: #ffffff;
}

.mode-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 8px;
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 1rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.mode-content {
    display: none;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
}
.mode-content.active {
    display: block;
}

.input-section {
    margin-bottom: 20px;
}

.input-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 15px;
}

.input-hint {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 4px;
    border-left: 4px solid var(--primary-color);
}

.ip-input {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: var(--transition);
}

.ip-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ip-input.error {
    border-color: var(--error-color);
}

.ip-input.success {
    border-color: var(--success-color);
}

.validation-info {
    margin-top: 10px;
    font-size: 0.9rem;
}

.validation-error {
    color: var(--error-color);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 10px;
}

.validation-success {
    color: var(--success-color);
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 10px;
}

.region-section, .number-section {
    margin-bottom: 30px;
}

.region-select, .start-number, .custom-region {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.region-select:focus, .start-number:focus, .custom-region:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sort-options {
    margin-bottom: 30px;
}

.sort-options label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
}

.sort-options input[type="radio"] {
    margin-right: 8px;
}

.generate-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.generate-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.generate-btn:active {
    background: var(--primary-active);
    transform: translateY(0);
}

.generate-btn:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
}

/* TAG显示区域样式 */
.tag-display {
    padding: 60px 0;
    background: var(--white);
}

.tag-content {
    position: relative;
    margin-bottom: 20px;
}

.tag-textarea {
    width: 100%;
    min-height: 200px;
    padding: 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: var(--gray-50);
    resize: vertical;
}

.tag-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.edit-btn {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.edit-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.tag-warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: var(--border-radius);
    padding: 15px;
    color: #92400e;
}

/* 配置文件生成区域样式 */
.config-generation {
    padding: 60px 0;
    background: #ffffff;
}

.config-options {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
    padding: 25px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-group label {
    font-weight: 500;
    color: var(--gray-700);
}

.option-group input[type="number"] {
    width: 120px;
    padding: 8px 12px;
    border: 2px solid var(--gray-200);
    border-radius: 4px;
    font-size: 1rem;
}

.option-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

.direct-info {
    margin-top: 10px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--gray-600);
}

.config-block {
    margin-bottom: 40px;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

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

.config-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gray-800);
}

.config-actions {
    display: flex;
    gap: 10px;
}

.config-actions .copy-btn {
    position: static;
    background: var(--success-color);
    padding: 8px 16px;
    font-size: 0.9rem;
}

.config-actions .copy-btn:hover {
    background: #059669;
}

.config-actions .edit-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.config-textarea {
    width: 100%;
    min-height: 300px;
    max-height: 500px;
    padding: 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    background: var(--gray-50);
    resize: vertical;
    overflow-y: auto;
}

.config-usage {
    margin-top: 20px;
    padding: 15px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.config-usage p {
    margin-bottom: 10px;
    font-weight: 500;
}

.config-usage ol {
    margin-left: 20px;
}

.config-usage li {
    margin-bottom: 5px;
}

.config-usage a {
    color: var(--primary-color);
    text-decoration: none;
}

.config-usage a:hover {
    text-decoration: underline;
}

/* 复制成功提示 */
.copy-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.copy-toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* 提取的TAG显示 */
.extracted-tags {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.tags-display {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: var(--white);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
    max-height: 200px;
    overflow-y: auto;
}

