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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

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

header {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

nav {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    background: #ecf0f1;
    color: #7f8c8d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: #d5dbdb;
}

.nav-btn.active {
    background: #3498db;
    color: white;
}

.tab-content {
    display: none;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    min-height: auto;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.sort-controls label {
    font-weight: 600;
    color: #2c3e50;
    margin-right: 10px;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable:hover {
    background-color: #f8f9fa;
}

.sort-arrow {
    font-size: 12px;
    margin-left: 5px;
    opacity: 0.6;
}

.sort-arrow.active {
    opacity: 1;
    color: #3498db;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: fixed; /* 固定表格布局 */
    min-width: 1000px; /* 设置最小宽度确保内容不挤压 */
}

th, td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 网站表格列宽定义 */
#websitesTable th:nth-child(1), /* 网站名称 */
#websitesTable td:nth-child(1) {
    width: 15%;
    min-width: 120px;
}

#websitesTable th:nth-child(2), /* 域名 */
#websitesTable td:nth-child(2) {
    width: 22%;
    min-width: 160px;
}

#websitesTable th:nth-child(3), /* 描述 */
#websitesTable td:nth-child(3) {
    width: 12%;
    min-width: 100px;
}

#websitesTable th:nth-child(4), /* 关键词 */
#websitesTable td:nth-child(4) {
    width: 12%;
    min-width: 100px;
}

#websitesTable th:nth-child(5), /* 外链数量 */
#websitesTable td:nth-child(5) {
    width: 8%;
    min-width: 70px;
    text-align: center;
}

#websitesTable th:nth-child(6), /* 添加时间 */
#websitesTable td:nth-child(6) {
    width: 15%;
    min-width: 120px;
}

#websitesTable th:nth-child(7), /* 操作 */
#websitesTable td:nth-child(7) {
    width: 18%;
    min-width: 200px;
}

/* 外链来源表格列宽定义 */
#sourcesTable th:nth-child(1), /* 网站名称 */
#sourcesTable td:nth-child(1) {
    width: 20%;
    min-width: 150px;
}

#sourcesTable th:nth-child(2), /* 域名 */
#sourcesTable td:nth-child(2) {
    width: 20%;
    min-width: 150px;
}

#sourcesTable th:nth-child(3), /* DR值 */
#sourcesTable td:nth-child(3) {
    width: 8%;
    min-width: 60px;
    text-align: center;
}

#sourcesTable th:nth-child(4), /* 类型 */
#sourcesTable td:nth-child(4) {
    width: 8%;
    min-width: 60px;
    text-align: center;
}

#sourcesTable th:nth-child(5), /* 可用性 */
#sourcesTable td:nth-child(5) {
    width: 8%;
    min-width: 70px;
    text-align: center;
}

#sourcesTable th:nth-child(6), /* 月访问量 */
#sourcesTable td:nth-child(6) {
    width: 12%;
    min-width: 100px;
    text-align: center;
}

#sourcesTable th:nth-child(7), /* 添加时间 */
#sourcesTable td:nth-child(7) {
    width: 12%;
    min-width: 140px;
}

#sourcesTable th:nth-child(8), /* 操作 */
#sourcesTable td:nth-child(8) {
    width: 12%;
    min-width: 100px;
}

/* 网站详情表格列宽定义 */
#websiteDetailTable th:nth-child(1), /* 外链来源 */
#websiteDetailTable td:nth-child(1) {
    width: 18%;
    min-width: 130px;
}

#websiteDetailTable th:nth-child(2), /* 域名 */
#websiteDetailTable td:nth-child(2) {
    width: 18%;
    min-width: 130px;
}

#websiteDetailTable th:nth-child(3), /* DR值 */
#websiteDetailTable td:nth-child(3) {
    width: 7%;
    min-width: 50px;
    text-align: center;
}

#websiteDetailTable th:nth-child(4), /* 类型 */
#websiteDetailTable td:nth-child(4) {
    width: 7%;
    min-width: 50px;
    text-align: center;
}

