/* Layout & Container Styles */
.blog-container {
    display: grid;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem; /* Add some side padding */
}

.blog-sidebar {
    flex: 0 0 250px;
}

/* Ensure content area takes full width within the container */
.blog-content-area {
    width: 100%;
    min-width: 0; /* Prevents flex/grid blowout */
}

/* Article Card Styles */
.blog-article {
    width: 900px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 2rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.blog-article:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.blog-article:last-child {
    border-bottom: none;
}

/* Blog Content Styles */
.blog-content {
    width: 100%;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #444;
    height: auto;
    overflow: visible;
}

.blog-content p,
.blog-content div,
.blog-content span,
.blog-content ul,
.blog-content ol,
.blog-content pre,
.blog-content code,
.blog-content blockquote {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    margin-bottom: 1.5rem;
}

/* Blog Headers & Meta */
.blog-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    line-height: 1.3;
    word-wrap: break-word;
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #666;
}

/* Tag Styles */
.blog-tag {
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.tag-news {
    background-color: #00a156;
    color: white;
}

.tag-article {
    background-color: #3498db;
    color: white;
}

/* Images and Media */
.blog-header-image {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px 8px 0 0;
    margin-bottom: 1.5rem;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 4px;
}

/* Code and Pre Blocks */
.blog-content pre {
    white-space: pre-wrap;
    overflow-x: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.blog-content code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Tables */
.blog-content table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

.blog-content td,
.blog-content th {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

/* Sidebar Filters */
.tag-filters {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.tag-filters h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: #333;
}

.tag-filters ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tag-filters li {
    margin-bottom: 0.8rem;
}

.tag-filters a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #444;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.tag-filters li.active a {
    background-color: #e1e1e1;
    font-weight: bold;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    width: 100%;
    margin-top: 2rem;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Empty States */
.empty-state {
    width: 100%;
    text-align: center;
    padding: 3rem;
    background-color: #f9f9f9;
    border-radius: 8px;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 992px) {
    .blog-container {
        grid-template-columns: 1fr;
    }
    
    .blog-sidebar {
        flex: none;
    }
}

/* Force Override For Blog Content */
.blog-content *,
.blog-article *,
.blog-grid * {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

/* Home page blog preview styles */
.blog-preview-section {
    padding: 3rem 0;
    width: 100%;
}

.blog-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.blog-preview-header h2 {
    font-size: 2rem;
    margin: 0;
    color: #333;
}

.blog-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 items per row */
    gap: 2rem;
    margin-bottom: 3rem; /* Add space between article and news sections */
}

.blog-preview-card {
    width: 100%; /* Take full width of grid cell */
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}


.blog-preview-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.blog-preview-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-preview-title {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.blog-preview-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-preview-title a:hover {
    color: #3498db;
}

.blog-preview-meta {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.blog-preview-excerpt {
    color: #444;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.blog-preview-content .cta-button {
    align-self: flex-start;
    margin-top: auto;
    padding: 0.5rem 1rem;
    background-color: #3498db;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.blog-preview-content .cta-button:hover {
    background-color: #2980b9;
}

/* Make sure empty messages span full width */
.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .blog-preview-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 items per row on tablets */
    }
}


@media (max-width: 576px) {
    .blog-preview-grid {
        grid-template-columns: 1fr; /* 1 item per row on mobile */
    }
}
