/* ============================================================
   World-Time.org - Blog & Article Stylesheet
   Version: 1.0.0
   ============================================================ */

/* ── Category Color System ── */
:root {
    --blog-time-guide: #2563eb;
    --blog-city-guide: #059669;
    --blog-city-travel: #7c3aed;
    --blog-finance: #d97706;
    --blog-exchange: #dc2626;
    --blog-travel-tips: #0891b2;
    --blog-tech-time: #1e293b;
    --blog-country-guide: #92400e;

    --blog-card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --blog-card-shadow-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --blog-card-radius: 12px;
    --blog-bg-card: #ffffff;
    --blog-text-body: #374151;
    --blog-border-card: #e5e7eb;
    --blog-toc-bg: #f9fafb;
    --blog-toc-border: #e5e7eb;
    --blog-progress-bar: var(--accent);
    --blog-hero-bg: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

body.dark {
    --blog-card-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
    --blog-card-shadow-hover: 0 10px 25px rgba(0,0,0,0.3), 0 4px 10px rgba(0,0,0,0.15);
    --blog-bg-card: #1a1a1a;
    --blog-text-body: #d1d5db;
    --blog-border-card: #2d2d2d;
    --blog-toc-bg: #1a1a1a;
    --blog-toc-border: #2d2d2d;
    --blog-hero-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* ── Blog Hero Banner ── */
.blog-hero {
    background: var(--blog-hero-bg);
    border-radius: 16px;
    padding: 40px 48px;
    margin-bottom: 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.blog-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.blog-hero h1 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 8px;
    color: #fff;
}
.blog-hero p {
    font-size: 1.05rem;
    opacity: 0.85;
    max-width: 600px;
    line-height: 1.6;
}

/* ── Category Navigation Tabs ── */
.blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--blog-border-card);
}
.blog-cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 15px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1.5px solid var(--blog-border-card);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.blog-cat-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-alt);
}
.blog-cat-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.blog-cat-btn .cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Category Tag Badges ── */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.cat-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cat-badge-time_guide { background: rgba(37,99,235,0.12); color: #2563eb; }
.cat-badge-time_guide::before { background: #2563eb; }
.cat-badge-city_guide { background: rgba(5,150,105,0.12); color: #059669; }
.cat-badge-city_guide::before { background: #059669; }
.cat-badge-city_travel { background: rgba(124,58,237,0.12); color: #7c3aed; }
.cat-badge-city_travel::before { background: #7c3aed; }
.cat-badge-finance { background: rgba(217,119,6,0.12); color: #d97706; }
.cat-badge-finance::before { background: #d97706; }
.cat-badge-exchange { background: rgba(220,38,38,0.12); color: #dc2626; }
.cat-badge-exchange::before { background: #dc2626; }
.cat-badge-travel_tips { background: rgba(8,145,178,0.12); color: #0891b2; }
.cat-badge-travel_tips::before { background: #0891b2; }
.cat-badge-tech_time { background: rgba(30,41,59,0.12); color: #1e293b; }
.cat-badge-tech_time::before { background: #1e293b; }
.cat-badge-country_guide { background: rgba(146,64,14,0.12); color: #92400e; }
.cat-badge-country_guide::before { background: #92400e; }
body.dark .cat-badge-tech_time { background: rgba(148,163,184,0.15); color: #94a3b8; }
body.dark .cat-badge-tech_time::before { background: #94a3b8; }

/* ── Blog Filter Bar ── */
.blog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}
.blog-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.blog-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.blog-search {
    display: flex;
    align-items: center;
    background: var(--bg-alt);
    border: 1px solid var(--blog-border-card);
    border-radius: 8px;
    padding: 0 12px;
    transition: border-color 0.2s;
}
.blog-search:focus-within {
    border-color: var(--accent);
}
.blog-search input {
    border: none;
    background: transparent;
    padding: 8px 8px;
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    width: 180px;
    font-family: inherit;
}
.blog-search input::placeholder {
    color: var(--text-muted);
}
.blog-search svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.blog-stats {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.blog-stats strong {
    color: var(--text);
}

/* ── Article Card Grid ── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.blog-card {
    background: var(--blog-bg-card);
    border: 1px solid var(--blog-border-card);
    border-radius: var(--blog-card-radius);
    box-shadow: var(--blog-card-shadow);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.blog-card:hover {
    box-shadow: var(--blog-card-shadow-hover);
    transform: translateY(-3px);
    border-color: var(--accent);
}
.blog-card-top {
    padding: 20px 20px 0 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.blog-card .cat-badge {
    margin-bottom: 10px;
    align-self: flex-start;
}
.blog-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}
.blog-card h3 a {
    color: var(--text);
    text-decoration: none;
    border: none;
}
.blog-card h3 a:hover {
    color: var(--accent);
}
.blog-card h3 a::after {
    content: '';
    position: absolute;
    inset: 0;
}
.blog-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    flex: 1;
}
.blog-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--blog-border-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-alt);
}
.blog-card-footer time {
    display: flex;
    align-items: center;
    gap: 4px;
}
.blog-card-footer .meta-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.blog-card-footer .meta-right span {
    display: flex;
    align-items: center;
    gap: 3px;
}
.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: auto;
    padding-top: 8px;
}
.blog-card-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-alt);
    color: var(--text-muted);
    border: 1px solid var(--blog-border-card);
    text-decoration: none;
    transition: all 0.2s;
}
.blog-card-tag:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Blog Layout (listing page with sidebar) ── */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
}
.blog-main {
    min-width: 0;
}
.blog-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
}

/* ── Sidebar Widgets ── */
.sidebar-widget {
    background: var(--blog-bg-card);
    border: 1px solid var(--blog-border-card);
    border-radius: var(--blog-card-radius);
    padding: 20px;
    margin-bottom: 20px;
}
.sidebar-widget h4 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}
.sidebar-popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-popular-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--blog-border-card);
}
.sidebar-popular-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.sidebar-popular-list a {
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border: none;
    line-height: 1.4;
}
.sidebar-popular-list a:hover {
    color: var(--accent);
}
.sidebar-popular-list .num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 20px;
    text-align: right;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Sidebar Category List ── */
.sidebar-cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sidebar-cat-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 0.8rem;
    border: 1px solid var(--blog-border-card);
    text-decoration: none;
    transition: all 0.2s;
}
.sidebar-cat-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Tag Cloud ── */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tag-cloud a {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-alt);
    border: 1px solid var(--blog-border-card);
    text-decoration: none;
    transition: all 0.2s;
}
.tag-cloud a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Article Detail Page ── */
.blog-article-detail {
    max-width: 820px;
    margin: 0 auto;
}
.blog-article-detail h1 {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 16px;
}
.blog-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--blog-border-card);
}
.blog-article-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.blog-article-meta .meta-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.blog-article-excerpt {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 28px;
    padding: 20px 24px;
    background: var(--bg-alt);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
}

/* ── Article TOC (Table of Contents) ── */
.blog-toc {
    background: var(--blog-toc-bg);
    border: 1px solid var(--blog-toc-border);
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 28px;
}
.blog-toc summary {
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text);
    user-select: none;
}
.blog-toc summary::-webkit-details-marker {
    color: var(--accent);
}
.blog-toc ol {
    margin-top: 12px;
    padding-left: 24px;
    list-style: decimal;
}
.blog-toc ol li {
    margin-bottom: 6px;
    font-size: 0.88rem;
}
.blog-toc ol li a {
    color: var(--text-secondary);
    text-decoration: none;
    border: none;
}
.blog-toc ol li a:hover {
    color: var(--accent);
}

/* ── Article Body Typography ── */
.article-body {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--blog-text-body);
}
.article-body h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--blog-border-card);
    color: var(--text);
    scroll-margin-top: 80px;
}
.article-body h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--text);
    scroll-margin-top: 80px;
}
.article-body h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.article-body p {
    margin-bottom: 1.2rem;
}
.article-body ul, .article-body ol {
    margin-bottom: 1.2rem;
    padding-left: 1.5rem;
}
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li {
    margin-bottom: 0.4rem;
    line-height: 1.7;
}
.article-body li ul, .article-body li ol {
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
}
.article-body a {
    color: var(--accent);
    text-decoration: underline;
    border: none;
}
.article-body a:hover {
    color: var(--accent-hover);
}
.article-body blockquote {
    margin: 1.5rem 0;
    padding: 16px 20px;
    border-left: 4px solid var(--accent);
    background: var(--bg-alt);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-secondary);
}
.article-body blockquote p:last-child {
    margin-bottom: 0;
}
.article-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 1.2rem;
}
.article-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.88em;
    background: var(--bg-alt);
    padding: 2px 6px;
    border-radius: 4px;
}
.article-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.article-body img {
    border-radius: 10px;
    margin: 1.5rem auto;
    display: block;
    max-width: 100%;
    height: auto;
}
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
}
.article-body table th,
.article-body table td {
    padding: 10px 14px;
    border: 1px solid var(--blog-border-card);
    text-align: left;
}
.article-body table th {
    background: var(--bg-alt);
    font-weight: 700;
    color: var(--text);
}
.article-body table tr:nth-child(even) {
    background: var(--bg-alt);
}
.article-body hr {
    border: none;
    border-top: 2px solid var(--blog-border-card);
    margin: 2rem 0;
}

