/* ============ 管理后台样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
}
a { text-decoration: none; color: inherit; }

/* ---- 登录页 ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a3a5c 0%, #2980b9 100%);
}
.login-box {
    width: 380px;
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.login-box h1 { font-size: 24px; text-align: center; color: #1a3a5c; }
.login-sub { text-align: center; color: #999; font-size: 12px; margin: 6px 0 28px; letter-spacing: 1px; }
.login-box form { display: flex; flex-direction: column; gap: 16px; }
.login-box label { font-size: 13px; color: #666; display: flex; flex-direction: column; gap: 6px; }
.login-box input {
    padding: 11px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.login-box input:focus { outline: none; border-color: #2980b9; }
.login-box button {
    padding: 12px;
    background: #2980b9;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 6px;
    transition: background .3s;
}
.login-box button:hover { background: #1a6fa0; }
.login-error { color: #e74c3c; font-size: 13px; text-align: center; min-height: 18px; }
.login-tip { font-size: 12px; color: #aaa; text-align: center; margin-top: 16px; }

/* ---- 仪表盘布局 ---- */
.dashboard-page { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #1a3a5c;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
    transition: transform .3s;
}
.sidebar-brand { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand strong { display: block; font-size: 17px; }
.sidebar-brand span { font-size: 11px; color: #7ab5d9; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-link {
    display: block;
    padding: 13px 20px;
    color: #b8cfe0;
    font-size: 14px;
    transition: background .2s, color .2s;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-link.active { background: #2980b9; color: #fff; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 13px; }
.sidebar-foot a { display: block; padding: 6px 0; color: #7ab5d9; }
.sidebar-foot a:hover { color: #fff; }

.main { flex: 1; margin-left: 220px; }
.topbar {
    height: 60px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 90;
}
.topbar h2 { font-size: 18px; color: #333; }
.topbar-right { margin-left: auto; color: #666; font-size: 14px; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; margin-right: 12px; cursor: pointer; }

.content { padding: 24px; }
.page { display: none; }
.page.active { display: block; }

/* ---- 统计卡片 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-card h3 { font-size: 14px; color: #888; font-weight: normal; }
.stat-num { font-size: 32px; font-weight: bold; color: #1a3a5c; margin-top: 6px; }

/* ---- 面板 ---- */
.panel {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.panel h3 { font-size: 16px; margin-bottom: 18px; color: #333; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-head h3 { margin-bottom: 0; }

/* ---- 表格 ---- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
.table th { background: #f8f9fa; color: #666; font-weight: normal; }
.table tr:hover td { background: #fafbfc; }

/* ---- 按钮 ---- */
.btn {
    padding: 9px 18px;
    background: #eee;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    color: #333;
    transition: background .2s;
}
.btn:hover { background: #e0e0e0; }
.btn-primary { background: #2980b9; color: #fff; }
.btn-primary:hover { background: #1a6fa0; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 6px 12px; font-size: 13px; margin-right: 6px; }

/* ---- 表单 ---- */
.input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 14px;
}
.input:focus { outline: none; border-color: #2980b9; }
label { font-size: 13px; color: #666; display: block; margin-bottom: 6px; }
.save-tip { color: #27ae60; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---- 服务/新闻编辑区 ---- */
.service-edit, .news-edit { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.service-edit input, .news-edit input { flex: 1; }

/* ---- 图片上传 ---- */
.img-picker-box {
    width: 100%;
    height: 170px;
    border: 2px dashed #c3c9d0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    background: #fafbfc;
    transition: border-color .2s, background .2s;
    margin-bottom: 8px;
}
.img-picker-box:hover { border-color: #2980b9; background: #f0f7fc; }
.img-picker-box img { width: 100%; height: 100%; object-fit: cover; }
.img-picker-plus { font-size: 44px; color: #b8c0c8; line-height: 1; font-weight: 300; }
.img-picker-tip { font-size: 13px; color: #999; margin-top: 8px; }
.img-picker-hint { font-size: 12px; color: #aaa; margin-bottom: 14px; }

/* ---- 弹窗 ---- */
.modal-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 10px;
    padding: 26px;
    width: 480px;
    max-width: 92vw;
}
.modal h3 { margin-bottom: 18px; }
.modal label { display: block; margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
