/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #1f5fa8;
    --primary-dark: #174a85;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 14px;
    --shadow: 0 2px 12px rgba(31, 63, 108, .08);
}
body {
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ============ 顶部 ============ */
.hero {
    background: linear-gradient(135deg, #1f5fa8 0%, #2b7cc4 100%);
    color: #fff;
    padding: 48px 0 40px;
}
.hero h1 { font-size: 30px; letter-spacing: 1px; }
.hero p { margin-top: 10px; opacity: .9; font-size: 15px; }

/* ============ 工具栏 ============ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.toolbar .count { color: var(--muted); font-size: 14px; }
.toolbar a.admin-link {
    font-size: 13px; color: var(--muted);
    border: 1px solid var(--border); background: #fff;
    padding: 6px 14px; border-radius: 8px;
}
.toolbar a.admin-link:hover { color: var(--primary); border-color: var(--primary); }

/* ============ 卡片网格 ============ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding-bottom: 50px;
}
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(31, 63, 108, .14); }

.card-head { display: flex; gap: 16px; align-items: center; }
.icon {
    width: 60px; height: 60px; border-radius: 14px;
    background: #eaf2fb; color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 700; flex-shrink: 0;
    overflow: hidden;
}
.icon img { width: 100%; height: 100%; object-fit: cover; }
.card-title { flex: 1; min-width: 0; }
.card-title h3 { font-size: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-mini { padding: 4px 12px; font-size: 12px; border-radius: 7px; }
.tags { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    font-size: 12px; color: var(--primary); background: #eaf2fb;
    padding: 2px 10px; border-radius: 20px;
}
.tag.gray { color: var(--muted); background: #f1f3f5; }
.tag.price { color: #dc6a16; background: #fff3e8; font-weight: 600; }

.card-intro {
    margin: 16px 0 18px; color: var(--muted); font-size: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 44px;
}
.card-foot {
    margin-top: auto; display: flex; flex-direction: column; align-items: stretch; gap: 10px;
}
.card-foot .meta { font-size: 12px; color: var(--muted); }
.foot-btns { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 10px; justify-content: flex-end; }
.foot-btns .btn { flex: 0 0 auto; white-space: nowrap; }
.btn {
    display: inline-block; background: var(--primary); color: #fff;
    padding: 9px 18px; border-radius: 9px; font-size: 14px;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

.empty {
    text-align: center; color: var(--muted); padding: 80px 0; font-size: 15px;
}

/* ============ 详情页 ============ */
.detail { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px; margin: 28px 0 50px; }
.detail-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.detail-head h2 { font-size: 24px; }
.detail-body { margin-top: 22px; white-space: pre-wrap; font-size: 15px; color: #374151; }
.detail-meta { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border); display: flex; gap: 24px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.detail-actions { margin-top: 24px; display: flex; flex-direction: row; flex-wrap: nowrap; gap: 12px; }
.detail-actions .btn { flex: 0 0 auto; white-space: nowrap; }
.back-link { display: inline-block; margin: 24px 0 0; color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--primary); }

/* ============ 页脚 ============ */
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 0; border-top: 1px solid var(--border); }
footer a { color: var(--primary); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ============ 后台通用 ============ */
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: 26px 20px; }
.admin-topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 22px;
}
.admin-topbar h2 { font-size: 22px; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 10px; border-bottom: 1px solid var(--border); font-size: 14px; text-align: left; }
.table th { color: var(--muted); font-weight: 600; }
.table td .op a { margin-right: 12px; font-size: 13px; }
.op-edit { color: var(--primary); }
.op-del { color: #dc2626; }
.badge-on { color: #16a34a; }
.badge-off { color: var(--muted); }

.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 600; }
.form-row input[type=text], .form-row input[type=password], .form-row input[type=number],
.form-row input[type=url], .form-row select, .form-row textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; font-family: inherit;
}
.form-row textarea { min-height: 110px; resize: vertical; }
.form-row .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-actions { margin-top: 24px; display: flex; gap: 12px; }

/* 登录页 */
.login-box { max-width: 380px; margin: 80px auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.login-box h2 { text-align: center; margin-bottom: 22px; }
.alert { padding: 11px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 16px; }
.alert.err { background: #fef2f2; color: #dc2626; }
.alert.ok { background: #f0fdf4; color: #16a34a; }

/* ============ 演示视频区 ============ */
.video-section { margin: 28px 0 6px; }
.section-title { font-size: 20px; margin-bottom: 16px; }
.video-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
}
.video-card {
    flex: 0 0 280px;
    max-width: 280px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform .15s ease, box-shadow .15s ease;
}
.video-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(31, 63, 108, .14); }
.video-card.no-url { cursor: default; opacity: .65; }
.video-cover { position: relative; aspect-ratio: 16 / 9; background: #0f172a; }
.video-cover img { width: 100%; height: 100%; object-fit: cover; }
.video-cover-ph { color: #94a3b8; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 14px; }
.play-badge {
    position: absolute; inset: 0; margin: auto;
    width: 54px; height: 54px; border-radius: 50%;
    background: rgba(31, 95, 168, .88); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.video-title { padding: 13px 16px; font-size: 15px; font-weight: 600; }

/* 视频播放弹窗 */
.video-mask {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .78);
    z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.video-modal { width: min(860px, 100%); background: #111; border-radius: 14px; overflow: hidden; }
.video-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: #fff; }
.video-close { background: none; border: none; color: #fff; font-size: 26px; cursor: pointer; line-height: 1; }
.video-player { aspect-ratio: 16 / 9; background: #000; }

@media (max-width: 600px) {
    .hero { padding: 34px 0 28px; }
    .hero h1 { font-size: 23px; }
    .grid { grid-template-columns: 1fr; }
    .video-card { flex: 0 0 240px; max-width: 240px; }
}

/* 横向滚动条美化 */
.video-grid::-webkit-scrollbar { height: 8px; }
.video-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.video-grid::-webkit-scrollbar-track { background: transparent; }

/* ============ 购买授权页 ============ */
.purchase-box { max-width: 520px; margin: 28px auto 50px; text-align: center; }
.purchase-title { font-size: 22px; margin-bottom: 12px; }
.purchase-meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.qr-wrap {
    display: inline-block; background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px; margin: 0 auto;
}
.qr-img { width: 240px; height: 240px; object-fit: contain; border-radius: 8px; }
.qr-tip { margin-top: 12px; font-size: 14px; color: var(--text); font-weight: 600; }
.purchase-notes {
    margin: 24px auto 0; max-width: 420px; text-align: left;
    color: var(--muted); font-size: 13px; line-height: 1.9;
}
.purchase-box .detail-actions { justify-content: center; margin-top: 26px; }

/* 购买页联系方式 */
.contact-box {
    margin: 22px auto 0; max-width: 420px;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; text-align: left;
}
.contact-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; text-align: center; }
.contact-list { display: flex; flex-direction: row; flex-wrap: wrap; gap: 10px 26px; justify-content: center; }
.contact-item { display: flex; gap: 6px; align-items: baseline; padding: 4px 0; font-size: 14px; }
.contact-label { flex: 0 0 auto; color: var(--muted); }
.contact-value { font-weight: 600; color: var(--text); word-break: break-all; }
a.contact-value { text-decoration: none; }
a.contact-value:hover { color: var(--primary); }

@media (max-width: 600px) {
    .qr-img { width: 200px; height: 200px; }
}