#websiteDetailTable th:nth-child(5), /* 可用性 */
#websiteDetailTable td:nth-child(5) {
    width: 7%;
    min-width: 60px;
    text-align: center;
}

#websiteDetailTable th:nth-child(6), /* 发布状态 */
#websiteDetailTable td:nth-child(6) {
    width: 8%;
    min-width: 70px;
    text-align: center;
}

#websiteDetailTable th:nth-child(7), /* 月访问量 */
#websiteDetailTable td:nth-child(7) {
    width: 10%;
    min-width: 80px;
    text-align: center;
}

#websiteDetailTable th:nth-child(8), /* 添加时间 */
#websiteDetailTable td:nth-child(8) {
    width: 10%;
    min-width: 120px;
}

#websiteDetailTable th:nth-child(9), /* 操作 */
#websiteDetailTable td:nth-child(9) {
    width: 15%;
    min-width: 150px;
}

tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

.status-unpublished {
    background: #f8d7da;
    color: #721c24;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.backup-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.backup-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.backup-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.backup-card p {
    color: #6c757d;
    margin-bottom: 15px;
}

.website-info {
    color: #6c757d;
    margin-top: 5px;
    font-size: 14px;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.type-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.type-free {
    background: #d4edda;
    color: #155724;
}

.type-paid {
    background: #fff3cd;
    color: #856404;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

.status-unpublished {
    background: #fff3cd;
    color: #856404;
}

.status-no-record {
    background: #f8d7da;
    color: #721c24;
}

.content-section {
    position: relative;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.content-type {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
}

.content-type h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
}

.copy-btn {
    z-index: 10;
}

.wide-modal .modal-content {
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.domain-link {
    color: #3498db;
    text-decoration: none;
}

.domain-link:hover {
    text-decoration: underline;
}

/* 禁用按钮样式 */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #fff !important;
}

.btn:disabled:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
}

#generatedContent,
#linkContent,
#htmlContent,
#htmlEscapedContent,
#htmlSafeContent,
#htmlBasicContent,
#htmlClickableContent,
#htmlMixedContent,
#plainTextContent,
#splitContent,
#bbcodeContent,
#markdownContent,
#fullContent,
#htmlStandardLinkContent,
#htmlNoRelLinkContent,
#htmlJsClickableContent,
#htmlUrlOnlyContent {
    background: #f8f9fa;
    border: none;
    border-radius: 0 0 8px 8px;
    padding: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: anywhere;
    hyphens: auto;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 10px;
    max-width: 100%;
    overflow-x: auto;
    min-height: 40px;
}

.action-buttons {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap; /* 防止换行 */
    justify-content: flex-start;
}

.action-buttons .btn {
    padding: 3px 5px;
    font-size: 10px;
    min-width: 36px; /* 确保按钮最小宽度 */
    white-space: nowrap;
    line-height: 1.2;
}

/* 表格按钮特殊样式 - 合适大小 */
.action-buttons .btn-sm {
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-width: 45px !important;
    border-radius: 3px;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    nav {
        flex-wrap: wrap;
    }
    
    /* 小屏幕表格优化 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 800px; /* 减小最小宽度 */
    }
    
    th, td {
        padding: 6px 8px; /* 减小内边距 */
        font-size: 14px;
    }
    
    /* 调整按钮组布局 - 保持水平排列 */
    .action-buttons {
        gap: 2px;
    }
    
    .action-buttons .btn {
        padding: 3px 4px;
        font-size: 10px;
        min-width: 32px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    table {
        min-width: 600px; /* 进一步减小最小宽度 */
    }
    
    th, td {
        padding: 4px 6px;
        font-size: 12px;
    }
    
    /* 移动端按钮组优化 */
    .action-buttons {
        flex-direction: column;
        gap: 2px;
    }
    
    .action-buttons .btn {
        width: 100%;
        min-width: auto;
        margin: 1px 0;
    }
}

