/**
 * Lianjie Theme: onyx
 * 风格：黑曜石 — 从 ClickHouse 终端美学进化的精致暗黑
 * 描述：深邃渐变底色 + 克制霓虹点缀 + 充裕留白
 *       ClickHouse 的灵魂，更舒适的日常体验
 */

/* ═══════════════════════════════════════════════════
   CSS Variables
   ═══════════════════════════════════════════════════ */
:root {
    /* 背景：从纯黑进化为有深度的暗色 */
    --bg-base: #08080d;
    --bg-surface: #0e0e15;
    --bg-card: rgba(255, 255, 255, 0.025);
    --bg-card-hover: rgba(255, 255, 255, 0.05);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-glass: rgba(14, 14, 21, 0.7);

    /* 文字 */
    --text-primary: #ececf0;
    --text-secondary: #8b8b96;
    --text-tertiary: #53535e;

    /* 强调色：保留 ClickHouse 的霓虹黄绿基因，用得更克制 */
    --accent: #faff69;
    --accent-soft: rgba(250, 255, 105, 0.12);
    --accent-glow: rgba(250, 255, 105, 0.2);

    /* 边框 */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(250, 255, 105, 0.25);

    /* 圆角：从 4px 锐角微调为更友好的弧线 */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    /* 间距：8pt 网格 */
    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --space-6: 3rem;
    --space-8: 4rem;
    --space-12: 6rem;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 24px rgba(250, 255, 105, 0.06);

    /* 动效 */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.25s;
    --duration-slow: 0.4s;

    /* 语义色（从原主题继承） */
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

/* ═══════════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    -webkit-tap-highlight-color: transparent;
    background: var(--bg-base);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(250, 255, 105, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 50% 100%, rgba(250, 255, 105, 0.02) 0%, transparent 60%),
        var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════
   Layout Utilities
   ═══════════════════════════════════════════════════ */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--space-3);
}
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-dim { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }
.mt-2 { margin-top: var(--space-1); }
.mt-4 { margin-top: var(--space-2); }
.mt-6 { margin-top: var(--space-3); }
.mt-8 { margin-top: var(--space-4); }
.mt-12 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-1); }
.mb-4 { margin-bottom: var(--space-2); }
.mb-6 { margin-bottom: var(--space-3); }
.mb-8 { margin-bottom: var(--space-4); }
.mb-12 { margin-bottom: var(--space-6); }
.py-12 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-16 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }

/* ═══════════════════════════════════════════════════
   Typography
   ═══════════════════════════════════════════════════ */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.text-base { font-size: 0.9375rem; }
.text-lg { font-size: 1.0625rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ═══════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-default);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-out);
    outline: none;
}
.btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}
.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--accent-soft);
}
.btn-primary {
    background: var(--accent);
    color: #111;
    border-color: var(--accent);
    font-weight: 600;
}
.btn-primary:hover {
    background: #e8ed55;
    color: #111;
}
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-ghost {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}
.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* ═══════════════════════════════════════════════════
   Inputs
   ═══════════════════════════════════════════════════ */
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all var(--duration-fast) var(--ease-out);
    outline: none;
}
.input::placeholder { color: var(--text-tertiary); }
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-lg { padding: 1rem 1.25rem; font-size: 1.0625rem; }

/* ═══════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    transition: all var(--duration-normal) var(--ease-out);
}
.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}
.card-body { padding: 1.25rem; }

/* ═══════════════════════════════════════════════════
   Clock — 精致超大数字显示屏
   ═══════════════════════════════════════════════════ */
.clock-section {
    text-align: center;
    margin-bottom: var(--space-3);
    user-select: none;
}
.clock-time {
    font-size: 4.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 60px rgba(250, 255, 105, 0.04);
}
.clock-date {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    letter-spacing: 0.02em;
}
.clock-divider {
    width: 40px;
    height: 1.5px;
    background: var(--accent);
    margin: 1rem auto 0;
    border: none;
    opacity: 0.5;
    border-radius: 1px;
}

/* ═══════════════════════════════════════════════════
   Search Section
   ═══════════════════════════════════════════════════ */
