/* ============================================================
   WordPress 站点迁移管理 - 基础样式
   ============================================================ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ea580c;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--gray-700);
    font-weight: 500;
}
.nav-links a:hover { background: var(--gray-100); text-decoration: none; }
.nav-links a.active { background: var(--primary); color: #fff; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-name { color: var(--gray-700); font-weight: 500; }

/* ---------- 容器 ---------- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-head h2 { font-size: 20px; }
.filter-bar { display: flex; gap: 10px; align-items: center; }

/* ---------- 卡片 ---------- */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin-bottom: 12px; color: var(--gray-700); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
}
.table tr:hover td { background: var(--gray-50); }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.task-no { font-family: monospace; font-weight: 600; }
.domain-cell { font-size: 13px; }
.domain { font-weight: 500; }
.domain.dst { color: var(--primary); }
.arrow { color: var(--gray-300); margin: 0 6px; }
.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.action-cell { white-space: nowrap; }
.action-cell .btn { margin-right: 4px; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green { background: #dcfce7; color: var(--success); }
.badge-red { background: #fee2e2; color: var(--danger); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }
.badge-blue { background: #dbeafe; color: var(--primary); }
.badge-orange { background: #ffedd5; color: var(--warning); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 14px;
    cursor: pointer;
    background: var(--gray-100);
    color: var(--gray-900);
    transition: all .15s;
}
.btn:hover { opacity: .9; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border-color: var(--gray-300); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-card { max-width: 860px; }
.form-section-title {
    font-size: 15px;
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-100);
    color: var(--gray-900);
}
.form-section-title:first-of-type { margin-top: 0; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-group { margin-bottom: 4px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 5px;
}
.form-group .req { color: var(--danger); }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-group .hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--gray-100);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.form-actions { margin-top: 24px; display: flex; gap: 12px; align-items: center; }

/* ---------- 提示 ---------- */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}
.alert-error { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: var(--success); border: 1px solid #bbf7d0; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- 登录页 ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { font-size: 40px; text-align: center; }
.login-card h1 { font-size: 20px; text-align: center; margin: 10px 0 4px; }
.login-sub { text-align: center; color: var(--gray-500); font-size: 13px; margin-bottom: 24px; }
.login-card .form-group { margin-bottom: 16px; }
.login-tip { text-align: center; font-size: 12px; color: var(--gray-500); margin-top: 16px; }

/* ---------- 详情页 ---------- */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 860px) {
    .detail-grid { grid-template-columns: 1fr; }
}
.info-table .info-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px dashed var(--gray-200);
    font-size: 13px;
    gap: 16px;
}
.info-table .info-row span:first-child { color: var(--gray-500); flex-shrink: 0; }
.info-table .info-row span:last-child { text-align: right; word-break: break-all; }

.progress-bar {
    height: 8px;
    background: var(--gray-100);
    border-radius: 999px;
    overflow: hidden;
    margin: 6px 0;
}
.progress-bar.lg { height: 12px; }
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 999px;
    transition: width .5s ease;
}
.progress-fill.green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-fill.red { background: linear-gradient(90deg, #ef4444, #dc2626); }
.progress-fill.orange { background: linear-gradient(90deg, #f97316, #ea580c); }
.progress-fill.gray { background: var(--gray-300); }
.progress-text { font-size: 12px; color: var(--gray-500); }

.timeline { list-style: none; padding: 0; }
.timeline-item {
    position: relative;
    padding: 4px 0 4px 24px;
    font-size: 13px;
    color: var(--gray-500);
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 14px;
    bottom: -4px;
    width: 2px;
    background: var(--gray-200);
}
.timeline-item:last-child::before { display: none; }
.timeline-item.current { color: var(--gray-900); font-weight: 600; }
.tl-dot {
    position: absolute;
    left: 2px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1;
}
.tl-dot.green { background: var(--success); }
.tl-dot.blue { background: var(--primary); }
.tl-dot.red { background: var(--danger); }
.tl-dot.gray { background: var(--gray-300); }

.verify-result { font-size: 13px; }
.verify-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px dashed var(--gray-200);
}
.verify-item span { color: var(--gray-500); }
.verify-body { display: block; }
.verify-body code {
    display: block;
    background: var(--gray-100);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    word-break: break-all;
    margin-top: 4px;
}

.notify-item {
    padding: 6px 0;
    border-bottom: 1px dashed var(--gray-200);
    font-size: 13px;
}
.notify-item .badge { margin-left: 6px; }
.notify-item .hint { font-size: 12px; color: var(--gray-500); }

.log-view {
    background: #0f172a;
    color: #94a3b8;
    padding: 16px;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    max-height: 420px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pg-btn {
    padding: 4px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }
.modal .form-group { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }

.footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
    font-size: 12px;
}

/* ---------- 响应式（移动端适配） ---------- */

/* 中等屏：缩小间距 */
@media (max-width: 900px) {
    .topbar-inner { padding: 0 14px; gap: 14px; }
    .container { padding: 18px 14px 50px; }
}

/* 移动端（≤768px） */
@media (max-width: 768px) {
    /* ---- 顶部导航：两行布局，不截断文字 ---- */
    .topbar-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
        row-gap: 6px;
    }
    .brand {
        font-size: 14px;
        max-width: 52vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex-shrink: 1;
        min-width: 0;
    }
    .user-info { margin-left: auto; flex-shrink: 0; gap: 8px; }
    .user-name {
        font-size: 12px;
        max-width: 24vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nav-links {
        order: 3;
        flex-basis: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 2px;
        padding-bottom: 2px;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 13px;
    }

    /* ---- 页面头部：堆叠排列 ---- */
    .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
    .page-head h2 { font-size: 18px; }
    .filter-bar { width: 100%; }
    .filter-bar select { flex: 1; min-width: 0; padding: 8px 10px; }
    .filter-bar .btn { flex-shrink: 0; }

    /* ---- 表格卡片化：每行一张卡片 ---- */
    .table-wrap { overflow: visible; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table thead { display: none; }
    .table tr {
        border: 1px solid var(--gray-200);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 2px 14px;
        background: #fff;
        box-shadow: var(--shadow);
    }
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 9px 0;
        border-bottom: 1px dashed var(--gray-200);
        white-space: normal;
        text-align: right;
        font-size: 13px;
    }
    .table td:last-child { border-bottom: none; }
    .table td::before {
        content: attr(data-label);
        font-size: 12px;
        font-weight: 600;
        color: var(--gray-500);
        flex-shrink: 0;
    }
    .table tr:hover td { background: transparent; }
    .table td.text-center { text-align: right; }

    /* 表格内特殊列适配 */
    .domain-cell { flex-direction: row; }
    .domain-cell .domain { word-break: break-all; min-width: 0; }
    .domain-cell .arrow { flex-shrink: 0; }
    .table td .progress-bar { flex: 1; min-width: 70px; margin: 0; }
    .progress-text { flex-shrink: 0; }
    .url-cell { max-width: none !important; word-break: break-all; }
    .action-cell { flex-shrink: 0; }
    .table td[data-label="操作"] { justify-content: flex-start; }
    .table td[data-label="操作"]::before { margin-right: auto; }

    /* ---- 表单 ---- */
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .form-card { max-width: none; }
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; }
    .form-section-title { font-size: 14px; }
    .checkbox-group { gap: 8px; }
    .checkbox-item { padding: 8px 12px; }

    /* ---- 容器/卡片 ---- */
    .container { padding: 14px 12px 40px; }
    .card { padding: 14px; }
    .card h3 { font-size: 14px; }

    /* ---- 登录页 ---- */
    .login-card { padding: 32px 22px; }
    .login-card h1 { font-size: 18px; }
    .login-logo { font-size: 34px; }

    /* ---- 弹窗 ---- */
    .modal { padding: 20px 16px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }

    /* ---- 详情页 ---- */
    .info-table .info-row { font-size: 12.5px; }
    .timeline-item { font-size: 12.5px; }

    /* ---- 分页 ---- */
    .pagination { gap: 5px; }
    .pg-btn { padding: 6px 13px; font-size: 13px; }

    /* ---- 底部 ---- */
    .footer { padding: 14px; }
}

/* 小屏（≤400px）微调 */
@media (max-width: 400px) {
    .topbar-inner { padding: 8px 10px; }
    .brand { font-size: 13px; }
    .user-name { display: none; }   /* 极窄屏只保留退出按钮 */
    .nav-links a { padding: 6px 9px; font-size: 12px; }
    .filter-bar .btn { padding: 7px 12px; font-size: 13px; }
}
