:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd4;
    --danger: #e74c3c;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #2d3436;
    --muted: #8a8f99;
    --border: #e6e8ee;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.center { text-align: center; }
code { background: #f0f0f5; padding: 2px 6px; border-radius: 4px; font-size: .9em; }

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    transition: all .15s;
}
.btn:hover { text-decoration: none; border-color: #cfd2db; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; text-align: center; margin-top: 14px; }

/* ===== 提示 ===== */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.alert-error { background: #fdecea; color: #c0392b; }
.alert-success { background: #e8f8f0; color: #1e8449; }
.alert-info { background: #eaf2fd; color: #2471a3; }

/* ===== 登录 / 注册 / 密码门 ===== */
.auth-box, .gate {
    max-width: 380px;
    margin: 8vh auto;
    background: var(--card);
    padding: 28px 24px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.auth-box h1, .gate h2 { margin-top: 0; }
.captcha-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.captcha-row input { flex: 1; margin-bottom: 0 !important; }
.captcha-img { height: 40px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; flex-shrink: 0; }

.auth-box label, .gate label, .form-card label {
    display: block;
    margin: 12px 0 6px;
    font-size: 14px;
    font-weight: 500;
}
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]),
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input:disabled { background: #f3f3f6; color: var(--muted); }
textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; }
.checkbox input { width: auto; }

/* ===== 首页 ===== */
.landing { max-width: 520px; margin: 12vh auto; text-align: center; padding: 0 16px; }
.landing h1 { font-size: 28px; }
.landing-links { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

/* ===== 后台布局 ===== */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.search input { flex: 1; }

/* ===== 表格（用户管理等仍用表格的页面）===== */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.04); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #fafbfc; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ===== 技师列表卡片（全端适配，无横向滚动）===== */
.tech-cards { display: flex; flex-direction: column; gap: 12px; }
.tech-card {
    background: var(--card);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.04);
    border: 1px solid var(--border);
}
/* 封面图区域：固定高度，有图/无图尺寸一致 */
.tech-card-thumb {
    width: 100%;
    height: 160px;
    background: #f0f0f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.tech-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tech-card-noimg {
    color: var(--muted);
    font-size: 14px;
}
.tech-card-head,
.tech-card-title,
.tech-card-meta,
.tech-card-actions {
    padding-left: 16px;
    padding-right: 16px;
}
.tech-card-head { padding-top: 12px; }
.tech-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tech-card-tid { font-size: 15px; font-weight: 600; background: #f0f0f5; padding: 4px 10px; border-radius: 6px; word-break: break-all; }
.tech-card-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; word-break: break-word; }
.tech-card-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.tech-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 14px;
    border-top: 1px solid var(--border);
    margin-top: 0;
}
.tech-card-actions .btn { flex: 1 1 calc(50% - 4px); min-width: 0; text-align: center; justify-content: center; }
.tech-card-actions .inline-form { flex: 1 1 calc(50% - 4px); display: flex; margin: 0; }
.tech-card-actions .inline-form .btn { width: 100%; }
@media (min-width: 768px) {
    .tech-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (min-width: 1100px) {
    .tech-cards { grid-template-columns: repeat(3, 1fr); }
}
.tag { padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.tag-on { background: #e8f8f0; color: #1e8449; }
.tag-off { background: #f0f0f5; color: var(--muted); }

/* ===== 表单卡片 ===== */
.form-card { background: var(--card); padding: 22px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.04); max-width: 640px; }

/* ===== 图片管理 ===== */
.img-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 12px; }
.img-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px; text-align: center; }
.img-item img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 8px; }

/* ===== 访客展示页（图片等宽）===== */
.view-page { max-width: 680px; margin: 0 auto; padding: 18px 0 40px; }
.view-card {
    background: var(--card);
    margin: 0 16px;
    padding: 22px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.07);
}
.tech-name { font-size: 23px; margin: 0 0 16px; text-align: center; }
.tech-intro {
    color: #4a4f57;
    line-height: 1.8;
    background: #faf9ff;
    border: 1px solid #efedfb;
    padding: 14px 16px;
    border-radius: 12px;
    word-break: break-word;
    font-weight: bold;
}
/* 广告/公告区：介绍下方、图片上方（类名避免 ad 字样，防止被广告拦截器隐藏）*/
.tech-notice { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.notice-item {
    display: block;
    border: 1px solid transparent;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    word-break: break-word;
    font-weight: bold;
}
/* 玫红主题 #FD2866 */
.notice-item--pink { background: #FFEAF0; border-color: #FFC2D4; color: #FD2866; }
a.notice-item--pink:hover { background: #FFD9E4; text-decoration: none; }
/* 绿色主题 #20a53a */
.notice-item--green { background: #E7F6EC; border-color: #B4E3BF; color: #1C8F33; }
a.notice-item--green:hover { background: #D5EFDD; text-decoration: none; }

/* 后台：主题颜色选择 */
.theme-choice { display: flex; gap: 18px; align-items: center; margin-bottom: 4px; }
.theme-opt { display: inline-flex !important; align-items: center; gap: 6px; font-weight: 400 !important; cursor: pointer; margin: 0 !important; }
.theme-opt input { width: auto; }
.theme-swatch { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.theme-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
/* 技师照片（位于 view-card 内，广告下方）*/
.tech-gallery { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.tech-gallery img {
    width: 100%;          /* 所有图片等宽 */
    height: auto;
    display: block;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    cursor: zoom-in;
}
.view-footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; padding: 0 16px; }
.view-footer a { color: var(--muted); }

/* 图片放大灯箱 */
#lightbox {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 999;
    align-items: center; justify-content: center;
    padding: 16px;
    cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ===== 分页 ===== */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 20px 0; }
.pager-info { color: var(--muted); font-size: 14px; }
.btn.disabled { opacity: .45; pointer-events: none; }

/* ===== 用户管理：删除选项 ===== */
.del-user-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.checkbox-inline input { width: auto; }

/* ===== 管理后台侧边栏布局 ===== */
.layout { display: flex; min-height: 100vh; }
.nav-toggle { display: none; }
.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: #2b2f3a;
    color: #fff;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    line-height: 1.4;
}
.sidebar-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; }
.sidebar-nav a {
    color: #c7cad4;
    padding: 12px 20px;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: rgba(108,92,231,.22); color: #fff; border-left-color: var(--primary); }
.sidebar-logout {
    color: #c7cad4;
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 14px;
}
.sidebar-logout:hover { color: #fff; text-decoration: none; }
.layout-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.layout-main .topbar { justify-content: flex-start; gap: 12px; }
.nav-burger { display: none; font-size: 22px; cursor: pointer; user-select: none; }
.page-title { font-weight: 700; font-size: 18px; flex: 1; }
.topbar-user { color: var(--muted); font-size: 14px; }

/* ===== 仪表盘统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 22px; border-radius: 14px; color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.stat-num { font-size: 32px; font-weight: 700; line-height: 1; }
.stat-label { margin-top: 8px; font-size: 14px; opacity: .92; }
.stat-blue   { background: linear-gradient(135deg, #4e9af1, #6fb1f7); }
.stat-purple { background: linear-gradient(135deg, #6c5ce7, #8e7bf0); }
.stat-green  { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-orange { background: linear-gradient(135deg, #e67e22, #f39c12); }
.quick-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== 积分 ===== */
.points-form { display: flex; gap: 4px; align-items: center; }
.points-input { width: 64px !important; padding: 5px 8px !important; }
.points-badge {
    background: rgba(108,92,231,.15);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ===== 充值订单 ===== */
.kv { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.kv span { color: var(--muted); }
.copy-box {
    margin-top: 6px;
    padding: 12px;
    background: #f7f8fc;
    border: 1px dashed var(--primary);
    border-radius: 10px;
    font-size: 14px;
    word-break: break-all;
    cursor: pointer;
    line-height: 1.6;
}
.copy-box.copied { border-style: solid; background: #e8f8f0; }
.copy-box.copied::after { content: ' ✓ 已复制'; color: #1e8449; }
.qr-wrap { text-align: center; margin: 16px 0 6px; }
.qr-img { width: 200px; height: 200px; max-width: 70%; border: 1px solid var(--border); border-radius: 12px; padding: 6px; background: #fff; }
.qr-tip { color: var(--muted); font-size: 13px; margin-top: 6px; }
#countdown { color: #c0392b; font-variant-numeric: tabular-nums; }
#countdown.cd-end { color: var(--muted); }

/* ===== 设置分组 ===== */
.panel-section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.panel-section:last-of-type { border-bottom: none; margin-bottom: 6px; }
.panel-section h2 { margin: 0 0 12px; font-size: 16px; }

/* ===== 后台美化补充 ===== */
.container > h1 { font-size: 22px; margin: 4px 0 18px; }
.container > h2 { font-size: 17px; margin: 24px 0 12px; }
table tbody tr { transition: background .12s; }
table tbody tr:hover { background: #f7f8ff; }
.form-card { box-shadow: 0 6px 20px rgba(0,0,0,.05); }
.btn:active { transform: translateY(1px); }
.topbar { box-shadow: 0 1px 0 rgba(0,0,0,.03); }

/* ===== 分享弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center; justify-content: center;
    padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal-box h3 { margin: 0 0 14px; font-size: 17px; }
.modal-box textarea {
    width: 100%;
    font-size: 14px;
    line-height: 1.7;
    background: #f7f8fc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    resize: none;
}
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.modal-actions .btn { flex: 1; text-align: center; min-width: 110px; }

/* ===== 移动端适配 ===== */
@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .topbar { padding: 10px 14px; flex-wrap: wrap; }
    .topbar nav { gap: 10px; font-size: 13px; flex-wrap: wrap; width: 100%; justify-content: flex-start; }
    .admin-wrap .topbar { flex-wrap: wrap; }
    .admin-wrap .topbar .brand { width: 100%; margin-bottom: 4px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .btn-primary { text-align: center; width: 100%; }
    .search { min-width: 0; width: 100%; }
    .search .btn { flex-shrink: 0; }
    .container { padding: 14px 12px 50px; }
    th, td { padding: 10px; font-size: 13px; white-space: normal; }
    .del-user-form { flex-direction: column; align-items: flex-start; }
    .tech-card-actions .btn,
    .tech-card-actions .inline-form { flex: 1 1 100%; }
    .points-badge { font-size: 12px; }

    /* 侧边栏折叠为可展开菜单 */
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar-brand { display: none; }
    .sidebar-nav, .sidebar-logout { display: none; }
    #nav-toggle:checked ~ .sidebar .sidebar-nav { display: flex; }
    #nav-toggle:checked ~ .sidebar .sidebar-logout { display: block; }
    .nav-burger { display: inline-block; }
}
