/* Styles specific to blog pages (article listing and individual articles) */

/* General article container for overall layout */
.article-container {
    max-width: 960px; /* Increased max-width for overall layout */
    margin: 0 auto;
    padding: 20px;
    display: block; /* Default to single column for mobile */
}

/* Two-column layout for article main content and TOC on desktop */
@media (min-width: 992px) { /* Apply two-column layout on desktop and larger screens */
    .article-container {
        display: grid;
        grid-template-columns: 1fr 300px; /* Main content on left, TOC on right */
        gap: 40px; /* Space between columns */
        align-items: start; /* Align items to the start of their grid area */
    }
}

/* Wrapper for article header, content, and share buttons */
.article-content-wrapper {
    /* This div now contains the header, article body, and share buttons */
    /* It will occupy the first column of the .article-container grid on desktop */
}

.article-header {
    margin-bottom: 30px;
    background: transparent;
}
.article-meta {
    color: #666;
    font-size: 0.9rem;
    margin: 15px 0;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center; /* Align items vertically in the meta section */
}
.author-info {
    display: flex;
    align-items: center; /* Align avatar and name horizontally */
    gap: 8px; /* Space between avatar and name */
}
.author-avatar {
    width: 30px; /* Size of the avatar */
    height: 30px;
    border-radius: 50%; /* Make it circular */
    object-fit: cover; /* Ensure image covers the area */
}
.article-content {
    line-height: 1.8;
    font-size: 1.1rem;
}
.article-content h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.8rem;
}
.article-content h3 {
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.4rem;
}
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}
.article-content p {
    margin: 15px 0;
}
.article-content ul, .article-content ol {
    margin: 15px 0;
    padding-left: 30px;
}
.article-content blockquote {
    border-left: 4px solid #007bff;
    margin: 20px 0;
    padding: 10px 20px;
    background: #f8f9fa;
    font-style: italic;
    color: #555;
}
.article-content pre {
    background: #f4f4f4;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 20px 0;
}
.article-content code {
    background: #f4f4f4;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}
.article-content th, .article-content td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}
.article-content th {
    background-color: #f8f9fa;
    font-weight: bold;
}
.article-content tr:nth-child(even) {
    background-color: #f9f9f9;
}
.article-content iframe {
    max-width: 100%;
    margin: 20px 0;
}
.article-content a {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.article-content a:hover {
    border-bottom-color: #007bff;
}
.toc {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 30px 0; /* Default margin for TOC on smaller screens */
    display:none
}
.toc h3 {
    margin-top: 0;
    font-size: 1.2rem;
}
.toc ul {
    list-style: none;
    padding-left: 0;
}
.toc li {
    margin: 8px 0;
}
.toc a {
    color: #444;
    text-decoration: underline;
}
.tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 30px 0;
}
.tag {
    background: #e9ecef;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    color: #495057;
}
.related-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.related-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}
.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.breadcrumb {
    margin: 20px 0;
    font-size: 0.9rem;
}
.breadcrumb a {
    color: #007bff;
    text-decoration: none;
}
.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 30px 0;
}
/* Re-style .share-btn for icons */
.share-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px; /* Square buttons */
    height: 40px;
    padding: 0; /* Remove padding for icon buttons */
    border-radius: 50%; /* Make them round */
    text-decoration: none;
    color: white; /* Icon color */
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}

.share-btn svg {
    width: 20px; /* Size of the icon */
    height: 20px;
    stroke: currentColor; /* Ensure icon color is white */
    stroke-width: 2; /* Adjust stroke-width if needed */
}

/* Specific background colors for social media buttons */
.share-btn-facebook {
    background: #1877f2;
}
.share-btn-facebook:hover {
    background: #155bb5;
}

.share-btn-twitter {
    background: #1da1f2;
}
.share-btn-twitter:hover {
    background: #1a8ad6;
}

.share-btn-linkedin {
    background: #0077b5;
}
.share-btn-linkedin:hover {
    background: #005a8d;
}


/* Styles for views/blog/index.ejs */
.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.blog-header {
    text-align: center;
    margin-bottom: 40px;
}

.blog-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.blog-subtitle {
    color: #666;
    font-size: 1.1rem;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

.no-articles-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

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

.article-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-card-link {
    display: block;
}

.article-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.article-card-content {
    padding: 20px;
}

.article-card-category {
    display: inline-block;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.article-card-title {
    font-size: 1.4rem;
    margin: 10px 0;
}

.article-card-title a {
    color: #333;
    text-decoration: none;
}

.article-card-excerpt {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 10px 0;
}

.article-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-size: 0.85rem;
    color: #999;
}

.article-card-readmore {
    display: inline-block;
    margin-top: 15px;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination-link {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.pagination-link:hover {
    background-color: #f0f0f0;
}

.pagination-current {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border-radius: 4px;
}

.pagination-dots {
    padding: 8px 16px;
}

/* Sidebar styles */
.sidebar-block {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.sidebar-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

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

.sidebar-list-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-list-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.sidebar-list-item a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    display: block;
    margin-bottom: 5px;
}

.sidebar-list-item small {
    color: #999;
}

/* Que Choisir Inspired Article Styles */
/* General typography for article content */
.article-content {
    font-family: Arial, sans-serif; /* Adjust to project's font or a similar sans-serif */
    color: #333;
    line-height: 1.6;
    font-size: 1rem;
}

.article-content p {
    margin-bottom: 1em;
    text-align: justify; /* Que Choisir often uses justified text */
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: #1a1a1a;
    margin-top: 1em;
    margin-bottom: 0.8em;
    line-height: 1.2;
}

.article-content h1 {
    font-size: 2.2em;
    font-weight: bold;
}

.article-content h2 {
    font-size: 1.8em;
    font-weight: bold;
    padding-bottom: 0.5em;
}

.article-content h3 {
    font-size: 1.4em;
    font-weight: bold;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.article-content ul li {
    list-style-type: disc;
    margin-bottom: 0.5em;
}

.article-content ol li {
    list-style-type: decimal;
    margin-bottom: 0.5em;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block; /* Center images */
    margin: 1.5em auto;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.article-content blockquote {
    border-left: 4px solid #007bff; /* Primary blue color */
    padding: 1em 1.5em;
    margin: 1.5em 0;
    background-color: #f8f9fa; /* Light grey background */
    font-style: italic;
    color: #555;
}

/* Adjustments for the article meta information */
.article-meta span {
    margin-right: 15px;
    color: #777;
    font-size: 0.95em;
}

.article-header {
    margin-bottom: 2em;
}

/* Two-column layout for article content and TOC */
/* Removed .article-main-content-layout rules, now applying to .article-container */

@media (min-width: 992px) { /* Apply two-column layout on desktop and larger screens */
    .article-container {
        grid-template-columns: 1fr 300px; /* Main content on left, TOC on right */
        gap: 40px; /* Space between columns */
    }

    /* Style the main content wrapper to ensure it spans correctly if needed, or just flows */
    .article-content-wrapper {
        /* No specific grid properties needed here if it's the first child and grid-column is implicit */
    }

    .toc {
        margin: 0; /* Remove vertical margin when in a grid column */
        position: sticky; /* Make TOC sticky */
        top: 70px; /* Distance from top of viewport */
        margin-top: 70px;
        display:block;
    }
}