/* 畜博导航管理后台 - 样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg: #f1f5f9;
    --card-bg: #fff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --ok: #059669;
    --warn: #d97706;
    --danger: #dc2626;
    --hot: #7c3aed;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* 登录页 */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 100%);
}
.login-box {
    background: #fff; border-radius: 12px; padding: 40px;
    width: 380px; max-width: 94%; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-box h1 { text-align: center; font-size: 22px; margin-bottom: 28px; color: var(--primary); }

/* 导航 */
.nav {
    background: #1e293b; color: #fff; position: sticky; top: 0; z-index: 100;
}
.nav-inner {
    max-width: 1300px; margin: 0 auto; display: flex;
    align-items: center; padding: 0 20px; height: 50px;
}
.nav-brand { color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; }
.nav-links { margin-left: auto; display: flex; gap: 4px; }
.nav-links a {
    color: #94a3b8; text-decoration: none; padding: 6px 14px;
    border-radius: 6px; font-size: 13px; transition: all 0.15s;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-links a.active { color: #fff; background: var(--primary); }
.nav-logout { color: #f87171 !important; }

/* 容器 */
.container { max-width: 1300px; margin: 0 auto; padding: 24px 20px; }
h2 { font-size: 20px; margin-bottom: 20px; }
h3 { font-size: 15px; margin: 20px 0 10px; color: var(--text-muted); }

/* 卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); text-align: center;
}
.card-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.card-warn .card-num { color: var(--warn); }
.card-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* 行/列 */
.row { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.col-4 { flex: 1; min-width: 280px; }
.col-6 { flex: 1; min-width: 300px; }
.col-8 { flex: 2; min-width: 400px; }

/* 筛选栏 */
.filter-bar {
    background: var(--card-bg); padding: 14px 18px; border-radius: var(--radius);
    margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.filter-actions { display: flex; gap: 8px; }
.filter-bar label { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }

/* 表单 */
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group label { font-size: 12px; color: var(--text-muted); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }
input, select {
    border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px;
    font-size: 14px; background: #fff; outline: none; transition: border 0.15s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 18px; border: none; border-radius: 6px; font-size: 14px;
    cursor: pointer; text-decoration: none; background: var(--border); color: var(--text);
    transition: all 0.15s;
}
.btn:hover { filter: brightness(0.92); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-block { width: 100%; padding: 10px; font-size: 15px; }
.btn-outline { background: transparent; border: 1px solid var(--border); }
.btn-sm {
    display: inline-block; padding: 3px 10px; font-size: 12px; border-radius: 4px;
    text-decoration: none; background: #e2e8f0; color: var(--text); white-space: nowrap;
}
.btn-sm:hover { filter: brightness(0.88); }
.btn-ok { background: #d1fae5; color: #065f46; }
.btn-hot { background: #ede9fe; color: #5b21b6; }
.btn-warn { background: #fef3c7; color: #92400e; }
.btn-danger { background: #fee2e2; color: #991b1b; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: var(--card-bg);
    border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
.table th { background: #f8fafc; font-weight: 600; color: var(--text-muted); font-size: 12px; }
.table tr:hover td { background: #f8fafc; }
.table .empty { text-align: center; color: var(--text-muted); padding: 30px; white-space: normal; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mono { font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace; font-size: 12px; }
.col-url { max-width: 160px; word-break: break-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { white-space: nowrap; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.mobile-action-select { display: none; white-space: nowrap; }
.mobile-action-select select { padding: 3px 6px; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; background: #fff; outline: none; max-width: 90px; }
.mobile-action-select .btn-sm { padding: 3px 8px; font-size: 11px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 10px; padding: 14px 0; font-size: 13px; color: var(--text-muted); }
.pager a { color: var(--primary); text-decoration: none; padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; }
.pager a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 编辑面板 */
.edit-panel {
    background: var(--card-bg); border-radius: var(--radius); padding: 18px;
    margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.edit-panel h3 { margin-top: 0; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #e2e8f0; color: var(--text-muted); }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-hot { background: #ede9fe; color: #5b21b6; }
.badge-muted { background: #e2e8f0; color: #64748b; }

/* 消息 */
.msg-error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }

/* 禁用状态 */
.btn[disabled], button[disabled] { opacity: 0.4; cursor: not-allowed; filter: none; }

/* 跳页 */
.go-page { margin-left: 12px; font-size: 13px; color: var(--text-muted); }
.page-input { width: 36px; padding: 2px 4px; text-align: center; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; outline: none; }
.page-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,0.15); }

/* ========== 手机端适配 ========== */
@media (max-width: 768px) {
    .container { padding: 14px 12px; }
    h2 { font-size: 17px; margin-bottom: 14px; }

    /* 导航 */
    .nav-inner { padding: 0 12px; height: auto; flex-wrap: wrap; gap: 4px; }
    .nav-inner { padding-top: 8px; padding-bottom: 8px; }
    .nav-links { margin-left: 0; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .nav-links a { padding: 5px 10px; font-size: 12px; }

    /* 卡片 */
    .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .card { padding: 14px 10px; }
    .card-num { font-size: 22px; }

    /* 行/列全宽 */
    .row { flex-direction: column; gap: 12px; }
    .col-4, .col-6, .col-8 { min-width: 0; width: 100%; }

    /* 筛选栏垂直 */
    .filter-bar { flex-direction: column; padding: 12px; }
    .filter-bar label { width: 100%; }
    .filter-bar input, .filter-bar select { width: 100%; }
    .filter-actions { display: flex; gap: 8px; }

    /* 表单 */
    .form-row { flex-direction: column; gap: 0; }
    .form-row .form-group { min-width: 0; }

    /* 表格水平滚动 */
    .table-wrapper { margin: 0 -12px; }
    .col-url { max-width: 80px; }
    .table th, .table td { padding: 6px 6px; font-size: 12px; }

    /* 操作列 - 只在链接管理页隐藏按钮，显示下拉菜单 */
    .has-many-actions .actions .btn-sm { display: none; }
    .has-many-actions .actions .mobile-action-select { display: inline-flex; }

    /* 分页 */
    .pager { flex-wrap: wrap; gap: 6px; font-size: 12px; }
    .go-page { margin-left: 0; }

    /* 登录 */
    .login-body { padding: 20px 12px; }
    .login-box { padding: 28px 20px; }
    .login-box h1 { font-size: 18px; }
}

@media (max-width: 420px) {
    .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .card-num { font-size: 18px; }
    .table th, .table td { padding: 6px 8px; font-size: 12px; }
}
