/* Daily Trends - SiYuan-inspired minimal design */

:root {
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --bg-hover: #f0f2f5;
    --text: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --gold: #f59e0b;
    --silver: #94a3b8;
    --bronze: #d97706;
    --source-hn: #ff6600;
    --source-tc: #0a9e01;
    --source-vb: #6f42c1;
    --source-arxiv: #b31b1b;
    --source-kr36: #1890ff;
    --radius: 8px;
    --max-width: 960px;
    --header-h: 56px;
}

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

body {
    font-family: -apple-system, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.logo:hover { text-decoration: none; color: var(--accent); }

.header-nav {
    display: flex;
    gap: 20px;
    flex: 1;
}

.header-nav a {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.15s;
}
.header-nav a:hover { color: var(--accent); text-decoration: none; }

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
    cursor: pointer;
    transition: all 0.15s;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; background: #eff6ff; }

.admin-link { font-size: 16px; color: var(--text-muted); }
.admin-link:hover { color: var(--accent); text-decoration: none; }

/* Content */
.site-content { min-height: calc(100vh - var(--header-h) - 80px); }

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

.section { padding: 48px 0; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: none; }

.section-header { margin-bottom: 24px; }

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.4px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.icon { font-size: 22px; }

.section-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

/* Repo Cards */
.repo-list { display: flex; flex-direction: column; gap: 0; }

.repo-card {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.repo-card:last-child { border-bottom: none; }
.repo-card:hover { background: var(--bg-hover); margin: 0 -12px; padding: 16px 12px; border-radius: var(--radius); }

.repo-rank { flex-shrink: 0; width: 36px; padding-top: 2px; }

.medal {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    font-size: 13px; font-weight: 700; color: #fff;
}
.medal.gold { background: var(--gold); }
.medal.silver { background: var(--silver); }
.medal.bronze { background: var(--bronze); }

.rank-num {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    font-size: 14px; color: var(--text-muted); font-weight: 500;
}

.repo-body { flex: 1; min-width: 0; }

.repo-name { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.repo-name a { color: var(--accent); }
.repo-name a:hover { text-decoration: underline; }

.repo-desc {
    font-size: 14px; color: var(--text-secondary);
    margin-bottom: 8px; line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

.repo-meta {
    display: flex; align-items: center; gap: 4px;
    font-size: 13px; color: var(--text-muted); flex-wrap: wrap;
}

.lang-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.meta-sep { margin: 0 2px; }

/* News Cards */
.news-list { display: flex; flex-direction: column; }

.news-card {
    display: flex; gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.news-card:last-child { border-bottom: none; }
.news-card:hover { background: var(--bg-hover); margin: 0 -12px; padding: 16px 12px; border-radius: var(--radius); }

.news-rank {
    flex-shrink: 0; width: 28px; padding-top: 3px;
    font-size: 14px; color: var(--text-muted); font-weight: 500; text-align: center;
}

.news-body { flex: 1; min-width: 0; }

.news-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.news-title a { color: var(--text); }
.news-title a:hover { color: var(--accent); }

.news-summary {
    font-size: 14px; color: var(--text-secondary); margin-bottom: 6px;
    line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--text-muted); flex-wrap: wrap;
}

.source-badge {
    display: inline-block; padding: 1px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
    color: #fff;
}
.source-hn { background: var(--source-hn); }
.source-techcrunch { background: var(--source-tc); }
.source-venturebeat { background: var(--source-vb); }
.source-arxiv { background: var(--source-arxiv); }
.source-kr36 { background: var(--source-kr36); }

/* Empty state */
.empty-state {
    text-align: center; padding: 64px 24px;
    color: var(--text-muted); font-size: 15px;
}

/* Footer */
.site-footer {
    max-width: var(--max-width); margin: 0 auto;
    padding: 32px 24px;
    color: var(--text-muted); font-size: 13px;
    border-top: 1px solid var(--border);
}
.footer-main {
    display: flex; align-items: center; justify-content: center;
    gap: 48px; flex-wrap: wrap;
}
.footer-info { text-align: center; }
.footer-meta { margin-top: 4px; }
.footer-qr {
    text-align: center; flex-shrink: 0;
}
.footer-qr img {
    border-radius: 8px; border: 2px solid var(--border);
    display: block;
}
.qr-label {
    margin-top: 6px; font-size: 12px; color: var(--text-secondary);
    line-height: 1.5;
}

/* Admin */
.admin-container { padding-top: 32px; padding-bottom: 48px; }
.admin-container h1 { font-size: 28px; margin-bottom: 24px; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }

.stat-card {
    background: var(--bg-alt); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; text-align: center;
}

.stat-value { font-size: 36px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.btn-trigger {
    background: var(--accent); color: #fff; border: none;
    padding: 10px 20px; border-radius: 6px; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-trigger:hover { background: var(--accent-hover); }

.admin-section { margin-bottom: 32px; }
.admin-section h2 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }

.data-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.data-table th { background: var(--bg-alt); padding: 10px 16px; text-align: left; font-weight: 600; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.data-table td { padding: 8px 16px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.status-success { color: #16a34a; font-weight: 600; }
.status-failed { color: #dc2626; font-weight: 600; }

.back-link { display: inline-block; margin-top: 16px; font-size: 14px; }

/* Login */
.login-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 60vh; padding-top: 48px;
}

.login-card {
    width: 100%; max-width: 400px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 12px; padding: 40px 32px;
    text-align: center; box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.login-card h1 {
    font-size: 22px; font-weight: 700; margin-bottom: 28px;
    color: var(--text); letter-spacing: -0.3px;
}

.login-form { text-align: left; }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-group input {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 15px; font-family: inherit;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.login-error {
    background: #fef2f2; color: #dc2626; border: 1px solid #fecaca;
    padding: 10px 14px; border-radius: 8px; font-size: 13px;
    margin-bottom: 16px;
}

.btn-login {
    width: 100%; padding: 12px;
    background: var(--accent); color: #fff; border: none;
    border-radius: 8px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
    font-family: inherit; letter-spacing: 1px;
}
.btn-login:hover { background: var(--accent-hover); }

/* Admin header with logout */
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}

.admin-header h1 { margin-bottom: 0; }

.btn-logout {
    background: none; border: 1px solid var(--border);
    padding: 8px 16px; border-radius: 8px; font-size: 13px;
    color: var(--text-secondary); cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.btn-logout:hover { background: var(--bg-hover); border-color: #dc2626; color: #dc2626; }

/* Hero Video */
.hero-video {
    margin-bottom: 32px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.hero-video video {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* Tooltip - JS driven, appended to body */
.t-tip {
    display: none;
    position: absolute;
    min-width: 360px;
    max-width: 500px;
    padding: 0;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.7;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    z-index: 9999;
    pointer-events: none;
    white-space: normal;
    letter-spacing: 0;
    overflow: hidden;
}
.tt-header {
    padding: 14px 18px 10px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tt-stars { font-weight: 400; font-size: 12px; color: #f59e0b; margin-left: 8px; }
.tt-meta {
    padding: 8px 18px;
    font-size: 12px;
    color: #94a3b8;
    background: rgba(255,255,255,0.04);
}
.tt-desc {
    padding: 10px 18px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.6;
}
.tt-tags {
    padding: 6px 18px 10px;
    color: #94a3b8;
    font-size: 12px;
}
.tt-tags span { color: #7dd3fc; }
.tt-section {
    padding: 0 18px 12px;
}
.tt-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    padding: 8px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.tt-section-body {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.7;
}
.tt-bullet {
    padding: 1px 0 1px 8px;
    color: #cbd5e1;
}
/* Responsive */
@media (max-width: 768px) {
    .t-tip { min-width: 280px; max-width: calc(100vw - 24px); }
    .header-nav { display: none; }
    .container { padding: 0 16px; }
    .section { padding: 32px 0; }
    .section-header h2 { font-size: 20px; }
    .repo-card, .news-card { gap: 12px; }
    .stats-grid { grid-template-columns: 1fr; }
}
