/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-card: #1E293B;
    --bg-hover: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --green: #10B981;
    --orange: #F59E0B;
    --pink: #EC4899;
    --purple: #8B5CF6;
    --red: #EF4444;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0,0,0,.3);
    --radius: 12px;
    --radius-sm: 8px;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-heading: 'Space Grotesk', 'Inter', sans-serif;
}

[data-theme="light"] {
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-hover: #E2E8F0;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,.08);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background .3s, color .3s;
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(12px);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 64px; gap: 24px;
}
.logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }
.logo:hover { color: var(--text-primary); }
.logo-icon { font-size: 1.5rem; }
.logo-accent { color: var(--accent); }
.nav { display: flex; gap: 24px; }
.nav a { color: var(--text-secondary); font-size: .9rem; font-weight: 500; }
.nav a:hover { color: var(--text-primary); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
    background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
    width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-primary); transition: all .2s;
}
.theme-toggle:hover { background: var(--bg-hover); }
.menu-toggle {
    display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px;
}
.menu-toggle span { display: block; width: 22px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: all .3s; }

/* ===== Main Grid ===== */
.main { padding: 32px 0; }
.main-grid { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }

/* ===== Hero Card ===== */
.hero-card {
    position: relative; border-radius: var(--radius); overflow: hidden;
    margin-bottom: 32px; min-height: 320px; display: flex; align-items: flex-end;
}
.hero-gradient {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 50%, #0EA5E9 100%);
}
[data-theme="light"] .hero-gradient {
    background: linear-gradient(135deg, #3B82F6 0%, #60A5FA 50%, #38BDF8 100%);
}
.hero-content {
    position: relative; z-index: 1; padding: 40px; color: #fff;
}
.hero-title { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; line-height: 1.2; margin-bottom: 12px; }
.hero-title a { color: #fff; }
.hero-title a:hover { color: #E0F2FE; }
.hero-excerpt { font-size: 1.05rem; opacity: .9; margin-bottom: 16px; max-width: 640px; }
.hero-card .meta { color: rgba(255,255,255,.75); }

/* ===== Category Tags ===== */
.category-tag {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: 12px;
}
.tag-ai { background: rgba(139,92,246,.2); color: #A78BFA; }
.tag-smartphones { background: rgba(59,130,246,.2); color: #60A5FA; }
.tag-gadgets { background: rgba(16,185,129,.2); color: #34D399; }
.tag-software { background: rgba(245,158,11,.2); color: #FBBF24; }
.tag-science { background: rgba(236,72,153,.2); color: #F472B6; }

/* ===== News Grid ===== */
.news-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.news-card {
    display: flex; background: var(--bg-card); border-radius: var(--radius);
    overflow: hidden; border: 1px solid var(--border);
    transition: transform .2s, box-shadow .2s;
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-accent { width: 5px; flex-shrink: 0; }
.tag-ai { background-color: #8B5CF6; }
.tag-smartphones { background-color: #3B82F6; }
.tag-gadgets { background-color: #10B981; }
.tag-software { background-color: #F59E0B; }
.tag-science { background-color: #EC4899; }
.card-body { padding: 20px; flex: 1; }
.card-title { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; line-height: 1.3; margin-bottom: 8px; }
.card-title a { color: var(--text-primary); }
.card-title a:hover { color: var(--accent); }
.card-excerpt { color: var(--text-secondary); font-size: .9rem; line-height: 1.6; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; gap: 16px; font-size: .8rem; color: var(--text-muted); }
.meta-read::before { content: '·'; margin-right: 16px; }

/* ===== Sidebar ===== */
.sidebar-section {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.sidebar-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 600; margin-bottom: 16px; }
.trending-list { list-style: none; }
.trending-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.trending-list li:last-child { border-bottom: none; }
.trending-list a { color: var(--text-secondary); font-size: .9rem; }
.trending-list a:hover { color: var(--accent); }
.sidebar-text { color: var(--text-secondary); font-size: .85rem; margin-bottom: 12px; }
.newsletter-form { display: flex; gap: 8px; }
.newsletter-input {
    flex: 1; padding: 10px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-primary);
    color: var(--text-primary); font-size: .85rem;
}
.newsletter-btn {
    padding: 10px 16px; border-radius: var(--radius-sm); border: none;
    background: var(--accent); color: #fff; font-weight: 600; font-size: .85rem;
    cursor: pointer; white-space: nowrap;
}
.newsletter-btn:hover { background: var(--accent-hover); }

/* ===== Ad Spaces ===== */
.ad-space {
    border: 2px dashed var(--border); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: .8rem; margin: 24px 0;
    background: var(--bg-secondary);
}
.ad-banner { height: 90px; max-width: 728px; margin-left: auto; margin-right: auto; }
.ad-rectangle { height: 250px; max-width: 300px; }
.ad-sidebar { height: 600px; width: 160px; margin: 0 auto; }

/* ===== Article Page ===== */
.article-page { max-width: 800px; }
.article-header { margin-bottom: 32px; }
.article-title { font-family: var(--font-heading); font-size: 2.2rem; font-weight: 700; line-height: 1.2; margin-bottom: 16px; }
.article-meta { display: flex; align-items: center; gap: 16px; color: var(--text-muted); font-size: .9rem; margin-bottom: 16px; }
.article-meta .author { color: var(--text-primary); font-weight: 600; }
.article-body { font-size: 1.05rem; line-height: 1.85; color: var(--text-secondary); }
.article-body h2 { font-family: var(--font-heading); font-size: 1.5rem; color: var(--text-primary); margin: 36px 0 16px; }
.article-body h3 { font-family: var(--font-heading); font-size: 1.2rem; color: var(--text-primary); margin: 28px 0 12px; }
.article-body p { margin-bottom: 20px; }
.article-body ul, .article-body ol { margin-bottom: 20px; padding-left: 24px; }
.article-body li { margin-bottom: 8px; }
.article-body blockquote {
    border-left: 4px solid var(--accent); padding: 16px 24px;
    background: var(--bg-secondary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 24px 0; font-style: italic; color: var(--text-primary);
}

/* ===== Amazon Product Card ===== */
.product-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin: 24px 0;
    display: flex; gap: 20px; align-items: center;
}
.product-card .product-img {
    width: 120px; height: 120px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-hover));
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; flex-shrink: 0;
}
.product-card .product-info h4 { font-size: 1rem; margin-bottom: 8px; }
.product-card .product-info .price { color: var(--green); font-weight: 700; font-size: 1.2rem; margin-bottom: 8px; }
.product-card .product-info .buy-btn {
    display: inline-block; padding: 8px 20px; border-radius: var(--radius-sm);
    background: var(--orange); color: #000; font-weight: 700; font-size: .85rem;
}
.product-card .product-info .buy-btn:hover { background: #D97706; color: #000; }
.product-card .affiliate-note { font-size: .7rem; color: var(--text-muted); margin-top: 8px; }

/* ===== Footer ===== */
.footer { background: var(--bg-secondary); border-top: 1px solid var(--border); margin-top: 60px; padding: 40px 0 0; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-col h4 { font-family: var(--font-heading); font-size: .95rem; font-weight: 600; margin-bottom: 16px; }
.footer-col p { color: var(--text-secondary); font-size: .85rem; line-height: 1.6; }
.footer-col a { display: block; color: var(--text-secondary); font-size: .85rem; padding: 4px 0; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; margin-top: 32px; }
.footer-bottom p { color: var(--text-muted); font-size: .8rem; text-align: center; }
.footer-bottom a { color: var(--text-muted); }
.footer-bottom a:hover { color: var(--accent); }

/* ===== Back to Top ===== */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px;
    border-radius: 50%; border: none; background: var(--accent); color: #fff;
    font-size: 1.2rem; cursor: pointer; opacity: 0; transform: translateY(20px);
    transition: all .3s; z-index: 99; display: flex; align-items: center; justify-content: center;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--accent-hover); }

/* ===== Responsive ===== */
@media (max-width: 968px) {
    .main-grid { grid-template-columns: 1fr; }
    .sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    .ad-sidebar { width: 100%; height: 250px; }
}
@media (max-width: 768px) {
    .nav { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 16px 20px; gap: 12px; }
    .nav.open { display: flex; }
    .menu-toggle { display: flex; }
    .news-grid { grid-template-columns: 1fr; }
    .hero-title { font-size: 1.5rem; }
    .hero-content { padding: 24px; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .sidebar { grid-template-columns: 1fr; }
    .article-title { font-size: 1.6rem; }
    .product-card { flex-direction: column; text-align: center; }
}

/* ===== Article Interactions (Like / Bookmark) ===== */
.article-interactions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    margin: 32px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.interaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    user-select: none;
}
.interaction-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.interaction-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(59,130,246,.1);
}
.interaction-btn .icon {
    font-size: 1.1rem;
    transition: transform .2s;
}
.interaction-btn.active .icon {
    transform: scale(1.15);
}
.interaction-btn.bookmark-btn.active {
    border-color: var(--orange);
    color: var(--orange);
    background: rgba(245,158,11,.1);
}
.interaction-count {
    font-variant-numeric: tabular-nums;
}

/* ===== Giscus Comments Section ===== */
.giscus-section {
    margin-top: 40px;
    padding-top: 32px;
}
.giscus-section h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}
.giscus-wrapper {
    max-width: 100%;
}

/* ===== Article Tabs ===== */
.article-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 4px;
    width: fit-content;
}
.tab-btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.tab-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,.3);
}

/* ===== Hero Badge ===== */
.hero-badge {
    display: inline-block;
    background: linear-gradient(135deg, #EF4444, #F59E0B);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

/* ===== Trending Rank ===== */
.trending-rank {
    display: inline-block;
    min-width: 28px;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--accent);
    margin-right: 6px;
}

/* ===== Article Page Two-Column Layout ===== */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}
@media (max-width: 960px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
}
.article-layout .article-main {
    min-width: 0;
}
.article-layout .article-sidebar {
    position: sticky;
    top: 80px;
}

/* ===== Hot Comments Section ===== */
.hot-comments {
    margin-top: 28px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.hot-comments h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.hot-comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.hot-comment-item:last-child {
    border-bottom: none;
}
.hot-comment-text {
    font-style: italic;
    color: var(--text-primary);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 6px;
}
.hot-comment-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}
.hot-comment-likes {
    color: var(--accent);
    font-weight: 600;
}
.hot-comments-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px 0;
}

/* ===== Article Sidebar (article page) ===== */
.article-sidebar .sidebar-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.article-sidebar .sidebar-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}
.article-sidebar .trending-list {
    list-style: none;
    padding: 0;
}
.article-sidebar .trending-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.article-sidebar .trending-list li:last-child {
    border-bottom: none;
}
.article-sidebar .trending-list a {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.4;
    transition: color .2s;
}
.article-sidebar .trending-list a:hover {
    color: var(--accent);
}

/* ===== Related Articles ===== */
.related-articles {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}
.related-articles h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: 1fr;
    }
}
.related-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    transition: border-color .2s, transform .2s;
}
.related-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.related-card .category-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
}
.related-card h4 {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 600;
    margin: 8px 0;
    line-height: 1.4;
}
.related-card h4 a {
    color: var(--text-primary);
}
.related-card h4 a:hover {
    color: var(--accent);
}
.related-card .meta-date {
    font-size: 0.78rem;
}

/* Article Hero Image */
.article-hero-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 24px;
    position: relative;
}
.article-hero-image img {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.article-hero-image:hover img {
    transform: scale(1.02);
}

/* Comment Sort Info */
.comment-sort-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    font-size: 0.85rem;
}
.comment-sort-info .sort-label {
    font-weight: 600;
    color: var(--text-primary);
}
.comment-sort-info .sort-hint {
    color: var(--text-secondary);
    font-style: italic;
}

/* Visitor Counter */
.visitor-counter {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}
.counter-icon {
    font-size: 1rem;
}
.counter-label {
    color: var(--text-muted);
}
.counter-number {
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    min-width: 30px;
}
