/* ============================================================
   宝宝成长记录网站 · 后台样式
   ============================================================ */

:root {
    --pink: #f09ab4;
    --pink-deep: #e07d9c;
    --pink-soft: #fdeaf0;
    --gold-soft: #fdf3e0;
    --ink: #49363f;
    --ink-soft: #8a7480;
    --line: #f0e0e6;
    --bg: #fbf4f1;
}

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

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg); color: var(--ink); line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--pink-deep); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- 布局 ---------- */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px; flex: none; background: #fff;
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.side-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 22px; font-weight: 800; font-size: 1.05rem;
    border-bottom: 1px solid var(--line);
}
.side-logo { width: 38px; height: 38px; display: grid; place-items: center; background: var(--pink-soft); border-radius: 12px; font-size: 1.2rem; }

.side-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
    padding: 10px 16px; border-radius: 12px; font-size: 0.96rem; color: var(--ink-soft); font-weight: 500;
}
.side-nav a:hover { background: var(--pink-soft); color: var(--pink-deep); }
.side-nav a.active { background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff; }

.side-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 0.9rem; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 18px 28px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 1.25rem; }
.topbar .who { color: var(--ink-soft); font-size: 0.92rem; }
.admin-content { padding: 26px 28px 60px; }

/* ---------- 登录页 ---------- */
.login-body {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(243,189,107,0.35) 0, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(240,154,180,0.4) 0, transparent 42%),
        linear-gradient(160deg, #ffeef4, #fff6ea);
}
.login-card {
    width: min(400px, 92vw); background: #fff; border-radius: 24px;
    padding: 40px 36px; box-shadow: 0 18px 50px rgba(224,125,156,0.2); text-align: center;
}
.login-logo {
    width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px;
    background: linear-gradient(135deg, var(--pink), var(--pink-deep));
    display: grid; place-items: center; font-size: 1.8rem; color: #fff;
    box-shadow: 0 8px 22px rgba(224,125,156,0.35);
}
.login-card h1 { font-size: 1.3rem; }
.login-sub { color: var(--ink-soft); margin: 6px 0 22px; font-size: 0.95rem; }
.login-tip { margin-top: 18px; font-size: 0.88rem; }

/* ---------- 组件 ---------- */
.alert {
    background: #fdeeee; border: 1px solid #f4c2c2; color: #c4453f;
    border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 0.95rem;
}
.alert-ok { background: #eefaf1; border-color: #bfe6cd; color: #2c7a4b; }

.panel {
    background: #fff; border-radius: 18px; padding: 24px;
    box-shadow: 0 4px 16px rgba(224,125,156,0.08); margin-bottom: 22px;
}
.panel-title { font-weight: 800; font-size: 1.05rem; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 20px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.form-row input[type="text"], .form-row input[type="password"], .form-row input[type="date"],
.form-row input[type="number"], .form-row select, .form-row textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 10px;
    font-size: 0.95rem; font-family: inherit; background: #fff; outline: none;
    transition: border-color 0.2s ease;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--pink); }
.form-row input[type="file"] { font-size: 0.9rem; }
.hint { color: var(--ink-soft); font-size: 0.82rem; margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 11px 24px; border-radius: 999px; border: none;
    font-size: 0.95rem; font-weight: 600; font-family: inherit;
    background: linear-gradient(135deg, var(--pink), var(--pink-deep)); color: #fff;
    box-shadow: 0 4px 14px rgba(224,125,156,0.25); transition: transform 0.15s ease;
}
.btn:hover { transform: translateY(-1px); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 14px; font-size: 0.86rem; }
.btn-ghost { background: #fff; color: var(--pink-deep); border: 1.5px solid var(--pink); box-shadow: none; }
.btn-ghost:hover { background: var(--pink-soft); color: var(--pink-deep); }
.btn-danger { background: #fff; color: #d06060; border: 1.5px solid #ecc; box-shadow: none; }
.btn-danger:hover { background: #fdf0f0; }

/* ---------- 仪表盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: #fff; border-radius: 18px; padding: 22px; box-shadow: 0 4px 16px rgba(224,125,156,0.08);
    transition: transform 0.2s ease;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-num { font-size: 2.2rem; font-weight: 900; background: linear-gradient(135deg, var(--pink-deep), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { color: var(--ink-soft); font-size: 0.92rem; margin-top: 4px; }

.pending-item {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 14px 0; border-bottom: 1px solid var(--line);
}
.pending-item:last-child { border-bottom: none; }
.pending-item p { color: var(--ink-soft); font-size: 0.93rem; margin-top: 4px; }
.quick-list { padding-left: 20px; color: var(--ink-soft); }
.quick-list li { margin-bottom: 8px; }

/* ---------- 表格 / 列表 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--ink-soft); font-weight: 600; font-size: 0.88rem; }
.ops { white-space: nowrap; display: flex; gap: 8px; flex-wrap: wrap; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.admin-photo { background: #fdf8f6; border-radius: 14px; padding: 10px; }
.admin-photo .thumb { aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.admin-photo .thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-photo .meta b { display: block; font-size: 0.92rem; }
.admin-photo .ops { margin-top: 8px; }

.msg-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 14px 0; border-bottom: 1px solid var(--line);
}
.msg-row:last-child { border-bottom: none; }
.msg-pending { background: #fffdf5; }
.msg-body p { color: var(--ink-soft); margin-top: 4px; font-size: 0.93rem; }
.tag { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.tag-ok { background: #eefaf1; color: #2c7a4b; }
.tag-wait { background: #fdf3e0; color: #9a6a1f; }

.file-preview { margin-top: 10px; display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: 0.9rem; }
.file-preview img { width: 90px; height: 68px; object-fit: cover; border-radius: 8px; }

.muted { color: var(--ink-soft); }

/* 手机/窄屏：左侧竖排全部功能项，右侧内容正常展示（不折叠、不后退即可切换） */
@media (max-width: 900px) {
    body { overflow-x: hidden; }
    .admin-wrap { flex-direction: row; }

    .sidebar {
        width: 152px; flex: none;
        height: 100vh; height: 100dvh; position: sticky; top: 0;
        flex-direction: column; align-items: stretch;
        border-right: 1px solid var(--line); border-bottom: none;
        overflow-y: auto;
    }
    .side-brand { padding: 12px 10px; border-bottom: 1px solid var(--line); }
    .side-brand .side-logo { width: 30px; height: 30px; font-size: 1rem; }
    .side-brand span:last-child { font-size: 0.76rem; line-height: 1.3; }

    .side-nav { flex-direction: column; align-items: stretch; padding: 8px 8px; gap: 2px; }
    .side-nav a { font-size: 0.88rem; padding: 10px 8px; text-align: center; }
    .side-nav a::after { content: none; }

    .side-foot { flex-direction: column; align-items: stretch; gap: 4px; padding: 10px 8px; font-size: 0.88rem; }

    .admin-main { flex: 1; min-width: 0; overflow-x: hidden; }
    .topbar { padding: 12px; }
    .topbar h1 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar .who { font-size: 0.78rem; }

    .admin-content { padding: 14px 12px 40px; min-width: 0; }
    .stat-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 16px 18px; }
    .panel { padding: 18px; }
    .form-grid { grid-template-columns: 1fr; }
    .msg-row { flex-direction: column; gap: 8px; }
    .table { font-size: 0.82rem; }
}
