/* ============================================================
   网址导航系统 公共样式（前台 / 登录页 / 后台）
   ============================================================ */
:root {
    --primary: #2b5ad8;          /* 主色（顶部导航蓝） */
    --primary-dark: #1e43a8;
    --primary-light: #4f7cf0;
    --accent: #ffd666;           /* “登录管理”黄色 */
    --text: #2b3445;
    --text-sub: #7b8798;
    --radius: 14px;
    --shadow: 0 6px 18px rgba(30, 60, 140, .08);
    --shadow-hover: 0 12px 28px rgba(30, 60, 140, .16);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
                 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: #f2f5fa;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ============ 前台首页 ============ */
.page-front {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(600px 300px at 15% -10%, rgba(79, 124, 240, .18), transparent 60%),
        radial-gradient(700px 340px at 90% 110%, rgba(80, 180, 220, .16), transparent 60%),
        linear-gradient(160deg, #eef3fb 0%, #f7f9fd 55%, #eef4ff 100%);
}

.topbar {
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 55%, #3a6ee8 100%);
    box-shadow: 0 2px 10px rgba(30, 67, 168, .35);
    position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
    max-width: 1120px; margin: 0 auto; padding: 0 20px;
    height: 58px; display: flex; align-items: center; justify-content: space-between;
}
.topbar-brand { color: #fff; font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.topbar-login {
    color: var(--accent); font-size: 15px; font-weight: 600;
    padding: 6px 16px; border: 1px solid rgba(255, 214, 102, .65); border-radius: 20px;
    transition: all .2s;
}
.topbar-login:hover { background: rgba(255, 214, 102, .14); }

.front-main {
    flex: 1; width: 100%; max-width: 1120px; margin: 0 auto;
    padding: 46px 20px 20px;
}
.front-title {
    text-align: center; font-size: 34px; font-weight: 700; color: #1d2c4f;
    letter-spacing: 2px;
}
.front-sub {
    text-align: center; color: var(--text-sub); font-size: 14px;
    margin: 10px 0 42px; letter-spacing: 1px;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
    gap: 20px;
}

.nav-card {
    background: #ffffff;
    border: 1px solid #e6ebf5;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 28px 16px 24px;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    position: relative; overflow: hidden;
}
.nav-card::before { /* 卡片顶部彩色细条 */
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg,
        hsl(calc(var(--hue, 210)) 70% 60%),
        hsl(calc(var(--hue, 210) + 40) 70% 62%));
    opacity: .85;
}
.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: #cdd9f4;
}

.card-icon {
    width: 62px; height: 62px; border-radius: 50%;
    background: hsl(var(--hue, 210) 65% 93%);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
    font-size: 30px;
    transition: transform .22s ease;
}
.nav-card:hover .card-icon { transform: scale(1.08); }
.card-icon img { width: 34px; height: 34px; object-fit: contain; }
.card-emoji { line-height: 1; }

