/* ═══════════════════════════════════════════
   Navigator - 精美导航站样式
   ═══════════════════════════════════════════ */

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

:root {
    --bg-primary: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --text-primary: #e8e6e3;
    --text-secondary: #8a8a8e;
    --text-muted: #555;
    --accent-warm: #e8a87c;
    --accent-cool: #7eb8da;
    --accent-green: #85b88c;
    --accent-rose: #d48b8b;
    --accent-lavender: #a78bdb;
    --border: rgba(255, 255, 255, 0.06);
    --radius: 16px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans SC', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* 亮色主题 */
body.light {
    --bg-primary: #f8f7f4;
    --bg-card: rgba(0, 0, 0, 0.02);
    --bg-card-hover: rgba(0, 0, 0, 0.05);
    --text-primary: #2a2a2e;
    --text-secondary: #6a6a70;
    --text-muted: #aaa;
    --border: rgba(0, 0, 0, 0.07);
    --shadow: 0 8px 32px rgba(0,0,0,0.08);
}
body.light .bg-gradient .orb { opacity: 0.06; }
body.light .noise { opacity: 0.02; }
body.light .sidebar { background: rgba(248,247,244,0.85); }

.hidden { display: none !important; }
.admin-only { display: none !important; }
body.is-admin .admin-only { display: flex !important; }

/* ═══ 背景动效 ═══ */
.bg-gradient {
    position: fixed; inset: 0; z-index: 0;
    overflow: hidden; pointer-events: none;
}
.bg-gradient .orb {
    position: absolute; border-radius: 50%;
    filter: blur(120px); opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}
.bg-gradient .orb:nth-child(1) {
    width: 600px; height: 600px;
    background: var(--accent-warm);
    top: -10%; left: -10%;
}
.bg-gradient .orb:nth-child(2) {
    width: 500px; height: 500px;
    background: var(--accent-cool);
    bottom: -10%; right: -5%;
    animation-delay: -7s;
}
.bg-gradient .orb:nth-child(3) {
    width: 400px; height: 400px;
    background: var(--accent-lavender);
    top: 40%; left: 50%;
    animation-delay: -14s;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -40px) scale(1.05); }
    66% { transform: translate(-40px, 30px) scale(0.95); }
}

/* 噪点 */
.noise {
    position: fixed; inset: 0; z-index: 1;
    pointer-events: none; opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ═══ Header ═══ */
header {
    padding: 60px 0 40px;
    text-align: center;
    animation: fadeUp 0.8s ease-out;
}
header h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-warm) 50%, var(--accent-cool) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}
header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* ═══ 时钟 ═══ */
.time-bar {
    text-align: center;
    margin-bottom: 48px;
    animation: fadeUp 0.8s ease-out 0.15s both;
}
.time-bar .clock {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    opacity: 0.12;
    line-height: 1;
}
.time-bar .date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 0.1em;
}

/* ═══ 搜索 ═══ */
.search-wrapper {
    max-width: 560px;
    margin: 32px auto 48px;
    position: relative;
    animation: fadeUp 0.8s ease-out 0.1s both;
}
.search-wrapper svg {
    position: absolute; left: 20px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px; height: 18px;
    transition: color 0.3s;
}
.search-wrapper input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border: 1px solid var(--border);
    border-radius: 60px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
    backdrop-filter: blur(12px);
}
.search-wrapper input::placeholder { color: var(--text-muted); }
.search-wrapper input:focus {
    border-color: rgba(232, 168, 124, 0.4);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(232, 168, 124, 0.08);
}
body.light .search-wrapper input:focus {
    background: rgba(0,0,0,0.02);
}

/* ═══ 侧边栏 ═══ */
.sidebar {
    position: fixed; left: 0; top: 0;
    width: 64px; height: 100vh; z-index: 100;
    display: flex; flex-direction: column;
    align-items: center; padding: 20px 0;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}
.sidebar:hover { width: 200px; }

.sidebar-logo {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-warm), var(--accent-cool));
    display: flex; align-items: center; justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: 700; font-size: 1.1rem;
    color: var(--bg-primary); flex-shrink: 0;
    margin-bottom: 28px;
}

