/* ============================================================
   SC Owner Hub — 全局设计系统 (Design System)
   唯一的设计基准：颜色 / 圆角 / 间距 / 字体 / 组件样式
   风格：扁平、克制、高信息密度；以 1px 细描边分层，默认不用阴影
   ============================================================ */

:root {
    /* 品牌色（单一强调色） */
    --brand: #1677ff;
    --brand-dark: #0958d9;
    --brand-soft: rgba(22, 119, 255, 0.08);
    --brand-line: rgba(22, 119, 255, 0.18);

    /* 文字灰阶 */
    --ink: #1f1f1f;
    --ink-2: #4b5563;
    --text: #333639;
    --muted: #8c8c8c;
    --muted-2: #b0b4ba;

    /* 线条与背景 */
    --line: #eceef2;
    --line-2: #e5e7eb;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --bg: #f4f6fa;

    /* 语义色 */
    --danger: #d4380d;
    --success: #389e0d;
    --warn: #d48806;

    /* 圆角（克制，避免"全圆角"的 AI 感） */
    --r-sm: 4px;
    --r-md: 6px;
    --r-lg: 12px;
    --r-pill: 999px;

    /* 阴影（极少使用，仅浮层） */
    --shadow-pop: 0 6px 16px rgba(15, 23, 42, 0.08);

    /* 布局 */
    --header-h: 64px;
    --header-h-mobile: 56px;
    --container: 1152px;

    /* 字体与过渡 */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --t: 0.18s ease;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    padding-top: var(--header-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main { flex: 1; }

a { color: inherit; }
img { max-width: 100%; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================ 按钮 ============================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    background: var(--surface);
    color: var(--ink-2);
    transition: background var(--t), border-color var(--t), color var(--t);
}

.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand-line); }
.btn-outline:hover { background: var(--brand-soft); border-color: var(--brand); }

.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #ad2102; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 0.98rem; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--t), color var(--t);
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ============================ 徽标 / 卡片 ============================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.45rem;
    border-radius: var(--r-sm);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    background: var(--surface-2);
    color: var(--muted);
}
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-success { background: rgba(56, 158, 13, 0.1); color: var(--success); }
.badge-warn { background: rgba(212, 136, 6, 0.1); color: var(--warn); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
}

/* ============================ 站点头部 ============================ */
header#siteHeader,
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    z-index: 1000;
}

.header-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1.22rem;
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
    letter-spacing: -0.2px;
    white-space: nowrap;
}
.logo .logo-dark { color: var(--ink); }

.nav-links {
    display: flex;
    gap: 1.6rem;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-links a {
    text-decoration: none;
    color: var(--ink-2);
    font-weight: 400;
    font-size: 0.94rem;
    padding: 0.3rem 0;
    white-space: nowrap;
    transition: color var(--t);
}
.nav-links a:hover,
.nav-links a.active { color: var(--brand); }

.nav-actions { display: flex; gap: 0.5rem; align-items: center; }

.lang-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    border-radius: var(--r-md);
    border: 1px solid var(--line-2);
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: border-color var(--t), color var(--t);
}
.lang-switch:hover { border-color: var(--brand); color: var(--brand); }

/* 用户菜单 */
.user-menu { position: relative; }
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--r-md);
    background: transparent;
    border: 1px solid var(--line-2);
    color: var(--ink);
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color var(--t);
}
.user-menu-btn:hover { border-color: var(--brand); }
.user-menu-btn img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.user-menu-btn i.fa-chevron-down { font-size: 0.68rem; color: var(--muted); transition: transform var(--t); }
.user-menu-btn.active i.fa-chevron-down { transform: rotate(180deg); }

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 190px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
    z-index: 1001;
}
.user-dropdown.active { display: block; }
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--line);
    transition: background var(--t), color var(--t);
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover { background: var(--surface-2); color: var(--brand); }
.user-dropdown a i { width: 16px; text-align: center; color: var(--muted); }

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}
.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    transition: all 0.3s;
}
.mobile-menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* 移动端顶栏常驻"发布资源"按钮（未登录点击 -> 登录页） */
.mobile-publish-btn {
    display: none;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.8rem;
    background: var(--brand);
    color: #fff;
    border-radius: var(--r-md);
    font-weight: 500;
    font-size: 0.82rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--t);
}
.mobile-publish-btn:hover { background: var(--brand-dark); }

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    z-index: 999;
    padding: 0.3rem 0;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
}
.mobile-menu.active { display: block; }
.mobile-menu > a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1.5rem;
    color: var(--ink);
    text-decoration: none;
    font-weight: 400;
    border-bottom: 1px solid var(--line);
}
.mobile-menu > a:hover { background: var(--surface-2); color: var(--brand); }
.mobile-menu .mobile-actions {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    border-top: 1px solid var(--line);
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.5rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.mobile-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mobile-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mobile-user-avatar i { font-size: 1.3rem; color: var(--muted-2); }
.mobile-user-details { display: flex; flex-direction: column; gap: 0.1rem; }
.mobile-user-name { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.mobile-user-id { font-size: 0.74rem; color: var(--muted-2); }

/* ============================ 站点页脚（浅色中性） ============================ */
.site-footer {
    background: var(--surface);
    color: var(--muted);
    width: 100%;
    margin-top: auto;
    border-top: 1px solid var(--line);
}
.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1.25rem;
}
.footer-top {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    gap: 2rem;
}
.footer-brand { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.2px; margin-bottom: 0.6rem; }
.footer-brand a { text-decoration: none; }
.footer-brand a span:last-child { color: var(--ink) !important; }
.footer-desc { font-size: 0.88rem; max-width: 380px; line-height: 1.7; color: var(--muted); margin: 0; }
.footer-col-title { font-weight: 600; color: var(--ink); margin-bottom: 0.75rem; font-size: 0.88rem; }
.footer-links { display: flex; flex-direction: column; gap: 0.55rem; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 0.88rem; width: fit-content; transition: color var(--t); }
.footer-links a:hover { color: var(--brand); }
.footer-divider { height: 1px; background: var(--line); margin: 1.75rem 0 1.1rem; }
.footer-bottom { text-align: center; font-size: 0.8rem; color: var(--muted-2); letter-spacing: 0.02em; }

/* ============================ 响应式（统一断点） ============================ */
@media (max-width: 768px) {
    :root { --header-h: var(--header-h-mobile); }

    .container { padding: 0 1rem; }
    .header-container { padding: 0 1rem; }

    .nav-links { display: none; }
    .nav-actions { display: none; }
    .mobile-menu-btn { display: flex; }
    .mobile-publish-btn { display: inline-flex; margin-left: auto; }

    .logo { font-size: 1.1rem; }

    .footer-inner { padding: 2rem 1.25rem 1.25rem; }
    .footer-top { grid-template-columns: 1fr; gap: 1.5rem; }
    .footer-desc { max-width: none; }
}

@media (max-width: 480px) {
    .container { padding: 0 0.9rem; }
    .header-container { padding: 0 0.9rem; }
    .logo { font-size: 1.02rem; }
    .mobile-menu-btn { padding: 6px; }
    .mobile-menu-btn span { width: 20px; }
    .footer-inner { padding: 1.75rem 1rem 1rem; }
    .footer-brand { font-size: 1rem; }
    .footer-divider { margin: 1.4rem 0 0.9rem; }
}