/* ============ 西影文旅 · 统一后台 ============ */
:root {
  --red: #b81c22; --red2: #d13729; --ink: #242424; --ink2: #5b5b5b; --ink3: #8b8b8b;
  --line: #e6e2dd; --pale: #f7f5f2; --bg: #f4f5f7; --white: #fff;
  --side: #1b1415; --side2: #281c1d; --ok: #16835c; --warn: #b8791a;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.7 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--ink3); } .small { font-size: 12px; }
.eyebrow { display: inline-block; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--red); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border: 1px solid transparent; border-radius: 3px; font-size: 13px; font-weight: 600; background: none; white-space: nowrap; transition: .2s; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #8f151a; color: #fff; }
.btn-default { border-color: var(--line); background: #fff; color: var(--ink2); }
.btn-default:hover { border-color: var(--red); color: var(--red); }
.btn-mini { padding: 5px 11px; font-size: 12px; border: 1px solid var(--line); background: #fff; border-radius: 2px; }
.btn-mini:hover { border-color: var(--red); color: var(--red); }
.btn-danger { color: #a33; }
.btn-danger:hover { background: #a33; border-color: #a33; color: #fff; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }

.alert { padding: 12px 16px; border-radius: 3px; margin-bottom: 18px; font-size: 13px; line-height: 1.8; border: 1px solid transparent; }
.alert.success { background: #eef8f2; border-color: #cbe9d9; color: var(--ok); }
.alert.error { background: #fdf0f0; border-color: #f2cfcf; color: #a5272c; }
.alert.info { background: #f2f5fa; border-color: #d9e2f0; color: #3c5579; }
.badge { display: inline-block; padding: 2px 9px; font-size: 11px; border-radius: 2px; }
.badge.ok { background: #e8f6ee; color: var(--ok); }
.badge.off { background: #f5eeee; color: #a33; }

/* ---------- 框架 ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: 0 0 224px; background: var(--side); color: rgba(255,255,255,.72); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.09); }
.side-brand img { width: 36px; }
.side-brand span { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.35; }
.side-brand small { display: block; font-size: 10px; font-weight: 400; letter-spacing: .08em; color: rgba(255,255,255,.45); }
.side-nav { padding: 12px 0 20px; flex: 1; }
.side-group-title { padding: 14px 20px 6px; font-size: 11px; letter-spacing: .14em; color: rgba(255,255,255,.35); }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 20px; font-size: 13.5px; position: relative; }
.side-link i { width: 22px; height: 22px; display: grid; place-items: center; font-style: normal; font-size: 11px; background: rgba(255,255,255,.08); border-radius: 2px; color: rgba(255,255,255,.65); }
.side-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-link.on { background: rgba(184,28,34,.24); color: #fff; }
.side-link.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red2); }
.side-link.on i { background: var(--red); color: #fff; }
.side-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.09); font-size: 12px; }
.side-foot a:hover { color: #fff; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 26px; position: sticky; top: 0; z-index: 20; }
.crumb-txt { font-size: 15px; font-weight: 600; }
.admin-user { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--ink2); }
.admin-user .logout { color: var(--red); }
.side-toggle { display: none; border: 0; background: none; font-size: 20px; padding: 4px; }
.admin-content { padding: 26px; flex: 1; }
.admin-footer { padding: 16px 26px; font-size: 12px; color: var(--ink3); border-top: 1px solid var(--line); background: #fff; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; line-height: 1.4; margin-bottom: 6px; }
.page-head p { font-size: 13px; color: var(--ink3); max-width: 820px; line-height: 1.8; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 20px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; }

/* ---------- 表格 ---------- */
.table { font-size: 13px; }
.table th { background: var(--pale); color: var(--ink2); font-weight: 600; text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid #f0ece8; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfaf8; }
.table .empty { text-align: center; color: var(--ink3); padding: 36px 14px; }
.table .ops { white-space: nowrap; }
.table-thumb { width: 56px; height: 40px; object-fit: cover; border: 1px solid var(--line); background: var(--pale); }
.inline-form { display: inline-block; margin-left: 6px; }
.kv-table td:first-child { width: 140px; color: var(--ink3); }

/* ---------- 筛选 / 表单 ---------- */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .select { width: auto; min-width: 140px; }
.filter-bar .input { width: 200px; }
.filter-total { margin-left: auto; font-size: 12px; color: var(--ink3); }
.input, .select, .textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px; background: #fff; outline: none; font-size: 13px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--red); }
.textarea { resize: vertical; line-height: 1.8; }
.textarea.rich { min-height: 240px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field .req { color: var(--red); font-style: normal; }
.field-hint { font-size: 12px; color: var(--ink3); margin-top: 6px; line-height: 1.7; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; padding: 22px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 12px; background: #fcfbfa; }
.switch-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; cursor: pointer; }
.switch-line input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--red); }
.img-field { display: grid; gap: 9px; }
.img-preview { max-width: 220px; max-height: 140px; object-fit: contain; border: 1px solid var(--line); background: var(--pale); padding: 5px; }
.site-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.site-tabs a { padding: 10px 18px; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.site-tabs a.on { color: var(--red); border-color: var(--red); font-weight: 600; }
.narrow-panel { max-width: 520px; }
.narrow-panel form { padding: 22px; }

/* ---------- 仪表盘 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 18px; display: flex; flex-direction: column; gap: 4px; transition: .2s; }
.stat-card:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.06); }
.stat-card .stat-ico { width: 28px; height: 28px; display: grid; place-items: center; background: #f9eeee; color: var(--red); font-size: 12px; border-radius: 2px; margin-bottom: 6px; }
.stat-card b { font-size: 26px; font-family: Georgia, serif; line-height: 1.2; }
.stat-card > span:last-child { font-size: 12px; color: var(--ink3); }
.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; }
.quick-list { padding: 8px 20px 18px; }
.quick-list a { display: block; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.quick-list a:last-child { border-bottom: 0; }
.quick-list b { display: block; font-size: 14px; margin-bottom: 2px; }
.quick-list span { font-size: 12px; color: var(--ink3); }

/* ---------- 媒体库 ---------- */
.upload-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 20px; }
.media-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.media-item { background: #fff; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.media-item > img { width: 100%; height: 150px; object-fit: contain; background: var(--pale); padding: 8px; }
.media-meta { padding: 10px 12px; display: grid; gap: 6px; font-size: 12px; }
.media-meta code { display: block; font-size: 10px; color: var(--ink3); word-break: break-all; max-height: 28px; overflow: hidden; }
.media-meta form { display: block; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; margin: 20px 0 6px; font-size: 13px; }
.pager a, .pager .cur { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.pager a:hover { border-color: var(--red); }
.pager .cur { background: var(--red); border-color: var(--red); color: #fff; }
.pager-info { color: var(--ink3); font-size: 12px; margin-left: 8px; }

/* ---------- 登录页 ---------- */
.login-body { background: #171314; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-visual { position: relative; background: linear-gradient(135deg, #231012, #7a151b 65%, #b81c22); color: #fff; display: flex; align-items: center; padding: 60px; overflow: hidden; }
.login-visual::after { content: ""; position: absolute; right: -160px; bottom: -160px; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 80px rgba(255,255,255,.035), 0 0 0 160px rgba(255,255,255,.025); }
.login-visual-inner { position: relative; z-index: 2; max-width: 480px; }
.login-visual-inner img { width: 190px; margin-bottom: 56px; }
.login-visual-inner .eyebrow { color: rgba(255,255,255,.72); }
.login-visual-inner h1 { font-size: clamp(34px, 4vw, 54px); line-height: 1.35; margin: 18px 0; letter-spacing: .06em; }
.login-visual-inner p { color: rgba(255,255,255,.78); font-size: 15px; }
.login-line { width: 70px; height: 3px; background: #fff; margin: 34px 0 18px; }
.login-visual-inner small { color: rgba(255,255,255,.6); letter-spacing: .08em; }
.login-panel { background: #fff; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-box { width: min(380px, 100%); }
.login-box h2 { font-size: 27px; margin: 10px 0 6px; }
.login-box > p { font-size: 13px; margin-bottom: 28px; }
.login-box .field { margin-bottom: 18px; }
.login-box .input { padding: 12px 13px; font-size: 14px; }
.login-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; font-size: 12px; color: var(--ink3); }

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
  .stat-cards { grid-template-columns: repeat(3, 1fr); }
  .media-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: -224px; z-index: 40; transition: left .25s; }
  .sidebar.open { left: 0; }
  .side-toggle { display: block; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}
@media (max-width: 640px) {
  .admin-content { padding: 16px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-top { padding: 0 14px; }
  .admin-user a { display: none; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}