.sidebar-nav {
    flex: 1; width: 100%;
    display: flex; flex-direction: column;
    gap: 4px; padding: 0 10px;
    overflow-y: auto;
}

.sidebar-item {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 12px; border-radius: 12px;
    text-decoration: none; color: var(--text-muted);
    cursor: pointer; transition: all 0.25s;
    white-space: nowrap; position: relative;
    overflow: hidden; border: none;
    background: transparent; font-family: inherit;
    font-size: inherit;
}
.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.sidebar-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}
.sidebar-item.active::before {
    content: ''; position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px;
    border-radius: 0 3px 3px 0;
}

/* 分类颜色 */
.sidebar-item[data-color="warm"].active::before { background: var(--accent-warm); }
.sidebar-item[data-color="warm"].active { color: var(--accent-warm); }
.sidebar-item[data-color="cool"].active::before { background: var(--accent-cool); }
.sidebar-item[data-color="cool"].active { color: var(--accent-cool); }
.sidebar-item[data-color="lavender"].active::before { background: var(--accent-lavender); }
.sidebar-item[data-color="lavender"].active { color: var(--accent-lavender); }
.sidebar-item[data-color="green"].active::before { background: var(--accent-green); }
.sidebar-item[data-color="green"].active { color: var(--accent-green); }
.sidebar-item[data-color="rose"].active::before { background: var(--accent-rose); }
.sidebar-item[data-color="rose"].active { color: var(--accent-rose); }