/* ── Article Share Section ── */
.blog-share {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--blog-border-card);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.blog-share-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.blog-share a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--blog-border-card);
    transition: all 0.2s;
}
.blog-share a:hover {
    transform: translateY(-1px);
}
.share-twitter { color: #1da1f2; }
.share-twitter:hover { background: #1da1f2; color: #fff; border-color: #1da1f2; }
.share-facebook { color: #1877f2; }
.share-facebook:hover { background: #1877f2; color: #fff; border-color: #1877f2; }
.share-linkedin { color: #0a66c2; }
.share-linkedin:hover { background: #0a66c2; color: #fff; border-color: #0a66c2; }

/* ── Related Articles ── */
.blog-related {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 2px solid var(--blog-border-card);
}
.blog-related h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 20px;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.related-card {
    padding: 16px;
    border: 1px solid var(--blog-border-card);
    border-radius: var(--blog-card-radius);
    transition: all 0.2s;
}
.related-card:hover {
    border-color: var(--accent);
    box-shadow: var(--blog-card-shadow-hover);
}
.related-card .cat-badge {
    margin-bottom: 8px;
}
.related-card h4 {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
}
.related-card h4 a {
    color: var(--text);
    text-decoration: none;
    border: none;
}
.related-card h4 a:hover {
    color: var(--accent);
}

/* ── Reading Progress Bar ── */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--blog-progress-bar);
    z-index: 9999;
    width: 0;
    transition: width 0.1s ease;
}

/* ── Pagination ── */
.blog-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    margin-bottom: 32px;
}
.blog-pagination a,
.blog-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--blog-border-card);
    text-decoration: none;
    transition: all 0.2s;
}
.blog-pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.blog-pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.blog-pagination .disabled {
    opacity: 0.4;
    cursor: default;
}

/* ── Empty State ── */
.blog-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.blog-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}
.blog-empty h3 {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.blog-empty p {
    font-size: 0.92rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr 260px;
        gap: 24px;
    }
}
@media (max-width: 768px) {
    .blog-hero {
        padding: 28px 24px;
    }
    .blog-hero h1 {
        font-size: 1.5rem;
    }
    .blog-layout {
        grid-template-columns: 1fr;
    }
    .blog-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    .blog-grid {
        grid-template-columns: 1fr;
    }
    .blog-article-detail h1 {
        font-size: 1.5rem;
    }
    .blog-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .blog-search input {
        width: 100%;
    }
    .blog-categories {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
    }
    .blog-cat-btn {
        flex-shrink: 0;
    }
    .related-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 480px) {
    .blog-sidebar {
        grid-template-columns: 1fr;
    }
    .blog-hero {
        padding: 24px 16px;
        border-radius: 12px;
    }
    .blog-card-top {
        padding: 16px 16px 0 16px;
    }
    .blog-card-footer {
        padding: 10px 16px;
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }
    .blog-article-excerpt {
        padding: 16px;
        font-size: 1rem;
    }
}
