/**
 * SugarBot Design System — 统一设计令牌与基础样式
 * 适用范围：home.php / article.php 及所有前台公开页面
 *
 * 设计规范：
 *  - 颜色：OLED 纯黑底 + Cyan/Blue 主色 + 紫色强调
 *  - 字体：Inter（UI/正文）+ JetBrains Mono（代码/数字）
 *  - 风格：Dark Glassmorphism + Neon glow
 *  - 导航：浮动圆角导航，top-4 left-4 right-4
 *
 * 版本：1.0.0 (2026-03-25)
 */

/* ─── 设计令牌 ─── */
:root {
    --clr-bg:          #000000;
    --clr-bg-deep:     #05050a;
    --clr-surface:     rgba(10, 10, 18, 0.85);
    --clr-surface-alt: rgba(15, 20, 35, 0.6);

    --clr-cyan:        #00f5ff;
    --clr-blue:        #0284c7;
    --clr-purple:      #8b5cf6;
    --clr-emerald:     #10b981;
    --clr-amber:       #f59e0b;
    --clr-red:         #ef4444;

    --clr-text-primary:   #f1f5f9;
    --clr-text-secondary: #cbd5e1;
    --clr-text-muted:     #64748b;
    --clr-text-disabled:  #334155;

    --clr-border:        rgba(0, 245, 255, 0.12);
    --clr-border-hover:  rgba(0, 245, 255, 0.35);

    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-2xl:  24px;

    --transition-fast:   150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow:   400ms ease;

    --nav-height: 64px;
}

/* ─── 基础重置 ─── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text-secondary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

code, pre, .mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── 网格底纹 ─── */
.sb-grid-bg {
    background-image:
        linear-gradient(rgba(0, 245, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 245, 255, 0.025) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ─── 浮动导航 ─── */
.sb-nav {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 50;
    background: rgba(5, 5, 10, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-2xl);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.sb-nav:hover {
    border-color: rgba(0, 245, 255, 0.2);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.6);
}

/* 品牌 Logo */
.sb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.sb-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #06b6d4, #0369a1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
    flex-shrink: 0;
}
.sb-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1;
}
.sb-brand-sub {
    font-size: 11px;
    color: #22d3ee;
    line-height: 1;
    margin-top: 2px;
}