.sidebar-icon {
    width: 20px; height: 20px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.sidebar-label {
    font-size: 0.82rem; font-weight: 400;
    opacity: 0; transition: opacity 0.25s 0.05s;
}
.sidebar:hover .sidebar-label { opacity: 1; }

.sidebar-divider {
    width: 28px; height: 1px;
    background: var(--border);
    margin: 12px auto;
    transition: width 0.3s;
}
.sidebar:hover .sidebar-divider { width: calc(100% - 24px); }

.sidebar-bottom { padding: 0 10px; width: 100%; }
.sidebar-actions { display: flex; flex-direction: column; gap: 2px; }
.sidebar-badge {
    font-size: 9px; padding: 3px 8px; border-radius: 6px;
    background: rgba(133,184,140,0.15); color: var(--accent-green);
    font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
    margin: 4px 12px 8px; white-space: nowrap;
    align-self: flex-start;
}
.sidebar-item.top-btn {
    color: var(--text-muted); justify-content: center;
}
.sidebar:hover .sidebar-item.top-btn { justify-content: flex-start; }

.sidebar-item.admin-active .sidebar-icon { color: var(--accent-green); }

/* ═══ 容器 ═══ */
.container {
    position: relative; z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 0 88px;
}

/* ═══ 分类区块 ═══ */
.section { margin-bottom: 48px; animation: fadeUp 0.6s ease-out both; }
.section:nth-child(1) { animation-delay: 0.2s; }
.section:nth-child(2) { animation-delay: 0.3s; }
.section:nth-child(3) { animation-delay: 0.4s; }
.section:nth-child(4) { animation-delay: 0.5s; }
.section:nth-child(5) { animation-delay: 0.6s; }
.section:nth-child(6) { animation-delay: 0.7s; }

.section-title {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 20px; padding-left: 4px;
}
.section-title .dot {
    width: 8px; height: 8px;
    border-radius: 50%; flex-shrink: 0;
}
.section-title h2 {
    font-size: 0.8rem; font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}
.section-title::after {
    content: ''; flex: 1;
    height: 1px; background: var(--border);
}

/* ═══ 卡片网格 ═══ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.card {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none; color: var(--text-primary);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(8px);
    position: relative; overflow: hidden;
}
.card::before {
    content: ''; position: absolute; inset: 0;
    border-radius: var(--radius);
    opacity: 0; transition: opacity 0.35s; z-index: 0;
}
.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255,255,255,0.1);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}
.card:hover::before { opacity: 1; }

.card-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
    position: relative; z-index: 1;
    transition: transform 0.35s;
}
.card:hover .card-icon { transform: scale(1.08); }
.card-icon img { width: 22px; height: 22px; border-radius: 4px; }

.card-info { position: relative; z-index: 1; min-width: 0; flex: 1; }
.card-info .name {
    font-size: 0.9rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-info .desc {
    font-size: 0.72rem; color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 卡片编辑按钮 */
.card-edit {
    display: none; position: absolute;
    top: 8px; right: 8px;
    width: 26px; height: 26px; border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(10,10,15,0.8);
    color: var(--text-secondary);
    align-items: center; justify-content: center;
    font-size: 11px; cursor: pointer;
    transition: all 0.2s; z-index: 3;
}
body.is-admin .card:hover .card-edit { display: flex; }
.card-edit:hover { background: var(--accent-warm); color: #fff; border-color: var(--accent-warm); }

/* 分类卡片配色 */
.card[data-cat="common"] .card-icon,
.card[data-cat="常用工具"] .card-icon { background: rgba(232,168,124,0.12); color: var(--accent-warm); }
.card[data-cat="common"]::before,
.card[data-cat="常用工具"]::before { background: linear-gradient(135deg, rgba(232,168,124,0.04), transparent); }

.card[data-cat="dev"] .card-icon,
.card[data-cat="开发资源"] .card-icon { background: rgba(126,184,218,0.12); color: var(--accent-cool); }
.card[data-cat="dev"]::before,
.card[data-cat="开发资源"]::before { background: linear-gradient(135deg, rgba(126,184,218,0.04), transparent); }

.card[data-cat="ai"] .card-icon,
.card[data-cat="AI 工具"] .card-icon { background: rgba(167,139,219,0.12); color: var(--accent-lavender); }
.card[data-cat="ai"]::before,
.card[data-cat="AI 工具"]::before { background: linear-gradient(135deg, rgba(167,139,219,0.04), transparent); }

.card[data-cat="tool"] .card-icon,
.card[data-cat="设计资源"] .card-icon,
.card[data-cat="学习教育"] .card-icon { background: rgba(133,184,140,0.12); color: var(--accent-green); }
.card[data-cat="tool"]::before,
.card[data-cat="设计资源"]::before,
.card[data-cat="学习教育"]::before { background: linear-gradient(135deg, rgba(133,184,140,0.04), transparent); }

.card[data-cat="media"] .card-icon,
.card[data-cat="媒体娱乐"] .card-icon { background: rgba(212,139,139,0.12); color: var(--accent-rose); }
.card[data-cat="media"]::before,
.card[data-cat="媒体娱乐"]::before { background: linear-gradient(135deg, rgba(212,139,139,0.04), transparent); }

/* ═══ 弹窗 ═══ */
.modal-mask {
    display: none; position: fixed; inset: 0; z-index: 200;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
}
.modal-mask.active { display: flex; }

.modal {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid var(--border);
    border-radius: 20px; padding: 28px;
    width: 92%; max-width: 440px;
    max-height: 85vh; overflow-y: auto;
    animation: pop 0.25s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    backdrop-filter: blur(20px);
}
body.light .modal { background: rgba(255,255,255,0.95); }
.modal-sm { max-width: 360px; text-align: center; }

@keyframes pop {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon-box {
    width: 56px; height: 56px; border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-warm), var(--accent-cool));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 24px;
    margin: 0 auto 14px;
}
.modal-h { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }
.modal-h.center { justify-content: center; }
.modal-title-icon { color: var(--accent-warm); font-size: 18px; }
.modal-sub { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }
.modal-ft { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-ft.center { justify-content: center; }
.mr-auto { margin-right: auto; }

/* ═══ 表单 ═══ */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fg { display: flex; flex-direction: column; gap: 4px; }
.fl { font-size: 11px; font-weight: 500; color: var(--text-secondary); letter-spacing: .3px; }
.req { color: var(--accent-rose); }
.fi {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg-card); color: var(--text-primary);
    font-size: 13px; outline: none;
    transition: all 0.3s; font-family: inherit;
    backdrop-filter: blur(8px);
}
.fi:focus {
    border-color: rgba(232, 168, 124, 0.4);
    box-shadow: 0 0 0 3px rgba(232, 168, 124, 0.08);
}
.fi-area { resize: vertical; min-height: 50px; }
.fi-center { text-align: center; font-size: 15px; letter-spacing: 2px; }
.fe { color: var(--accent-rose); font-size: 11px; margin-top: 2px; }

/* ═══ 按钮 ═══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 20px; border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.25s;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-warm), #d4956a);
    color: #fff; border-color: transparent;
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(232,168,124,0.25); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-card); color: var(--text-primary); }
.btn-ghost:hover { background: var(--bg-card-hover); }
.btn-danger { background: rgba(212,139,139,0.2); color: var(--accent-rose); border-color: transparent; }
.btn-danger:hover { background: rgba(212,139,139,0.3); }
.btn-ok { background: rgba(133,184,140,0.2); color: var(--accent-green); border-color: transparent; }
.btn-ok:hover { background: rgba(133,184,140,0.3); }
.w100 { width: 100%; }

/* ═══ 密码修改 ═══ */
.pwd { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); text-align: left; }
.pwd summary { cursor: pointer; font-size: 11px; color: var(--text-secondary); user-select: none; }
.pwd summary:hover { color: var(--accent-warm); }
.pwd-body { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }

