/* =========================================================
   AI学业规划师 登记与查询系统 —— 后台管理样式
   ========================================================= */

:root {
    --brand:       #12457b;
    --brand-dark:  #0b2f57;
    --brand-light: #2f6fb5;
    --gold:        #c8963e;
    --ink:         #16202b;
    --text:        #33404f;
    --muted:       #7c8b9c;
    --line:        #e3e9f0;
    --bg:          #eef3f8;
    --card:        #ffffff;
    --ok:          #17915c;
    --warn:        #d98114;
    --danger:      #d64545;
    --radius:      12px;
    --shadow:      0 6px 22px rgba(18, 69, 123, .08);
    --sidebar-w:   224px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }

/* ============ 登录页 ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(900px 420px at 20% -10%, rgba(200, 150, 62, .30), transparent 60%),
        linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 55%, #1a6bb0 100%);
}
.login-box {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 34px 28px 28px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, .3);
}
.login-box h1 {
    margin: 0 0 4px;
    font-size: 21px;
    text-align: center;
    color: var(--brand-dark);
}
.login-box .sub {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 22px;
    letter-spacing: 1px;
}
.login-logo {
    width: 56px; height: 56px;
    margin: 0 auto 12px;
    border-radius: 14px;
    background: linear-gradient(140deg, var(--brand) 0%, var(--brand-light) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    line-height: 0;
}
.login-logo svg { width: 32px; height: 32px; display: block; }
.login-tip { margin-top: 16px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ============ 后台布局 ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--brand-dark);
    color: rgba(255, 255, 255, .82);
    display: flex;
    flex-direction: column;
}
.sidebar .s-head {
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.sidebar .s-head b { color: #fff; font-size: 16px; display: block; }
.sidebar .s-head span { font-size: 12px; opacity: .6; letter-spacing: 1px; }
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 9px;
    color: rgba(255, 255, 255, .8);
    font-size: 14.5px;
    margin-bottom: 4px;
    transition: .18s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--gold); color: #3d2a06; font-weight: 700; }
.sidebar nav a i { width: 18px; text-align: center; font-style: normal; }
.sidebar .s-foot {
    padding: 12px 16px 18px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: 12.5px;
}
.sidebar .s-foot a { color: rgba(255, 255, 255, .7); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 0 22px;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar h2 { margin: 0; font-size: 18px; color: var(--ink); }
.topbar .who { font-size: 13px; color: var(--muted); }

.content { padding: 20px 22px 40px; }

/* ============ 卡片 / 统计 ============ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    overflow: hidden;
}
.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 16px; color: var(--ink); }
.card-body { padding: 18px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 27px; font-weight: 800; color: var(--brand); line-height: 1.3; }
.stat.gold .value { color: var(--gold); }
.stat.green .value { color: var(--ok); }
.stat.orange .value { color: var(--warn); }

/* ============ 工具条 ============ */
.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}
.toolbar input.control, .toolbar select.control { width: auto; min-width: 150px; }
.toolbar .spacer { flex: 1; }

.control {
    padding: 9px 12px;
    border: 1px solid #d6dfea;
    border-radius: 8px;
    background: #fbfcfe;
    outline: none;
    transition: .18s;
    width: 100%;
}
.control:focus { border-color: var(--brand-light); background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 181, .14); }
textarea.control { resize: vertical; min-height: 66px; }
select.control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237c8b9c' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}