/* 按钮交互增强 */
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 表格行悬停效果 */
tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

/* 加载状态样式 */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

    /* 隐藏次要列以提高可读性 */
    #websitesTable th:nth-child(3), /* 描述列 */
    #websitesTable td:nth-child(3),
    #websitesTable th:nth-child(4), /* 关键词列 */
    #websitesTable td:nth-child(4) {
        display: none;
    }
    
    #sourcesTable th:nth-child(7), /* 添加时间列 */
    #sourcesTable td:nth-child(7) {
        /*display: none;*/
    }
    
    #websiteDetailTable th:nth-child(8), /* 添加时间列 */
    #websiteDetailTable td:nth-child(8) {
        display: none;
    }


/* 统计看板样式 */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.stat-icon {
    font-size: 32px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stats-dashboard {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 24px;
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }
    
    .stat-number {
        font-size: 22px;
    }
    
    .stat-label {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .backup-section {
        grid-template-columns: 1fr;
    }
}

/* 导入界面样式 */
.import-description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #007bff;
}

.import-description p {
    margin-bottom: 8px;
    color: #495057;
}

.import-description ul {
    margin: 0;
    padding-left: 20px;
}

.import-description li {
    margin-bottom: 5px;
    color: #6c757d;
}

.import-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.import-progress {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.progress-info {
    color: #3498db;
    font-weight: 500;
}

.import-results {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.results-summary {
    margin-bottom: 20px;
    padding: 15px;
    background: #e8f5e8;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
}

.results-summary p {
    margin: 0;
    color: #27ae60;
    font-weight: 500;
}

.batch-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ecf0f1;
}

.btn-success {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-success:hover {
    background: #229954;
}

.import-table-cell {
    padding: 12px;
    vertical-align: middle;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 3px;
}

.btn-warning {
    background: #f39c12;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.btn-warning:hover {
    background: #e67e22;
}

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

.action-buttons .btn {
    white-space: nowrap;
}

/* Toast notification styles */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #27ae60;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 300px;
    font-size: 14px;
}

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

.toast.error {
    background: #e74c3c;
}

.toast.warning {
    background: #f39c12;
}

.toast.info {
    background: #3498db;
}

/* Filter help styles */
.filter-help {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
}

.filter-help h4 {
    color: #495057;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.filter-help ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-help li {
    margin-bottom: 8px;
    font-size: 13px;
    color: #6c757d;
}

.filter-help code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: #495057;
}

/* Form help text */
.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
    line-height: 1.4;
}

.form-help code {
    background: #e9ecef;
    padding: 1px 4px;
    border-radius: 2px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 11px;
    color: #495057;
}

/* AITDK visits cell styles */
.visits-cell {
    text-align: center;
}

.visits-number {
    font-weight: bold;
    color: #007bff;
    font-size: 14px;
}

.aitdk-link {
    font-size: 11px;
    color: #6c757d;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 3px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    display: inline-block;
    margin-top: 2px;
}

.aitdk-link:hover {
    color: #495057;
    background: #e9ecef;
    text-decoration: none;
}

.btn-info.btn-sm {
    font-size: 11px;
    padding: 4px 8px;
    margin: 0 2px;
}

/* 批量扫描模态框样式 */
.batch-scan-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.scan-option {
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.scan-option:hover {
    border-color: #3498db;
    background: #ffffff;
}

.scan-option h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
}

.scan-option p {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 14px;
}

.selected-files {
    margin-top: 15px;
    padding: 15px;
    background: #e8f5e8;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
}

.selected-files ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    max-height: 150px;
    overflow-y: auto;
}

.selected-files li {
    padding: 5px 0;
    border-bottom: 1px solid #d4edda;
    font-size: 13px;
    color: #155724;
}

.selected-files li:last-child {
    border-bottom: none;
}

.manual-input {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.manual-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}