.search-section {
    text-align: center;
    margin-bottom: var(--space-8);
}
.search-box {
    position: relative;
    max-width: 520px;
    margin: 0 auto var(--space-3);
}
.search-box input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    padding-right: 3.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 400;
    transition: all var(--duration-normal) var(--ease-out);
    outline: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 0 32px rgba(250, 255, 105, 0.04);
    background: rgba(255, 255, 255, 0.06);
}
.search-box input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}
.search-box .search-icon {
    position: absolute;
    right: 1.125rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    font-size: 0.875rem;
    opacity: 0.6;
}

/* 搜索引擎切换 */
.engine-toggle {
    display: inline-flex;
    gap: 0;
    background: var(--bg-card);
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    padding: 3px;
}
.engine-toggle button {
    padding: 0.375rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    border-radius: 999px;
    outline: none;
}
.engine-toggle button.active {
    background: var(--accent);
    color: #111;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.engine-toggle button:hover:not(.active) {
    color: var(--text-primary);
}
.engine-toggle button:focus-visible {
    box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ═══════════════════════════════════════════════════
   Bookmark Cards
   ═══════════════════════════════════════════════════ */
.bookmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 0.625rem;
}
.bookmark-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
}
.bookmark-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(250, 255, 105, 0.05), 0 4px 12px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}
.bookmark-card .favicon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: var(--bg-input);
    padding: 5px;
    transition: transform var(--duration-normal) var(--ease-out);
}
.bookmark-card:hover .favicon {
    transform: scale(1.08);
}
.bookmark-card .favicon-placeholder {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.bookmark-card .title {
    font-size: 0.8125rem;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: var(--text-secondary);
    transition: color var(--duration-fast);
}
.bookmark-card:hover .title {
    color: var(--text-primary);
}
.bookmark-card .lock-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    color: var(--accent);
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════
   Group Section
   ═══════════════════════════════════════════════════ */
.group-section {
    margin-bottom: var(--space-6);
}
.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
    padding: 0 0.25rem;
}
.group-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.group-header a {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
    transition: color var(--duration-fast);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.group-header a:hover { color: var(--accent); }
.group-header a::after {
    content: '→';
    font-size: 0.75rem;
}

/* ═══════════════════════════════════════════════════
   Group Page (独立分组展示页)
   ═══════════════════════════════════════════════════ */
.group-page-header {
    margin-bottom: var(--space-6);
}
.group-page-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    transition: color var(--duration-fast);
}
.group-page-header .back-link:hover { color: var(--accent); }
.group-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}
.group-page-desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.6;
}
.group-page-divider {
    width: 36px;
    height: 2px;
    background: var(--accent);
    margin: 0.75rem 0;
    border: none;
    opacity: 0.4;
    border-radius: 1px;
}

/* ═══════════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-3);
    color: var(--text-secondary);
}
.empty-state .empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-3);
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-tertiary);
}
.empty-state h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.empty-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

/* ═══════════════════════════════════════════════════
   Admin Float Button
   ═══════════════════════════════════════════════════ */
.admin-float {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 40;
}
.admin-float a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    transition: all var(--duration-fast) var(--ease-out);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.admin-float a:hover {
    background: var(--accent);
    color: #111;
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(250, 255, 105, 0.15);
}

/* ═══════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════ */
.site-footer {
    text-align: center;
    padding: var(--space-4) var(--space-2);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.5;
}
.site-footer a { color: var(--text-tertiary); }
.site-footer a:hover { color: var(--accent); opacity: 1; }

/* ═══════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .clock-time { font-size: 3.25rem; }
    .search-box { max-width: 100%; }
    .container { padding: 0 var(--space-2); }
    .bookmark-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .bookmark-card { padding: 0.875rem 0.375rem; }
    .bookmark-card .favicon,
    .bookmark-card .favicon-placeholder { width: 28px; height: 28px; }
    .group-page-title { font-size: 1.5rem; }
    .empty-state { padding: var(--space-8) var(--space-2); }
}

@media (max-width: 480px) {
    .bookmark-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .clock-time { font-size: 2.75rem; }
    .search-box input { padding: 0.75rem 1rem; font-size: 0.875rem; }
    .engine-toggle button { padding: 0.3125rem 0.75rem; font-size: 0.75rem; }
}

/* ═══════════════════════════════════════════════════
   Page entry animation
   ═══════════════════════════════════════════════════ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.animate-in {
    animation: fadeUp var(--duration-slow) var(--ease-out) both;
}
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