/* ============ 按钮 ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 0; border-radius: 8px; padding: 9px 18px;
    font-size: 14px; font-weight: 600; cursor: pointer; transition: .18s; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-gold { background: linear-gradient(135deg, var(--gold) 0%, #e2b45f 100%); color: #4a3208; }
.btn-ghost { background: #fff; border: 1px solid #cfdae6; color: var(--brand); }
.btn-ghost:hover { border-color: var(--brand-light); background: #f5f9ff; }
.btn-danger { background: #fff; border: 1px solid #f0bcbc; color: var(--danger); }
.btn-danger:hover { background: #fdf2f2; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============ 表格 ============ */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 760px; }
table.data th, table.data td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: 13.5px;
}
table.data th { background: #f6f9fc; color: var(--ink); font-weight: 700; white-space: nowrap; }
table.data tbody tr:hover { background: #f8fbff; }
table.data td.nowrap { white-space: nowrap; }
td.ops { white-space: nowrap; }
td.ops .btn { margin-right: 5px; }

.t-photo { width: 40px; height: 52px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: #eef2f7; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-pending  { background: #fff4e2; color: #b26b06; }
.badge-passed   { background: #e7f7ef; color: #12824f; }
.badge-rejected { background: #fdecec; color: #b83636; }
.badge-gray     { background: #eef1f5; color: #6b7887; }

.empty { padding: 42px 16px; text-align: center; color: var(--muted); }

/* ============ 分页 ============ */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 18px; flex-wrap: wrap; }
.pager .info { color: var(--muted); font-size: 13px; margin-right: auto; }
.pager button {
    min-width: 34px; padding: 6px 11px;
    border: 1px solid #d6dfea; background: #fff; border-radius: 7px; cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: var(--brand-light); color: var(--brand); }
.pager button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 弹窗 ============ */
.modal-mask {
    position: fixed; inset: 0; background: rgba(10, 24, 40, .55);
    display: none; align-items: flex-start; justify-content: center;
    z-index: 100; padding: 40px 16px; overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 760px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: pop .22s ease both;
}
.modal.sm { max-width: 440px; }
@keyframes pop { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.modal-head {
    padding: 15px 20px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 17px; color: var(--ink); }
.modal-head .x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot {
    padding: 14px 20px; border-top: 1px solid var(--line);
    display: flex; justify-content: flex-end; gap: 10px;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field > label.uploader { font-weight: 400; font-size: 13.5px; color: var(--muted); }
.field label .req { color: var(--danger); }
.field .tip { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ============ 上传 ============ */
.uploader {
    display: block; border: 1.5px dashed #c3d0de; border-radius: 9px; background: #fbfcfe;
    padding: 16px; text-align: center; cursor: pointer; transition: .18s;
    font-size: 13.5px; font-weight: 400; color: var(--muted);
}
.uploader:hover, .uploader.dragover { border-color: var(--brand-light); background: #f3f8ff; }
.uploader b { color: var(--brand-light); }

.image-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.image-item {
    border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; position: relative;
}
.image-item img { width: 100%; height: 106px; object-fit: cover; background: #eef2f7; cursor: zoom-in; }
.image-item .del {
    position: absolute; top: 5px; right: 5px;
    width: 24px; height: 24px; line-height: 22px; text-align: center;
    border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff;
    cursor: pointer; font-size: 15px; padding: 0;
}
.image-item .del:hover { background: var(--danger); }
.image-item .nm {
    font-size: 11.5px; color: var(--muted); padding: 5px 7px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.image-item .img-cap {
    display: block; width: 100%; box-sizing: border-box;
    border: 0; border-top: 1px solid var(--line);
    padding: 6px 7px; font-size: 12px; font-family: inherit;
    color: var(--ink); background: #fff; outline: none;
}
.image-item .img-cap::placeholder { color: #a9b6c5; }
.image-item .img-cap:focus { background: #f5f9ff; box-shadow: inset 0 0 0 1px var(--brand-light); }

/* ============ 提示 ============ */
.alert { display: none; padding: 11px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; border: 1px solid transparent; }
.alert.show { display: block; }
.alert-error { background: #fdeeee; border-color: #f5c6c6; color: #a33434; }
.alert-success { background: #e9f8f0; border-color: #b7e6cd; color: #12734a; }

.toast {
    position: fixed; top: 22px; left: 50%; transform: translateX(-50%) translateY(-24px);
    background: rgba(22, 32, 43, .94); color: #fff; padding: 11px 22px; border-radius: 8px;
    font-size: 14px; z-index: 300; opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #12824f; }
.toast.err { background: #b83636; }

/* 图片预览 */
.lightbox {
    position: fixed; inset: 0; background: rgba(8, 18, 30, .9);
    display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 96%; max-height: 92%; border-radius: 8px; background: #fff; }
.lightbox .close {
    position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 22px; cursor: pointer; line-height: 1;
}

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex: none; }
    .sidebar .s-head { padding: 12px 14px; }
    .sidebar nav { display: flex; overflow-x: auto; padding: 8px; }
    .sidebar nav a { margin: 0 6px 0 0; white-space: nowrap; }
    .sidebar .s-foot { display: flex; justify-content: space-between; align-items: center; }
    .topbar { padding: 0 14px; }
    .topbar h2 { font-size: 16px; }
    .content { padding: 14px 14px 30px; }
    .card-body { padding: 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .toolbar input.control, .toolbar select.control { width: 100%; }
    .toolbar .spacer { display: none; }
    .toolbar .btn { flex: 1 1 45%; }
    .modal-mask { padding: 16px 10px; }
    .stats { gap: 10px; }
    .stat { padding: 12px 14px; }
    .stat .value { font-size: 22px; }
}