/* ═══ 空状态 ═══ */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-i { font-size: 44px; margin-bottom: 12px; opacity: 0.4; }

/* ═══ Footer ═══ */
footer {
    text-align: center; padding: 40px 0 60px;
    color: var(--text-muted);
    font-size: 0.75rem; letter-spacing: 0.08em;
}

/* ═══ Toast ═══ */
#toast {
    position: fixed; top: 40px; left: 50%;
    transform: translateX(-50%) translateY(-12px);
    padding: 12px 28px; border-radius: 60px;
    font-size: 13px; font-weight: 500; z-index: 300;
    opacity: 0; transition: all 0.3s; pointer-events: none;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: rgba(133,184,140,0.2); color: var(--accent-green); }
#toast.error { background: rgba(212,139,139,0.2); color: var(--accent-rose); }
#toast.info { background: rgba(126,184,218,0.2); color: var(--accent-cool); }

/* ═══ 滚动条 ═══ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* ═══ 动画 ═══ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══ 响应式 ═══ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%; height: auto;
        position: fixed; bottom: 0; top: auto;
        flex-direction: row; padding: 8px 12px;
        border-right: none; border-top: 1px solid var(--border);
        z-index: 200;
    }
    .sidebar:hover { width: 100%; }
    .sidebar-logo, .sidebar-divider, .sidebar-bottom { display: none; }
    .sidebar-nav {
        flex-direction: row; justify-content: space-around;
        padding: 0; gap: 0; width: 100%;
    }
    .sidebar-item {
        flex-direction: column; gap: 4px;
        padding: 6px 8px; border-radius: 10px;
    }
    .sidebar-item.active::before { display: none; }
    .sidebar-label { opacity: 1; font-size: 0.6rem; }
    .sidebar-icon { font-size: 1.1rem; }
    .container { padding: 0 16px; }
    header { padding: 40px 0 24px; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .card { padding: 14px 16px; gap: 12px; }
    .card-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 10px; }
    .search-wrapper { margin: 24px auto 36px; }
    footer { padding-bottom: 100px; }
}

/* ═══ 同步面板 ═══ */
.sync-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0;
    font-size: 12px; color: var(--text-secondary);
}
.sync-status {
    font-size: 11px; font-weight: 600;
    padding: 2px 10px; border-radius: 20px;
}
.sync-on {
    background: rgba(133,184,140,0.15); color: var(--accent-green);
}
.sync-off {
    background: rgba(255,255,255,0.05); color: var(--text-muted);
}
.sync-hint {
    font-size: 11px; color: var(--text-muted);
    line-height: 1.5; margin: 6px 0 10px;
}
.sync-actions {
    display: flex; gap: 8px;
}
.sync-btn {
    flex: 1; padding: 8px 0; font-size: 12px;
}

/* Toggle 开关 */
.toggle-switch {
    position: relative; display: inline-block;
    width: 40px; height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: rgba(255,255,255,0.08);
    border-radius: 22px; transition: 0.3s;
}
.toggle-slider::before {
    content: ""; position: absolute;
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%; transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: rgba(133,184,140,0.3);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--accent-green);
}