/* 导航链接 */
.sb-nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}
.sb-nav-link {
    font-size: 14px;
    color: var(--clr-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}
.sb-nav-link:hover { color: #22d3ee; }
.sb-nav-link.active { color: #22d3ee; }

/* 导航右侧按钮 */
.sb-nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    transition: opacity var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 2px 16px rgba(2, 132, 199, 0.3);
}
.sb-nav-cta:hover {
    opacity: 0.9;
    box-shadow: 0 4px 24px rgba(2, 132, 199, 0.5);
}

/* 移动端菜单按钮 */
.sb-nav-mobile-btn {
    display: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--clr-text-muted);
    transition: background var(--transition-fast);
}
.sb-nav-mobile-btn:hover { background: rgba(255,255,255,0.05); }

@media (max-width: 767px) {
    .sb-nav-links { display: none; }
    .sb-nav-mobile-btn { display: block; }
}

/* 主内容区 padding-top（避免被浮动导航遮挡） */
.sb-main {
    padding-top: calc(56px + 32px); /* nav-height + top-offset + gap */
}

/* ─── 玻璃卡片 ─── */
.sb-glass {
    background: var(--clr-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.sb-glass:hover {
    border-color: var(--clr-border-hover);
}
.sb-glass-glow:hover {
    box-shadow: 0 0 40px rgba(0, 245, 255, 0.12);
}

/* ─── 霓虹渐变文字 ─── */
.sb-gradient-text {
    background: linear-gradient(135deg, #00f5ff 0%, #0ea5e9 50%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── 分类标签 ─── */
.sb-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
    transition: opacity var(--transition-fast);
}

/* ─── 状态指示点 ─── */
.sb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sb-dot-online {
    background: var(--clr-emerald);
    box-shadow: 0 0 8px var(--clr-emerald), 0 0 16px rgba(16, 185, 129, 0.4);
    animation: sb-pulse-glow 2s ease-in-out infinite;
}
.sb-dot-offline {
    background: var(--clr-red);
    opacity: 0.5;
}
.sb-dot-checking {
    background: var(--clr-amber);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes sb-pulse-glow {
    0%, 100% { box-shadow: 0 0 8px #10b981, 0 0 16px rgba(16,185,129,0.4); }
    50%       { box-shadow: 0 0 16px #10b981, 0 0 32px rgba(16,185,129,0.7); }
}

/* ─── 按钮 ─── */
.sb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.sb-btn:focus-visible {
    outline: 2px solid var(--clr-cyan);
    outline-offset: 2px;
}
.sb-btn-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    box-shadow: 0 2px 16px rgba(2,132,199,0.25);
}
.sb-btn-primary:hover {
    box-shadow: 0 4px 24px rgba(2,132,199,0.45);
    opacity: 0.92;
}
.sb-btn-ghost {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--clr-text-secondary);
}
.sb-btn-ghost:hover {
    background: rgba(255,255,255,0.07);
    color: var(--clr-text-primary);
}
.sb-btn-cyan {
    background: rgba(0,245,255,0.08);
    border: 1px solid rgba(0,245,255,0.2);
    color: #22d3ee;
}
.sb-btn-cyan:hover {
    background: rgba(0,245,255,0.14);
    box-shadow: 0 0 20px rgba(0,245,255,0.15);
}

/* ─── 模块图标 ─── */
.sb-module-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(0,245,255,0.08), rgba(139,92,246,0.08));
    border: 1px solid rgba(0,245,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ─── 文章正文排版 ─── */
.sb-prose {
    color: var(--clr-text-secondary);
    font-size: 16px;
    line-height: 1.75;
}
.sb-prose h1, .sb-prose h2, .sb-prose h3, .sb-prose h4 {
    color: var(--clr-text-primary);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 0.875rem;
}
.sb-prose h1 { font-size: 2.25rem; letter-spacing: -0.02em; }
.sb-prose h2 { font-size: 1.75rem; }
.sb-prose h3 { font-size: 1.375rem; }
.sb-prose h4 { font-size: 1.125rem; }
.sb-prose p  { margin: 1.25rem 0; }
.sb-prose ul, .sb-prose ol { margin: 1.25rem 0; padding-left: 1.75rem; }
.sb-prose li { margin: 0.5rem 0; }
.sb-prose blockquote {
    border-left: 3px solid #0ea5e9;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: rgba(14,165,233,0.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--clr-text-muted);
    font-style: italic;
}
.sb-prose code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(100,116,139,0.2);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #bfdbfe;
}
.sb-prose pre {
    background: rgba(5,5,15,0.8);
    border: 1px solid rgba(100,116,139,0.2);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.5rem 0;
}
.sb-prose pre code { background: transparent; padding: 0; color: var(--clr-text-secondary); }
.sb-prose a { color: #22d3ee; text-decoration: none; border-bottom: 1px solid rgba(34,211,238,0.3); transition: all var(--transition-fast); }
.sb-prose a:hover { border-bottom-color: rgba(34,211,238,0.7); }
.sb-prose img { max-width: 100%; border-radius: var(--radius-lg); margin: 1.5rem 0; border: 1px solid var(--clr-border); }
.sb-prose hr { border: none; border-top: 1px solid var(--clr-border); margin: 2.5rem 0; }
.sb-prose strong { color: var(--clr-text-primary); font-weight: 600; }

/* ─── Quill 编辑器兼容覆盖（文章页） ─── */
.sb-quill-view .ql-toolbar { display: none !important; }
.sb-quill-view .ql-container { border: none !important; font-size: 16px; }
.sb-quill-view .ql-editor {
    padding: 0;
    background: transparent;
    color: var(--clr-text-secondary);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.75;
}
.sb-quill-view .ql-editor h1 { font-size: 2.25rem; font-weight: 700; margin: 2rem 0 0.875rem; color: var(--clr-text-primary); letter-spacing: -0.02em; }
.sb-quill-view .ql-editor h2 { font-size: 1.75rem;  font-weight: 700; margin: 1.75rem 0 0.75rem; color: var(--clr-text-primary); }
.sb-quill-view .ql-editor h3 { font-size: 1.375rem; font-weight: 600; margin: 1.5rem 0 0.625rem; color: var(--clr-text-primary); }
.sb-quill-view .ql-editor p  { margin: 1.25rem 0; }
.sb-quill-view .ql-editor ul, .sb-quill-view .ql-editor ol { margin: 1.25rem 0; padding-left: 1.75rem; }
.sb-quill-view .ql-editor li { margin: 0.5rem 0; }
.sb-quill-view .ql-editor blockquote {
    border-left: 3px solid #0ea5e9;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: rgba(14,165,233,0.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--clr-text-muted);
    font-style: italic;
}
.sb-quill-view .ql-editor code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(100,116,139,0.2);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #bfdbfe;
}
.sb-quill-view .ql-editor pre {
    background: rgba(5,5,15,0.8);
    border: 1px solid rgba(100,116,139,0.2);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.5rem 0;
}
.sb-quill-view .ql-editor pre code { background: transparent; padding: 0; }
.sb-quill-view .ql-editor a { color: #22d3ee; text-decoration: none; border-bottom: 1px solid rgba(34,211,238,0.3); }
.sb-quill-view .ql-editor a:hover { border-bottom-color: rgba(34,211,238,0.7); }
.sb-quill-view .ql-editor img { max-width: 100%; border-radius: var(--radius-lg); margin: 1.5rem 0; border: 1px solid var(--clr-border); }
.sb-quill-view .ql-editor strong { color: var(--clr-text-primary); font-weight: 600; }

/* ─── 面包屑 ─── */
.sb-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--clr-text-muted);
}
.sb-breadcrumb a {
    color: #22d3ee;
    text-decoration: none;
    transition: color var(--transition-fast);
}
.sb-breadcrumb a:hover { color: #67e8f9; }
.sb-breadcrumb-sep { color: var(--clr-text-disabled); }

/* ─── 分页 ─── */
.sb-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sb-page-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    color: var(--clr-text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}
.sb-page-btn:hover {
    border-color: var(--clr-border-hover);
    color: var(--clr-text-primary);
}
.sb-page-btn.current {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    border-color: transparent;
    color: #fff;
}

/* ─── 页脚 ─── */
.sb-footer {
    border-top: 1px solid rgba(30, 41, 59, 0.5);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    padding: 48px 0 32px;
}

/* ─── 滚动条 ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15,23,42,0.4); }
::-webkit-scrollbar-thumb { background: rgba(0,245,255,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,245,255,0.45); }

/* ─── 减少动画（无障碍） ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── 响应式 ─── */
@media (max-width: 640px) {
    .sb-nav { top: 8px; left: 8px; right: 8px; padding: 0 16px; }
    .sb-main { padding-top: calc(56px + 24px); }
    .sb-prose h1, .sb-quill-view .ql-editor h1 { font-size: 1.75rem; }
    .sb-prose h2, .sb-quill-view .ql-editor h2 { font-size: 1.375rem; }
}
