* {
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 10px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* ===== 登录/注册页面 ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #2563eb 100%);
    padding: 20px;
}

.auth-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    animation: authFadeIn 0.5s ease;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #2563eb 100%);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
}

.auth-box h1 {
    margin: 0 0 6px;
    font-size: 24px;
    text-align: center;
    color: var(--text);
    font-weight: 700;
}

.auth-box h2 {
    margin: 0 0 28px;
    font-size: 15px;
    color: var(--text-muted);
    text-align: center;
    font-weight: 400;
}

.auth-form {
    margin-top: 8px;
}

.auth-field {
    margin-bottom: 20px;
}

.auth-field label {
    display: block;
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.auth-field input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s;
    background: #f9fafb;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.auth-submit-btn {
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #2563eb 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
    letter-spacing: 4px;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-link {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ===== 顶部导航 ===== */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    padding: 4px 12px;
    background: #f3f4f6;
    border-radius: 20px;
}

.btn-success {
    background: var(--success) !important;
    color: #fff !important;
}

.btn-success:hover {
    background: #15803d !important;
}

.reg-closed {
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== 统计卡片 ===== */
.stats-card {
    display: flex;
    gap: 16px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 140px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    text-align: center;
}

.stat-box .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-box .stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.stat-box.total .stat-value { color: var(--primary); }
.stat-box.success .stat-value { color: var(--success); }
.stat-box.fail .stat-value { color: var(--danger); }

.stat-bar-wrap {
    margin-top: 12px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

.stat-bar-fill.total { background: var(--primary); }
.stat-bar-fill.success { background: var(--success); }
.stat-bar-fill.fail { background: var(--danger); }

/* ===== 通用卡片 ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card h2 {
    margin: 0 0 18px;
    font-size: 18px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

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

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-danger {
    background: var(--danger);
}

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

.upload-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.upload-actions .btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 15px;
}

/* ===== 表单 ===== */
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 6px 0 0;
}

/* ===== 拖拽上传区 ===== */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 20px;
    overflow: hidden;
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.drop-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.drop-zone .drop-label {
    position: relative;
    z-index: 1;
    display: block;
    pointer-events: none;
}

.drop-zone p {
    margin: 0;
    font-size: 16px;
}

/* ===== 队列列表 ===== */
.queue-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 14px;
}

.queue-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.queue-item .name {
    font-weight: 500;
    word-break: break-all;
}

.queue-item .meta {
    color: var(--text-muted);
    font-size: 12px;
}

.queue-item .status {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.status-pending { background: #e5e7eb; color: #374151; }
.status-uploading { background: #dbeafe; color: #1e40af; }
.status-success { background: #d1fae5; color: #065f46; }
.status-error { background: #fee2e2; color: #991b1b; }

/* ===== 进度条 ===== */
.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.2s ease;
    width: 0%;
}

.progress-fill.success { background: var(--success); }
.progress-fill.error { background: var(--danger); }

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
}

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
}

.data-table a {
    color: var(--primary);
    text-decoration: none;
}

.text-center {
    text-align: center;
}

/* ===== 工具栏 ===== */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.toolbar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
}

.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== 提示 ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.form-msg {
    margin-left: 12px;
    font-size: 14px;
    color: var(--success);
}

/* ===== 云盘配置模块 ===== */
.config-card {
    padding: 24px;
}

.config-header h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.config-bracket {
    color: var(--text-muted);
    font-weight: 400;
}

.config-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.config-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.config-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.config-panel {
    display: none;
}

.config-panel.active {
    display: block;
}

.config-banner {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
}

.config-banner.info {
    background: #e8f4fd;
    color: #1e5a8a;
}

.config-banner.status {
    background: #e6f7ee;
    color: #065f46;
}

.config-banner.error {
    background: #fee2e2;
    color: #991b1b;
}

.config-login-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.config-field {
    flex: 1;
    margin-bottom: 14px;
    min-width: 0;
}

.config-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

.config-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.config-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.config-field-code {
    flex: 0 0 auto;
    min-width: 220px;
}

.code-input-group {
    display: flex;
    gap: 8px;
}

.code-input-group input {
    flex: 1;
    min-width: 0;
}

.code-input-group .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.config-login-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.config-fields {
    margin-bottom: 16px;
}

.config-helper {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.config-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-outline {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

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

/* ===== 总进度条 ===== */
.overall-progress {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #f0f7ff;
    border-radius: 10px;
    border: 1px solid #bfdbfe;
}

.overall-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
}

.overall-progress-bar-wrap {
    height: 12px;
    background: #dbeafe;
    border-radius: 6px;
    overflow: hidden;
}

.overall-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    .form-group {
        min-width: auto;
    }
    .stats-card {
        flex-direction: row;
    }
    .stat-box {
        min-width: 100px;
        padding: 14px 10px;
    }
    .stat-box .stat-value {
        font-size: 24px;
    }
    .upload-actions {
        flex-direction: row;
    }
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .header-right {
        margin-left: 0;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .user-name {
        padding: 4px 8px;
        font-size: 13px;
    }
    .config-login-row {
        flex-direction: column;
        gap: 12px;
    }
    .config-field-code {
        min-width: auto;
    }
    .code-input-group {
        flex-direction: row;
    }
    .config-login-actions {
        flex-direction: row;
    }
    .config-login-actions .btn {
        flex: 1;
    }
    .config-tab {
        padding: 8px 14px;
        font-size: 13px;
    }
    .config-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .config-footer .btn {
        width: 100%;
    }
    .config-footer .form-msg {
        margin-left: 0;
        text-align: center;
    }
}
