/* =============================================================
   HTML 展厅 · 后台管理样式
   ============================================================= */

.admin-body { background: #f0f2f8; }

/* ---------- 登录页 ---------- */
.admin-login {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #eef1f9 0%, #e6ebf7 50%, #eef0f8 100%);
}
.login-card {
    background: #fff; border-radius: 18px; box-shadow: 0 12px 48px rgba(26, 41, 82, .10);
    padding: 40px; width: 100%; max-width: 400px;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.login-card h1 { font-size: 21px; text-align: center; margin-bottom: 6px; }
.login-card h1 svg { width: 20px; height: 20px; vertical-align: -3px; margin-right: 4px; color: var(--warn); }
.login-card .sub { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.login-card input {
    width: 100%; border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 14px; font-size: 14px; outline: none; background: var(--bg);
    transition: border .15s, background .15s;
}
.login-card input:focus { border-color: var(--primary); background: #fff; }
.btn-login {
    width: 100%; margin-top: 22px; background: var(--primary); color: #fff;
    border: none; border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background .15s; display: block; text-decoration: none;
}
.btn-login:hover { background: var(--primary-hover); }
.btn-login:disabled { opacity: .65; cursor: not-allowed; }
.back-home { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.back-home:hover { color: var(--primary); }
.login-tip {
    display: flex; align-items: center; gap: 8px; background: #fff7ed; color: #9a3412;
    border: 1px solid #fed7aa; border-radius: 9px; padding: 9px 13px; font-size: 13px; margin-bottom: 8px;
}
.login-tip svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------- 布局 ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-side {
    width: 216px; flex-shrink: 0; background: #161923; color: #c6cbdd;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-logo {
    display: flex; align-items: center; gap: 10px; padding: 18px 20px;
    font-weight: 700; font-size: 15px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07);
}
.side-nav { padding: 12px; display: grid; gap: 3px; flex: 1; }
.side-nav button {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 10px 13px; border-radius: 9px; font-size: 14px; color: #a6abc0;
    transition: all .15s; font-weight: 500;
}
.side-nav button svg { width: 16px; height: 16px; flex-shrink: 0; }
.side-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav button.active { background: var(--primary); color: #fff; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: 3px; }
.side-foot a, .side-foot button {
    display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 9px;
    font-size: 13px; color: #8f95ab; transition: all .15s;
}
.side-foot a:hover, .side-foot button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-foot svg { width: 15px; height: 15px; }

.admin-main { flex: 1; padding: 30px 34px 60px; min-width: 0; }
.adm-head { margin-bottom: 22px; }
.adm-head h1 { font-size: 21px; font-weight: 800; }
.adm-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.adm-loading { padding: 60px; text-align: center; color: var(--muted); font-size: 14px; }
.adm-error {
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    border-radius: 11px; padding: 16px 18px; font-size: 14px;
}

/* ---------- 统计卡片 ---------- */
.stat-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); margin-bottom: 22px; }
.stat-card {
    background: #fff; border: 1px solid var(--border); border-radius: 13px; padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(26,29,48,.04);
}
.stat-card .sc-icon {
    width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center;
    justify-content: center; margin-bottom: 10px;
}
.stat-card .sc-icon svg { width: 17px; height: 17px; }
.stat-card.c-primary .sc-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.c-pink .sc-icon { background: var(--like-light); color: var(--like); }
.stat-card.c-purple .sc-icon { background: var(--forward-light); color: var(--forward); }
.stat-card.c-sky .sc-icon { background: #e0f2fe; color: var(--view); }
.stat-card.c-green .sc-icon { background: #d1fae5; color: var(--download); }
.stat-card.c-amber .sc-icon { background: #fef3c7; color: var(--warn); }
.stat-card .sc-v { font-size: 23px; font-weight: 800; line-height: 1.15; }
.stat-card .sc-k { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 面板 ---------- */
.adm-panels { display: grid; gap: 16px; grid-template-columns: 1.6fr 1fr; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 13px; padding: 20px; min-width: 0; }
.panel h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel h2 svg { width: 16px; height: 16px; color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 13px; overflow: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.adm-table th {
    text-align: left; padding: 11px 14px; background: #f8f9fc; color: var(--muted);
    font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.adm-table td { padding: 12px 14px; border-bottom: 1px solid #f1f2f7; vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover { background: #fafbfe; }
.adm-table .tt { min-width: 180px; }
.f-title { font-weight: 600; color: var(--text); }
.f-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adm-table .acts { white-space: nowrap; }
.adm-table .acts .icon-btn { width: 30px; height: 30px; }
.adm-table .acts .icon-btn:hover { background: var(--primary-light); color: var(--primary); }
.adm-table .acts .icon-btn.danger:hover { background: var(--like-light); color: var(--like); }
.mini-badge { font-size: 11px; border-radius: 5px; padding: 1px 7px; margin-left: 6px; font-weight: 600; }
.mini-badge.pin { background: #fef3c7; color: #b45309; }
.mini-badge.draft { background: #e5e9f2; color: #64748b; }
.rank-no {
    display: inline-flex; width: 24px; height: 24px; border-radius: 7px; align-items: center;
    justify-content: center; font-size: 12.5px; font-weight: 800; background: var(--bg); color: var(--muted);
    font-family: Consolas, monospace;
}
.rank-no.top1 { background: linear-gradient(135deg, #ffd76e, #f5a623); color: #fff; }
.rank-no.top2 { background: linear-gradient(135deg, #d7dde8, #aeb8c9); color: #fff; }
.rank-no.top3 { background: linear-gradient(135deg, #f0b78e, #d68b5c); color: #fff; }

/* ---------- 工具栏 ---------- */
.adm-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.adm-toolbar input, .adm-toolbar select {
    border: 1px solid var(--border); border-radius: 9px; padding: 8px 13px;
    font-size: 13.5px; outline: none; background: #fff; min-width: 180px;
}
.adm-toolbar input:focus, .adm-toolbar select:focus { border-color: var(--primary); }
.btn-sm { padding: 8px 15px; font-size: 13px; border-radius: 9px; }

/* ---------- 表单 ---------- */
.adm-form { background: #fff; border: 1px solid var(--border); border-radius: 13px; padding: 22px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-row input, .form-row textarea, .form-row select {
    width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 9px 13px;
    font-size: 14px; outline: none; background: var(--bg); transition: border .15s, background .15s;
    font-family: inherit;
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--primary); background: #fff; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-acts { display: flex; gap: 10px; margin-top: 6px; }
.tip-box {
    margin-top: 16px; background: #f8faff; border: 1px dashed #cdd8f6; color: var(--text-2);
    border-radius: 9px; padding: 11px 14px; font-size: 12.8px; line-height: 1.7;
}

/* ---------- 上传区 ---------- */
.upload-area {
    border: 2px dashed #c9d2ea; border-radius: 14px; background: #fff;
    padding: 44px 20px; text-align: center; cursor: pointer; transition: all .18s;
}
.upload-area:hover, .upload-area.over { border-color: var(--primary); background: #f7f9ff; }
.dz-icon {
    width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
}
.dz-icon svg { width: 24px; height: 24px; }
.dz-title { font-size: 15px; font-weight: 600; }
.dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.file-picked {
    display: flex; align-items: center; gap: 10px; margin-top: 12px;
    background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
    border-radius: 10px; padding: 11px 15px; font-size: 13.5px;
}
.file-picked svg { width: 16px; height: 16px; flex-shrink: 0; }
.file-picked span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-clear { color: #065f46; opacity: .6; display: flex; padding: 4px; border-radius: 6px; }
.dz-clear:hover { opacity: 1; background: rgba(6,95,70,.1); }
.dz-clear svg { width: 14px; height: 14px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15, 18, 30, .5); z-index: var(--z-modal);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    animation: fadeIn .18s;
}
.modal {
    background: #fff; border-radius: 15px; width: 100%; max-width: 520px;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.3); animation: popIn .2s;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 22px; border-top: 1px solid var(--border);
}

/* ---------- 快捷操作 ---------- */
.quick-acts { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
    .adm-panels { grid-template-columns: 1fr; }
    .admin-side { width: 68px; }
    .side-logo span:last-child, .side-nav button span, .side-nav button { font-size: 0; }
    .side-nav button { justify-content: center; }
    .side-foot a, .side-foot button { justify-content: center; font-size: 0; }
    .admin-main { padding: 22px 18px 50px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 手机端（≤640px）：侧边栏 → 底部 Tab Bar ---------- */
.mobile-topbar { display: none; }

@media (max-width: 640px) {
    .mobile-topbar {
        display: flex; justify-content: flex-end; gap: 8px;
        margin: -4px 0 14px;
    }
    .mobile-topbar a, .mobile-topbar button {
        display: inline-flex; align-items: center; gap: 5px;
        font-size: 12px; color: var(--text-2);
        background: #fff; border: 1px solid var(--border); border-radius: 999px;
        padding: 5px 12px;
    }
    .mobile-topbar svg { width: 13px; height: 13px; }
}

@media (max-width: 640px) {
    .admin-body { background: var(--bg); }
    .admin-layout { flex-direction: column; }

    /* 侧边栏变成底部固定 tab bar */
    .admin-side {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: var(--z-tabbar);
        width: 100%; height: auto; flex-shrink: 0;
        flex-direction: row; align-items: stretch;
        background: #fff; border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .side-logo { display: none; }
    .side-nav {
        padding: 4px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0; flex: 1; min-width: 0;
    }
    .side-nav button {
        flex-direction: column; align-items: center; gap: 3px;
        padding: 8px 0; border-radius: 10px; font-size: 10.5px;
        color: var(--muted); background: transparent;
        min-width: 0; overflow: hidden;
    }
    .side-nav button span {
        max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .side-nav button svg { width: 19px; height: 19px; stroke-width: 1.8; }
    .side-nav button span { font-size: 10.5px !important; }
    .side-nav button.active {
        background: transparent; color: var(--text);
    }
    .side-foot { display: none; }  /* 退出/前台入口在 admin-head 里没有，先隐藏 */

    .admin-main {
        padding: 18px 14px calc(70px + env(safe-area-inset-bottom, 0px) + 16px);
    }
    .adm-head { margin-bottom: 16px; }
    .adm-head h1 { font-size: 19px; }

    /* 统计卡片 2 列 */
    .stat-cards { gap: 10px; }
    .stat-card { padding: 13px 14px; }
    .stat-card .sc-v { font-size: 19px; }
    .stat-card .sc-icon { width: 30px; height: 30px; margin-bottom: 8px; }

    /* 面板单列 */
    .adm-panels { gap: 12px; grid-template-columns: minmax(0, 1fr); }
    .panel { padding: 16px; overflow: hidden; }
    .table-wrap { max-width: 100%; }

    /* 表单双列变单列 */
    .form-row-2 { grid-template-columns: 1fr; gap: 0; }
    .form-row { margin-bottom: 14px; }

    /* 工具栏允许横向滚动 */
    .adm-toolbar { gap: 8px; }
    .adm-toolbar input, .adm-toolbar select { min-width: 0; flex: 1; }

    /* 表格更紧凑，允许横滚 */
    .table-wrap { border-radius: 10px; }
    .adm-table th, .adm-table td { padding: 10px 10px; font-size: 13px; }
    .adm-table .tt { min-width: 140px; }

    /* 上传区紧凑 */
    .upload-area { padding: 28px 16px; }

    /* 弹窗全屏化 */
    .modal-mask { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%; width: 100%; max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }

    /* 登录卡片紧凑 */
    .admin-login { padding: 16px; }
    .login-card { padding: 28px 22px; border-radius: 14px; }
}

