/* ==========================================================================
   忆梦云团队开发 · 白嫖狗避雷站 全局样式
   移动端优先，兼容电脑端与手机端
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-soft: rgba(37, 99, 235, 0.10);
    --bg-soft: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-sec: #475569;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 10px 40px rgba(37, 99, 235, 0.12);
    --radius: 14px;
    --header-h: 68px;
}

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

html, body { height: 100%; }

body {
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text-main);
    background: var(--bg-soft);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1280px; margin: 0 auto; padding: 16px 20px; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    background: #fff;
    color: var(--text-main);
    border-color: var(--border);
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { box-shadow: var(--shadow); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* ==========================================================================
   前台
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand { font-size: 18px; font-weight: 800; color: var(--text-main); white-space: nowrap; }
.brand span { color: var(--primary); }

.search-bar {
    flex: 1;
    display: flex;
    gap: 8px;
    max-width: 560px;
}
.search-bar input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 14px;
    outline: none;
    transition: border .15s, box-shadow .15s;
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.search-bar button { padding: 9px 16px; }

.header-nav { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header-nav a.link { font-size: 14px; color: var(--text-sec); font-weight: 600; }

.result-info { font-size: 13px; color: var(--text-sec); margin: 4px 2px 12px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

/* 前台卡片 */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease;
    display: flex;
    flex-direction: column;
}
.card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.07); border-color: #d1d5db; }

