/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 容器布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
th.resizable {
    position: relative;
}

th.resizable .resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 6px;
    cursor: col-resize;
    user-select: none;
    height: 100%;
}

/* 顶部导航 */
.header {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
}

.nav-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e1e5e9;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    background-color: #f8f9fa;
    color: #495057;
}

.tab-btn.active {
    background-color: #007bff;
    color: #fff;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #007bff;
}

/* 区块部分 */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.card-header h2 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.card-body {
    padding: 20px;
}

/* 筛选器 */
.filters {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    color: #6c757d;
    white-space: nowrap;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-primary:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #545b62;
    border-color: #545b62;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-success {
    background-color: #28a745;
    color: #fff;
    border-color: #28a745;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* 表单样式 */
.form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.error-text {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
}

.help-text {
    color: #6c757d;
    font-size: 12px;
    margin-top: 4px;
}

/* 批量导入特殊样式 */
.import-methods {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 16px;
    background-color: #f8f9fa;
}

.import-method {
    margin-bottom: 16px;
}

.import-method:last-child {
    margin-bottom: 0;
}

.import-method h4 {
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.advanced-options {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0;
    margin-top: 16px;
}

.advanced-options summary {
    padding: 12px 16px;
    background-color: #f8f9fa;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.advanced-options[open] summary {
    border-bottom: 1px solid #e9ecef;
}

.advanced-options .form-row {
    padding: 16px;
}

.preview-count {
    background-color: #e7f3ff;
    border: 1px solid #b6d7ff;
    border-radius: 4px;
    padding: 12px;
    margin: 16px 0;
}

.count-text {
    color: #0056b3;
    font-weight: 500;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
}

.table tr:hover {
    background-color: #f8f9fa;
}

.table .url-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table .actions-cell {
    white-space: nowrap;
}

.table .actions-cell .btn {
    margin-right: 4px;
}

/* 分页样式 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding: 16px 0;
}

#text-page {
    font-weight: 500;
    color: #495057;
}

/* 状态样式 */
.loading {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-container {
    text-align: center;
    padding: 40px;
}

.error-container p {
    color: #dc3545;
    margin-bottom: 16px;
}

.empty-container {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.empty-container p {
    margin-bottom: 8px;
}

/* 开关按钮 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #007bff;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* 弹窗样式 */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: auto;
}

.dialog-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.dialog-close:hover {
    color: #495057;
}

.dialog-body {
    padding: 20px;
}

.dialog-actions {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 进度条样式 */
.progress-content {
    text-align: center;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.stat .label {
    font-weight: 500;
    color: #495057;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #007bff;
    border-radius: 10px;
    transition: width 0.3s;
    width: 0%;
}

.progress-percentage {
    font-weight: 500;
    color: #495057;
    min-width: 40px;
}

/* 批量结果样式 */
.batch-results {
    margin-top: 32px;
    border-top: 2px solid #e9ecef;
    padding-top: 20px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-stat {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 4px;
    text-align: center;
}

.summary-stat .number {
    font-size: 24px;
    font-weight: 700;
    color: #007bff;
    display: block;
}

.summary-stat .label {
    font-size: 14px;
    color: #6c757d;
    margin-top: 4px;
}

.result-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    background-color: #fff;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    background-color: #f8f9fa;
}

.filter-btn.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Toast 通知样式 */
.toasts {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 350px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #28a745;
}

.toast.error {
    border-left: 4px solid #dc3545;
}

.toast.warning {
    border-left: 4px solid #ffc107;
}

.toast.info {
    border-left: 4px solid #007bff;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: #495057;
}

.toast-close {
    background: none;
    border: none;
    font-size: 16px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    margin-left: 12px;
}

.toast-close:hover {
    color: #495057;
}

/* 工具样式 */
.hidden {
    display: none !important;
}

.text-muted {
    color: #6c757d;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-2 {
    margin-top: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        justify-content: space-between;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 4px;
    }

    .dialog {
        width: 95%;
        margin: 20px;
    }

    .progress-stats {
        grid-template-columns: 1fr;
    }

    .summary-stats {
        grid-template-columns: 1fr;
    }

    .toasts {
        left: 20px;
        right: 20px;
    }

    .toast {
        max-width: none;
    }
}