/* ─── Blog Layout ─── */
.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.blog-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.blog-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

/* ─── Blog Layout: Sidebar + Main ─── */
.blog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

@media (max-width: 820px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
}

/* ─── Sidebar ─── */
.sidebar-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    margin-bottom: 1.5rem;
}

.sidebar-card h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #6366f1;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 0.5rem;
}

.category-list a {
    display: block;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.category-list a:hover,
.category-list a.active {
    background: #6366f1;
    color: #fff;
}

.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-list li {
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.popular-list li:last-child {
    border-bottom: none;
}

.popular-list a {
    display: block;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
}

.popular-list a:hover {
    color: #6366f1;
}

.popular-list small {
    font-size: 0.75rem;
}

/* ─── Search ─── */
.search-bar .form-control {
    border-radius: 24px;
    padding: 0.75rem 1.25rem;
    background: #f7f7f9;
    border: none;
}

/* ─── Featured Section ─── */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
    border-right: 3px solid #6366f1;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.featured-card {
    display: block;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: #1a1a1a;
    transition: transform 0.2s, box-shadow 0.2s;
}

.featured-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.featured-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.featured-body {
    padding: 1.25rem;
}

.featured-body h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.featured-body p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
}

/* ─── Article Grid ─── */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.article-card {
    display: block;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: #1a1a1a;
    transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.article-img-wrapper {
    height: 180px;
    overflow: hidden;
}

.article-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.article-card:hover .article-img {
    transform: scale(1.05);
}

.article-body {
    padding: 1.25rem;
}

.article-body h4,
.article-body h5 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0.5rem 0;
    line-height: 1.4;
}

.article-summary {
    font-size: 0.82rem;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.75rem;
}

/* ─── Article Page ─── */
.blog-article-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.breadcrumb a {
    color: #6366f1;
    text-decoration: none;
}

.breadcrumb .active {
    color: #999;
}

.article-cover {
    margin-bottom: 2rem;
    border-radius: 16px;
    overflow: hidden;
}

.article-cover img {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
}

.article-header h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.article-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.article-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2rem;
}

@media (max-width: 820px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
}

/* ─── Table of Contents ─── */
.article-toc {
    position: sticky;
    top: 2rem;
    align-self: start;
}

.article-toc h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.35rem;
}

.toc-list a {
    color: #555;
    text-decoration: none;
    font-size: 0.82rem;
    line-height: 1.4;
    transition: color 0.2s;
}

.toc-list a:hover {
    color: #6366f1;
}

.toc-level-3 {
    padding-right: 1rem;
}

/* ─── Article Content ─── */
.article-content {
    font-size: 1rem;
    line-height: 1.9;
    color: #333;
}

.article-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eaeaea;
}

.article-content h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.article-content blockquote {
    border-right: 3px solid #6366f1;
    padding-right: 1rem;
    margin: 1.5rem 0;
    color: #666;
    font-style: italic;
}

.article-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 1.25rem;
    border-radius: 12px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 1.5rem 0;
}

.article-content code {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-content th,
.article-content td {
    border: 1px solid #e0e0e0;
    padding: 0.75rem;
    text-align: right;
}

.article-content th {
    background: #f7f7f9;
    font-weight: 700;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0;
    padding-right: 1.5rem;
}

.article-content li {
    margin-bottom: 0.25rem;
}

.article-content a {
    color: #6366f1;
    text-decoration: underline;
}

/* ─── Article Footer ─── */
.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eaeaea;
}

.article-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.article-tags span {
    font-size: 0.85rem;
    color: #666;
}

.tag-badge {
    display: inline-block;
    background: #f0f0f5;
    color: #555;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.2s;
}

.tag-badge:hover {
    background: #6366f1;
    color: #fff;
}

.share-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.share-section span {
    font-size: 0.85rem;
    color: #666;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn:hover {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

.article-prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.prev-next-link {
    display: block;
    background: #f7f7f9;
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: #1a1a1a;
    transition: background 0.2s;
}

.prev-next-link:hover {
    background: #eeeef5;
}

.prev-next-link small {
    font-size: 0.75rem;
    color: #6366f1;
    display: block;
    margin-bottom: 0.25rem;
}

.prev-next-link span {
    font-size: 0.9rem;
    font-weight: 600;
}

/* ─── Related Articles ─── */
.related-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eaeaea;
}

.related-section h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* ─── Pagination ─── */
.pagination-nav .page-link {
    border-radius: 8px;
    margin: 0 2px;
    color: #6366f1;
    border: none;
    padding: 0.5rem 0.9rem;
}

.pagination-nav .page-item.active .page-link {
    background: #6366f1;
    color: #fff;
}