/* 介绍 */
.card-intro {
    padding: 8px 10px 7px;
    font-weight: 700;
    font-size: 13px;
    color: #111827;
    line-height: 1.4;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 信息网格 */
.card-info {
    padding: 6px 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px 10px;
}
.card-field {
    display: flex;
    gap: 5px;
    font-size: 11.5px;
    padding: 2px 0;
    min-width: 0;
}
.card-field > span {
    color: #9ca3af;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.card-field > b {
    font-weight: 500;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s;
}
.card-field > b:hover { color: #2563eb; }
.card-intro { cursor: pointer; transition: color .15s; }
.card-intro:hover { color: #2563eb; }
.card-accounts .acc { cursor: pointer; transition: opacity .15s; }
.card-accounts .acc:hover { opacity: .8; }
.card-field.wide { grid-column: 1 / -1; }
.card-field.wide > b { white-space: normal; word-break: break-all; }

/* 账号 */
.card-accounts {
    padding: 4px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.card-accounts .acc {
    background: #f0f5ff;
    color: #2563eb;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    display: inline-flex;
    gap: 3px;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-accounts .acc em { font-style: normal; opacity: .6; font-size: 10px; }

/* 图片 */
.card-images {
    padding: 2px 10px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.card-images img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #e5e7eb;
    cursor: zoom-in;
}

/* 警告 */
.card-warning {
    margin-top: auto;
    padding: 5px 10px;
    background: #fff5f5;
    color: #dc2626;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    border-top: 1px solid #fecaca;
}

/* 元信息 */
.card-meta {
    padding: 4px 10px;
    font-size: 10.5px;
    color: #9ca3af;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}

.load-more { text-align: center; margin: 24px 0; }
.site-footer { text-align: center; padding: 28px 16px; color: #94a3b8; font-size: 13px; }

.empty { text-align: center; color: var(--text-sec); padding: 60px 0; font-size: 14px; }

/* ==========================================================================
   登录 / 注册
   ========================================================================== */

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.auth-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-sec); font-size: 14px; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-main); }
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border .15s, box-shadow .15s;
    background: #fff;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-textarea { resize: vertical; min-height: 90px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row img { height: 42px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.form-hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-sec); }

/* ==========================================================================
   用户 / 管理员后台布局
   ========================================================================== */

.app { min-height: 100vh; background: var(--bg-soft); }

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    z-index: 50;
}
.sidebar-brand { font-size: 17px; font-weight: 800; padding: 4px 10px 20px; color: var(--text-main); }
.sidebar-brand span { color: var(--primary); }
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 9px;
    color: var(--text-sec);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    transition: all .15s;
}
.sidebar .nav-link:hover { background: var(--bg-soft); color: var(--text-main); }
.sidebar .nav-link.active { background: var(--primary-soft); color: var(--primary); }
.sidebar .nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; }
.sidebar .nav-link.active .dot { opacity: 1; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar-foot .user-chip { font-size: 13px; color: var(--text-sec); margin-bottom: 10px; word-break: break-all; }

.app-main { margin-left: 220px; min-height: 100vh; display: flex; flex-direction: column; }

.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 60;
    height: 56px;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    justify-content: space-between;
}
.mobile-topbar .tb-brand { font-weight: 800; font-size: 16px; }
.mobile-topbar .tb-brand span { color: var(--primary); }

.app-content { flex: 1; padding: 24px; max-width: 1080px; width: 100%; margin-left: auto; margin-right: auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }

/* 标签栏 */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 16px;
}
.tab {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #9ca3af;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}
.tab:hover { color: #6b7280; }
.tab-active { color: #2563eb; border-bottom-color: #2563eb; }
.tab-pane { min-height: 200px; }
.page-title { font-size: 20px; font-weight: 800; }
.page-desc { font-size: 13px; color: var(--text-sec); margin-top: 2px; }

/* 底部导航（手机端） */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.bottom-nav .bn-inner { display: flex; }
.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 10px 2px 8px;
    font-size: 13px;
    color: var(--text-sec);
    font-weight: 600;
    border-radius: 10px;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    line-height: 1.3;
}
.bottom-nav a:active { background: var(--bg-soft); }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a .ico { display: block; font-size: 20px; line-height: 1; margin-bottom: 2px; }

/* ==========================================================================
   表格 / 卡片列表
   ========================================================================== */

.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; }
.panel-body { padding: 16px; }

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12.5px; color: var(--text-sec); font-weight: 700; white-space: nowrap; background: #f8fafc; }
.table tr:last-child td { border-bottom: 0; }

.status-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.status-pending { background: #fef3c7; color: var(--warning); }
.status-approved { background: #dcfce7; color: var(--success); }
.status-rejected { background: #fee2e2; color: var(--danger); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.tag-green { background: #dcfce7; color: var(--success); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* 上传表单 */
.upload-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; max-width: 720px; margin: 0 auto; }
.acc-row { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; margin-bottom: 8px; }
.acc-row .form-input { min-width: 0; }
.img-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.img-previews .pv {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.img-previews .pv img { width: 100%; height: 100%; object-fit: cover; }
.img-previews .pv .rm { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; line-height: 18px; text-align: center; background: rgba(0,0,0,.55); color: #fff; border-radius: 50%; font-size: 13px; cursor: pointer; }

/* 详情弹层与图片灯箱 */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; max-width: 720px; width: 100%; max-height: 88vh; overflow: auto; padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--text-sec); line-height: 1; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 300; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

/* 消息提示 */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 18px; border-radius: 9px; font-size: 14px; font-weight: 600; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }

.muted { color: #94a3b8; }
.text-sec { color: var(--text-sec); }
.mt16 { margin-top: 16px; }
.mb16 { margin-bottom: 16px; }

/* ==========================================================================
   响应式
   ========================================================================== */

@media (max-width: 900px) {
    .sidebar { display: none; }
    .app-main { margin-left: 0; }
    .mobile-topbar { display: flex; }
    .bottom-nav { display: block; }
    .app-content { padding: 16px; padding-bottom: 90px; }
}

@media (max-width: 768px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
    .site-header { height: auto; }
    .search-bar { order: 3; flex-basis: 100%; max-width: none; }
    .header-nav { margin-left: auto; }
    .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .card-info { grid-template-columns: 1fr; }
    .card-images img { width: 48px; height: 48px; }
    .acc-row { grid-template-columns: 1fr; }
    .acc-row .rm { width: 100%; }
    .auth-card { padding: 24px 20px; }
    .table th, .table td { padding: 9px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
