/* ============================================================
   二维码海报系统 样式
   设计语言：现代浅色（浅灰底 + 白卡片 + 深色主按钮 + 紫色点缀）
   ============================================================ */
:root {
    --accent: #7c3aed;          /* 紫色点缀 */
    --accent-soft: #f5f0ff;
    --ink: #111111;             /* 主文字/主按钮 */
    --ink-2: #374151;
    --muted: #6b7280;
    --line: #e5e7eb;
    --page: #f7f7f8;            /* 页面浅灰底 */
    --card: #ffffff;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
    color: #333;
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.hint { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.mono { font-family: Consolas, monospace; font-size: 12px; color: #777; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: inline-flex; gap: 14px; }
.inline { display: inline; }

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    font-size: 14px;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}
.btn-primary:hover { background: #2a2a2a; }
.btn-danger { background: #fff; border-color: #fecaca; color: #dc2626; }
.btn-danger:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.btn-danger-sm {
    border: 1px solid #fecaca; background: #fff; color: #dc2626;
    border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px;
}
.btn-danger-sm:hover { background: #fef2f2; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.row-btns { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ===== 提示框 ===== */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin: 14px 0; font-size: 14px; }
.alert-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

/* ============================================================
   前台
   ============================================================ */
.site-header {
    background: linear-gradient(135deg, #1e3a8a, #7c3aed);
    color: #fff; padding: 28px 0; text-align: center;
}
.site-header h1 { margin: 0 0 6px; font-size: 26px; }
.site-header .sub { opacity: .85; font-size: 14px; }
.site-footer { text-align: center; padding: 26px 0 40px; color: #999; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; padding: 28px 0; }
.card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; transition: box-shadow .15s, transform .15s; color: #333;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); text-decoration: none; }
.card .thumb { aspect-ratio: 1/1; background: #eee; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-name { padding: 10px 12px; font-size: 14px; text-align: center; }

.empty {
    background: #fff; border: 1px dashed #ccc; border-radius: var(--radius);
    padding: 60px 20px; text-align: center; margin: 28px 0; color: #666;
}
.empty .hint { margin-top: 8px; }

/* 全屏查看页 */
.view-body { background: #0f1115; min-height: 100vh; }
.view-wrap { display: flex; justify-content: center; padding: 24px 12px 8px; }
.view-img {
    max-width: min(92vw, 640px); max-height: 84vh;
    object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5);
    background: #fff;
}
.view-tip { text-align: center; color: #9ca3af; font-size: 13px; padding: 10px 0 4px; }
.view-back { text-align: center; padding: 6px 0 30px; }
.view-back a { color: #93c5fd; }

/* ============================================================
   登录页（参考现代登录卡片：Welcome + 深色全宽按钮）
   ============================================================ */
.login-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: #f1f1f3;
    padding: 20px;
}
.login-card {
    width: 400px; max-width: 100%;
    background: var(--card);
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(16,24,40,.05), 0 24px 60px -20px rgba(16,24,40,.18);
    padding: 36px 32px 28px;
}
.login-head { margin-bottom: 22px; }
.login-logo {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, #6d28d9, #a855f7);
    color: #fff; font-weight: 700; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px; letter-spacing: .5px;
}
.login-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; color: var(--ink); }
.login-sub { margin: 0; font-size: 14px; color: var(--muted); }

.field { margin-bottom: 16px; }
.field label {
    display: block; font-size: 13px; font-weight: 500; color: var(--ink-2);
    margin-bottom: 6px;
}
.field input {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f9fafb;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input::placeholder { color: #9ca3af; }
.field input:focus {
    outline: none; border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .14);
}

.login-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input {
    width: 16px; height: 16px; accent-color: var(--accent);
    cursor: pointer; margin: 0;
}

.btn-signin {
    width: 100%; padding: 12px 16px;
    background: var(--ink); color: #fff;
    border: none; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn-signin:hover { background: #2a2a2a; }
.btn-signin:active { transform: translateY(1px); }

.login-hint { margin: 18px 0 0; text-align: center; font-size: 12px; color: #9ca3af; }

/* ============================================================
   后台管理
   ============================================================ */
.admin-top {
    background: #fff; color: var(--ink);
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.admin-top strong { font-size: 15px; display: inline-flex; align-items: center; gap: 10px; }
.admin-top strong::before {
    content: ""; width: 10px; height: 10px; border-radius: 3px;
    background: linear-gradient(135deg, #6d28d9, #a855f7); display: inline-block;
}
.admin-top a { color: var(--muted); font-size: 13px; }
.admin-top a:hover { color: var(--accent); text-decoration: none; }
.admin-body { padding-bottom: 60px; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin: 18px 0;
    box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.panel h2 {
    margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--ink);
    display: flex; align-items: center; gap: 10px;
}
.panel h2::before {
    content: ""; width: 4px; height: 16px; border-radius: 2px;
    background: var(--accent); display: inline-block;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.preview {
    border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px;
    background: #fafafa; max-width: 360px;
}
.preview img { width: 100%; display: block; }
.preview-name { padding: 8px 10px; font-size: 12px; color: #666; word-break: break-all; }
.empty-preview {
    display: flex; align-items: center; justify-content: center; height: 140px;
    color: #999; border: 1px dashed #ddd; border-radius: 10px; margin-bottom: 14px;
}

.form label { display: block; font-size: 13px; color: #555; margin: 12px 0 4px; }
.form input[type=text], .form input[type=password], .form input[type=number],
.form input[type=file], .form select, .form input[type=color] {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-size: 14px; margin-top: 4px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.form input[type=color] { height: 40px; padding: 4px; width: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }
.checks { display: flex; gap: 24px; margin-top: 16px; }
.checks .check { margin: 0; }

.qr-row { display: flex; gap: 10px; margin-bottom: 10px; }
.qr-row input[type=file] { flex: 1; margin: 0; }
.qr-row input[type=text] { flex: 1; margin: 0; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { border-bottom: 1px solid #f1f2f4; padding: 10px 8px; text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; background: #fafafa; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.table img.mini { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.table form.inline { margin: 0; }
.table button { margin-right: 4px; }

.badge {
    border: none; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12px;
    transition: background .15s;
}
.badge-on { background: #dcfce7; color: #15803d; }
.badge-off { background: #fee2e2; color: #b91c1c; }
