/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
    line-height: 1.6;
}

/* Container for centered content */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Header Styles */
header {
    background-color: #ffffff;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

header .logo a {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

.site-logo {
    max-height: 50px;
    width: auto;
}

header nav {
    flex-grow: 1;
}

header nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: center;
}

header nav ul li {
    margin: 0 15px;
}

header nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: color 0.3s ease;
}

header nav a:hover {
    color: #007BFF;
}

/* Search Form Styles */
.search-form {
    position: relative;
}

.search-form input[type="text"] {
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 40px 8px 15px;
    width: 200px;
    transition: width 0.3s ease-in-out;
}

.search-form input[type="text"]:focus {
    width: 250px;
    outline: none;
    border-color: #007BFF;
}

.search-form button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #777;
}

/* Main Content & Sidebar Layout */
.content-area {
    display: flex;
    gap: 30px;
    margin-top: 40px;
}

.main-content {
    flex: 1; /* Takes up remaining space */
    min-width: 0; /* Prevents content from overflowing */
}

.sidebar {
    width: 250px; /* Updated width */
    flex-shrink: 0; /* Prevents sidebar from shrinking */
}

/* Sidebar Widget Styles */
.widget {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.widget-title {
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

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

.widget ul li {
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}
.widget ul li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.widget ul li a {
    text-decoration: none;
    color: #007BFF;
}

.widget ul li a:hover {
    text-decoration: underline;
}

/* Tag Cloud Widget Styles */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-cloud a {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.tag-cloud a:hover {
    background-color: #007BFF;
    color: #fff;
}

/* Main Content Styles */
main.container {
    padding-top: 40px;
    padding-bottom: 40px;
}

h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-align: center;
}

/* Articles Grid Layout (Now a Card List) */
.articles-grid {
    display: grid;
    grid-template-columns: 1fr; /* Changed to a single column */
    gap: 30px;
}

/* Article Preview Styles */
.article-preview {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.article-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.08);
}

.featured-image-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.article-preview-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.category-link-preview {
    display: inline-block;
    background-color: #007BFF;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    text-decoration: none;
    margin-bottom: 10px;
    align-self: flex-start;
    transition: background-color 0.3s ease;
}

.category-link-preview:hover {
    background-color: #0056b3;
}

.article-preview h2, .article-preview h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.article-preview h2 a, .article-preview h3 a {
    text-decoration: none;
    color: #0056b3;
}

.article-preview h2 a:hover, .article-preview h3 a:hover {
    color: #007BFF;
}

.article-meta {
    font-size: 0.9em;
    color: #777;
    margin-top: auto; /* Pushes meta to the bottom */
    padding-top: 15px;
}

/* Single Article Page Styles */
.featured-image-container {
    border-radius: 8px;
    overflow: hidden;
    line-height: 0; /* Crucial fix for the white space */
    margin-bottom: 25px;
}

.full-article-image {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
    display: block; 
    vertical-align: bottom;
}

.full-article {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px 40px;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.full-article h1 {
    margin-top: 0;
    font-size: 2.8em;
    line-height: 1.2;
    text-align: left;
}

.article-meta .category-link {
    font-weight: bold;
    color: #007BFF;
    text-decoration: none;
}
.article-meta .category-link:hover {
    text-decoration: underline;
}

.article-content {
    margin-top: 25px;
    font-size: 1.1em;
    line-height: 1.8;
}

/* Underline links within the main article content on hover */
.article-content a {
    color: #007BFF;
    text-decoration: underline;
}
.article-content a:hover {
    color: #0056b3;
}

.tags-list {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.tag-link {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 5px 12px;
    margin: 5px 5px 5px 0;
    border-radius: 15px;
    font-size: 0.9em;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.tag-link:hover {
    background-color: #ced4da;
    color: #212529;
}

.back-link {
    display: block;
    text-align: center;
    color: #007BFF;
    text-decoration: none;
    font-weight: bold;
    margin-top: 20px;
}

.back-link:hover {
    text-decoration: underline;
}

/* Social Sharing Styles */
.social-sharing {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    font-size: 1.1em;
    transition: opacity 0.3s ease;
}

.share-link:hover {
    opacity: 0.8;
}

.share-link.facebook { background-color: #3b5998; }
.share-link.twitter { background-color: #1da1f2; }
.share-link.linkedin { background-color: #0077b5; }
.share-link.email { background-color: #777; }

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    padding: 30px 0;
    margin-top: 20px;
    list-style: none;
}

.page-link {
    color: #007BFF;
    text-decoration: none;
    padding: 10px 15px;
    margin: 0 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

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

.page-link.active {
    background-color: #007BFF;
    color: #fff;
    border-color: #007BFF;
}

/* Contact Page Styles */
.contact-container {
    max-width: 700px;
    margin: 20px auto 0 auto;
}

.contact-intro {
    margin-bottom: 30px;
    font-size: 1.1em;
    line-height: 1.8;
}

.contact-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.contact-form input[type="text"],
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1em;
}

.contact-form .form-group {
    margin-bottom: 20px;
}

.contact-form .help-block {
    color: #dc3545;
    font-size: 0.9em;
    margin-top: 5px;
}

.alert-success {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-danger {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Comments Section Styles */
.comments-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.comments-section h3 {
    font-size: 1.8em;
    margin-bottom: 20px;
}

.comment-form-container {
    margin-bottom: 40px;
}

.comment-form-container h4 {
    font-size: 1.4em;
    margin-bottom: 15px;
}

#toggle-comment-form {
    margin-bottom: 20px;
}

.comments-list .comment {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: #6c757d;
    font-size: 0.9em;
}

.comment-meta strong {
    color: #343a40;
    font-size: 1.1em;
}

.comment-body p {
    margin: 0;
    line-height: 1.7;
}

/* Related Articles Section Styles */
.related-articles-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #ddd;
}

.related-articles-section h2 {
    text-align: center;
    font-size: 2em;
    margin-bottom: 30px;
}

.related-articles-section .article-preview h3 a:hover {
    text-decoration: none;
}

/* Author Box Styles */
.author-box {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
}

.author-box h1 {
    text-align: left;
    margin-top: 0;
}

.author-bio {
    font-size: 1.1em;
    line-height: 1.8;
}

.section-title {
    font-size: 1.8em;
    margin-top: 40px;
    margin-bottom: 20px;
    border-bottom: 2px solid #007BFF;
    padding-bottom: 10px;
}

/* Footer Styles */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding-top: 30px;
    padding-bottom: 30px;
    margin-top: 40px;
}

/* --- NEW: Footer Menu Styles --- */
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #fff;
    font-size: 1.2em;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul a:hover {
    color: #fff;
    text-decoration: underline;
}

/* --- NEW: Back to Top Button Styles --- */
#back-to-top-btn {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: #007BFF;
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 18px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s;
}

#back-to-top-btn:hover {
    background-color: #0056b3;
}

/* Responsive Design */
@media (max-width: 992px) {
    .content-area {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    header .container { flex-direction: column; gap: 15px; }
    header nav ul li { margin-left: 15px; }
    .full-article h1 { font-size: 2em; }
    .full-article { padding: 20px; }
}

@media (max-width: 480px) {
    header nav ul { text-align: center; }
    header nav ul li { display: block; margin: 10px 0; }
    .container { width: 100%; padding: 0 15px; }
    .articles-grid { grid-template-columns: 1fr; }
}