.card-name { font-size: 16px; font-weight: 600; color: #2b3445; }

.empty-tip { grid-column: 1 / -1; text-align: center; color: var(--text-sub); padding: 40px 0; }

.front-footer {
    text-align: center; color: var(--text-sub); font-size: 13px;
    padding: 22px 0 26px;
}

/* ============ 登录页 ============ */
.page-login {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background:
        radial-gradient(520px 320px at 20% 15%, rgba(79, 124, 240, .35), transparent 60%),
        radial-gradient(560px 360px at 85% 85%, rgba(56, 130, 220, .30), transparent 60%),
        linear-gradient(150deg, #1c2f66 0%, #2b5ad8 55%, #3a6ee8 100%);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
    background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(10, 30, 80, .35);
    padding: 36px 34px 28px;
}
.login-logo {
    width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), #5b8cff);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; box-shadow: 0 8px 18px rgba(43, 90, 216, .35);
}
.login-title { text-align: center; font-size: 22px; color: #1d2c4f; }
.login-sub { text-align: center; color: var(--text-sub); font-size: 13px; margin: 8px 0 22px; }

.alert { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.6; }
.alert-warn  { background: #fff7e0; color: #8a6100; border: 1px solid #ffe3a3; }
.alert-error { background: #ffeaea; color: #c0392b; border: 1px solid #ffc9c9; }
.alert-ok    { background: #e9f9ee; color: #1e7d3c; border: 1px solid #bfe8cd; }

.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; color: #4a5874; margin-bottom: 6px; font-weight: 600; }
.field-input {
    width: 100%; padding: 11px 14px; font-size: 14px; color: var(--text);
    border: 1px solid #d4dcea; border-radius: 10px; background: #f8fafd;
    transition: border-color .2s, box-shadow .2s;
}
.field-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 90, 216, .14); background: #fff;
}
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row .field-input { flex: 1; }
.captcha-quiz {
    flex: 0 0 auto; padding: 10px 16px; border-radius: 10px;
    background: linear-gradient(135deg, #eef3ff, #e4ecff); color: #1d3a8f;
    font-weight: 700; font-size: 15px; letter-spacing: 2px;
}
.btn-login {
    width: 100%; padding: 12px; margin-top: 6px; font-size: 16px; font-weight: 700;
    color: #fff; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: opacity .2s, transform .1s; letter-spacing: 6px;
}
.btn-login:hover { opacity: .92; }
.btn-login:active { transform: scale(.985); }
.login-back { text-align: center; margin-top: 18px; }
.login-back a { color: var(--text-sub); font-size: 13px; }
.login-back a:hover { color: var(--primary); }

/* ============ 后台管理 ============ */
.page-admin { min-height: 100vh; background: #f2f5fa; }
.admin-layout { display: flex; min-height: 100vh; }

.admin-side {
    width: 220px; flex: 0 0 220px;
    background: linear-gradient(180deg, #16295e 0%, #1e3a8a 60%, #2347a8 100%);
    color: #fff; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.side-brand {
    padding: 24px 20px 18px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.side-logo { font-size: 26px; }
.side-name { font-weight: 700; font-size: 16px; letter-spacing: 1px; }
.side-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.side-item {
    display: block; padding: 12px 14px; border-radius: 10px;
    color: rgba(255, 255, 255, .82); font-size: 14px; font-weight: 600;
    transition: background .2s, color .2s;
}
.side-item:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.side-item.active { background: rgba(255, 255, 255, .18); color: var(--accent); }
.side-foot {
    padding: 14px 12px; border-top: 1px solid rgba(255, 255, 255, .12);
    display: flex; flex-direction: column; gap: 4px;
}

.admin-main { flex: 1; padding: 22px 26px 40px; min-width: 0; }
.admin-topbar {
    display: flex; justify-content: flex-end; align-items: center;
    padding: 10px 18px; margin-bottom: 20px;
    background: #fff; border-radius: 12px; box-shadow: var(--shadow);
    color: var(--text-sub); font-size: 13px;
}

.panel {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 22px; margin-bottom: 22px;
}
.panel-narrow { max-width: 560px; }
.panel-head { border-bottom: 1px solid #eef1f7; padding-bottom: 14px; margin-bottom: 18px; }
.panel-head h3 { font-size: 16px; color: #1d2c4f; }

.form-inline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px 18px; align-items: end;
}
.form-col label { display: block; font-size: 13px; color: #4a5874; margin-bottom: 6px; font-weight: 600; }
.form-col label em { color: #e74c3c; font-style: normal; }
.form-col-sm { max-width: 170px; }
.form-col-actions { display: flex; gap: 10px; align-items: center; }

.radio-row { display: flex; gap: 18px; padding: 11px 0; }
.radio { font-size: 14px; color: #4a5874; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox-inline {
    font-size: 14px; color: #4a5874;
    display: flex; align-items: center; gap: 6px; padding: 11px 0; cursor: pointer;
}

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; color: #4a5874; margin-bottom: 6px; font-weight: 600; }
.form-tip { font-size: 12.5px; color: var(--text-sub); margin: -6px 0 14px; line-height: 1.7; }

.btn {
    display: inline-block; padding: 9px 18px; font-size: 14px; font-weight: 600;
    border: none; border-radius: 9px; cursor: pointer; transition: opacity .2s;
}
.btn:hover { opacity: .9; }
.btn-primary { background: linear-gradient(90deg, var(--primary), var(--primary-light)); color: #fff; }
.btn-plain { background: #eef2f9; color: #44537a; }
.btn-danger { background: #fdeceb; color: #c0392b; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
    text-align: left; padding: 11px 12px; border-bottom: 1px solid #eef1f7; white-space: nowrap;
}
.data-table th { color: #6a7890; font-weight: 600; font-size: 13px; background: #f8fafd; }
.data-table tbody tr:hover { background: #f8faff; }
.td-icon { text-align: center; }
.td-emoji { font-size: 22px; }
.td-img { width: 26px; height: 26px; object-fit: contain; vertical-align: middle; }
.td-name { font-weight: 600; color: #1d2c4f; }
.td-url { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.td-url a { color: var(--primary); }
.td-url a:hover { text-decoration: underline; }
.td-actions { display: flex; gap: 8px; align-items: center; }
.td-empty { text-align: center; color: var(--text-sub); padding: 30px 0 !important; }

.badge { border: none; cursor: pointer; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 20px; }
.badge-on { background: #e9f9ee; color: #1e7d3c; }
.badge-off { background: #f1f3f8; color: #8a94a6; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
    .admin-layout { flex-direction: column; }
    .admin-side {
        width: 100%; height: auto; position: static;
        flex-direction: row; align-items: center; padding: 0 14px;
    }
    .side-brand { border-bottom: none; padding: 12px 8px; }
    .side-nav { flex-direction: row; padding: 0; gap: 6px; }
    .side-item { padding: 10px 12px; font-size: 13px; }
    .side-foot { border-top: none; padding: 0; flex-direction: row; gap: 6px; }
    .admin-main { padding: 16px; }
}

@media (max-width: 768px) {
    /* 手机端列数完全遵循后台“手机端布局”设置；
       仅当电脑端浏览器窗口被压缩到手机宽度时，兜底改为 2 列 */
    body.is-desktop .nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px; }
    body.is-mobile .nav-grid { gap: 14px; }
    .front-title { font-size: 26px; }
    .front-main { padding-top: 32px; }
    .nav-card { padding: 22px 12px 18px; }
}

/* 布局设置：电脑端 / 手机端双栏 */
.layout-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.layout-box {
    background: #f8fafd;
    border: 1px solid #e6ebf5;
    border-radius: 12px;
    padding: 16px 18px;
}
.layout-box-head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid #e6ebf5;
}
.layout-box-head strong { font-size: 15px; color: #1d2c4f; }
.layout-device-icon { font-size: 20px; }
.layout-tag {
    margin-left: auto; font-size: 12px; color: var(--text-sub);
    background: #eef2f9; padding: 3px 10px; border-radius: 20px;
    white-space: nowrap;
}
.form-row-wide { max-width: 560px; }
@media (max-width: 420px) {
    .layout-tag { display: none; }
}
