/* --- Blog Page Layout --- */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 50px;
}

@media (min-width: 992px) {
    .blog-layout {
        grid-template-columns: 1fr 300px;
        gap: 50px;
    }
}

/* --- Blog Feed --- */
.blog-feed {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 768px) {
    .blog-feed {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .blog-feed {
        grid-template-columns: repeat(3, 1fr);
    }
}

.blog-post-card {
    background-color: var(--box-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.blog-post-card .post-thumbnail img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.blog-post-card .post-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-post-card .post-meta {
    font-size: 0.85rem;
    color: var(--text-color);
    margin-bottom: 8px;
    opacity: 0.8;
}

.blog-post-card .post-meta .post-category {
    font-weight: 600;
    color: var(--accent-color);
}

.blog-post-card .post-title {
    font-size: 1.4rem;
    margin-bottom: 12px;
    line-height: 1.3;
}

.blog-post-card .post-excerpt {
    margin-bottom: 15px;
    flex-grow: 1;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-color);
    opacity: 0.9;
}

.blog-post-card .read-more-btn {
    color: var(--accent-color);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    margin-top: auto;
}

.blog-post-card .read-more-btn i {
    transition: transform 0.3s ease;
}

.blog-post-card:hover .read-more-btn i {
    transform: translateX(5px);
}

/* --- Blog Sidebar --- */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    max-width: 300px;
}

@media (min-width: 992px) {
    .blog-sidebar {
        position: sticky;
        top: 20px;
        height: fit-content;
    }
}

.sidebar-widget {
    background-color: var(--box-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-widget:first-child {
    min-height: 200px;
}

.sidebar-widget:last-child {
    min-height: 250px;
}

.sidebar-widget h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

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

.sidebar-widget ul li a {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 0;
    display: block;
    transition: color 0.3s ease;
}

.sidebar-widget ul li a:hover {
    color: var(--accent-color);
}

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.category-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.category-list li a {
    flex: 1;
    padding: 0 !important;
    font-weight: 500;
}

.category-list .category-count {
    color: var(--text-color);
    opacity: 0.7;
    background: var(--secondary-bg);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    margin-left: 10px;
}

/* Categories list styling for blog post page */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.categories-list .category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.categories-list .category-item:last-child {
    border-bottom: none;
}

.categories-list .category-item a {
    flex: 1;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.categories-list .category-item a:hover {
    color: var(--accent-color);
}

.categories-list .category-count {
    color: var(--text-color);
    opacity: 0.7;
    background: var(--secondary-bg);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    margin-left: 10px;
}

/* --- Blog Post Page Specific Styles (Only content styling retained) --- */
.post-full-content {
    line-height: 1.9;
    font-size: 1.15rem;
    color: var(--text-color);
    font-family: 'Manrope', sans-serif;
}

.post-full-content h1,
.post-full-content h2,
.post-full-content h3,
.post-full-content h4,
.post-full-content h5,
.post-full-content h6 {
    color: var(--heading-color);
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.4;
    font-family: 'PT Sans', sans-serif;
}

.post-full-content h1 { font-size: 2.5rem; }
.post-full-content h2 { font-size: 2rem; }
.post-full-content h3 { font-size: 1.75rem; }
.post-full-content h4 { font-size: 1.5rem; }
.post-full-content h5 { font-size: 1.25rem; }
.post-full-content h6 { font-size: 1rem; }

.post-full-content p {
    margin-bottom: 1.5em;
}

.post-full-content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.post-full-content a:hover {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

.post-full-content ul,
.post-full-content ol {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

.post-full-content li {
    margin-bottom: 0.75em;
}

.post-full-content strong {
    color: var(--heading-color);
    font-weight: 700;
}

.post-full-content em {
    font-style: italic;
}

.post-full-content blockquote {
    border-left: 5px solid var(--accent-color);
    padding: 20px 30px;
    margin: 2.5em 0;
    font-style: italic;
    color: var(--heading-color);
    background-color: var(--secondary-bg);
    border-radius: 8px;
    font-size: 1.2rem;
}

.post-full-content pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2.5em 0;
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 1em;
    line-height: 1.6;
}

.post-full-content code {
    background-color: rgba(135, 131, 120, 0.15);
    color: var(--heading-color);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

.post-full-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.post-full-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2.5em auto;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.post-full-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 3.5em 0;
}

.back-to-blog {
    margin-top: 40px;
    text-align: center;
}

.back-to-blog a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
    transition: gap 0.3s ease;
}

.back-to-blog a:hover {
    gap: 12px;
}

/* Responsive adjustments for blog post content */
@media (max-width: 768px) {
    .post-full-content {
        font-size: 1rem;
    }
    .post-full-content h1 { font-size: 1.8rem; }
    .post-full-content h2 { font-size: 1.5rem; }
    .post-full-content h3 { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .post-full-content {
        font-size: 0.95rem;
    }
}

/* --- Responsive Blog Layout Adjustments --- */
@media (max-width: 991px) {
    .blog-sidebar {
        max-width: 100%;
        order: -1;
    }
    
    .sidebar-widget:first-child,
    .sidebar-widget:last-child {
        min-height: auto;
    }
}

@media (max-width: 767px) {
    .blog-feed {
        gap: 20px;
    }
    
    .blog-layout {
        gap: 30px;
    }
}

@media (max-width: 1199px) and (min-width: 992px) {
    .blog-feed {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive adjustments for blog cards */
@media (max-width: 768px) {
    .blog-post-card .post-thumbnail img {
        height: 160px;
    }
    
    .blog-post-card .post-content {
        padding: 16px;
    }
    
    .blog-post-card .post-title {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .blog-post-card .post-thumbnail img {
        height: 140px;
    }
    
    .blog-post-card .post-content {
        padding: 14px;
    }
    
    .blog-post-card .post-title {
        font-size: 1.1rem;
    }
    
    .blog-post-card .post-excerpt {
        font-size: 0.9rem;
    }
}

/* --- Blog Post Thumbnail Styling --- */
#post-thumbnail {
    display: block;
    max-width: 600px; /* Fixed maximum width */
    max-height: 400px; /* Fixed maximum height */
    width: 100%; /* Ensure it scales down on smaller screens */
    height: auto; /* Maintain aspect ratio when scaling down */
    object-fit: cover; /* Cover the area, cropping if necessary */
    margin: 40px auto; /* Center horizontally and add vertical spacing */
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    #post-thumbnail {
        max-width: 100%; /* Allow full width on small screens */
        max-height: 250px; /* Adjust max height for smaller screens */
        margin: 20px auto; /* Adjust spacing for smaller screens */
    }
}

/* --- Blog Post Page Layout --- */
.blog-post-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 30px;
}

@media (min-width: 1024px) {
    .blog-post-layout {
        grid-template-columns: 2fr 1fr;
        gap: 60px;
    }
}

.blog-post-main {
    max-width: 800px;
}

.blog-post-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

@media (min-width: 1024px) {
    .blog-post-sidebar {
        max-width: 350px;
    }

    .sticky-sidebar-content {
        position: sticky;
        top: 100px; /* Adjusted for header height */
        height: fit-content;
        display: flex;
        flex-direction: column;
        gap: 30px; /* Add gap between sticky items */
    }
}

/* Enhanced Post Meta */
.post-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.post-engagement {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.viewers-count,
.reading-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Sidebar Widgets */
.sidebar-widget {
    background-color: var(--box-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sidebar-widget h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--heading-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* Live Viewers Widget */
.viewers-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.live-viewers {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.viewer-count {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    padding: 10px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.viewer-activity {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.activity-dot {
    width: 8px;
    height: 8px;
    background-color: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Recent Posts Widget */
.recent-posts-list,
.suggested-posts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-post-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
    text-decoration: none;
    color: inherit;
}

.sidebar-post-item:hover {
    background-color: var(--secondary-bg);
}

.sidebar-post-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-post-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-post-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--heading-color);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-post-meta {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
}

/* Categories Widget */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
    text-decoration: none;
    color: var(--text-color);
}

.category-item:hover {
    background-color: var(--secondary-bg);
    color: var(--accent-color);
}

.category-count {
    background-color: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Newsletter Widget */
.newsletter-widget {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
}

.newsletter-widget h3 {
    color: white;
    border-bottom-color: rgba(255,255,255,0.2);
}

.newsletter-widget p {
    margin-bottom: 15px;
    opacity: 0.9;
    line-height: 1.5;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-form input {
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: rgba(255,255,255,0.9);
    color: var(--heading-color);
}

.newsletter-form input::placeholder {
    color: #666;
}

.newsletter-form button {
    padding: 12px;
    border: none;
    border-radius: 6px;
    background-color: rgba(255,255,255,0.2);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.newsletter-form button:hover {
    background-color: rgba(255,255,255,0.3);
}

/* Loading States */
.sidebar-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-color);
    opacity: 0.7;
}

/* Mobile Activity Widget */
.mobile-activity-widget {
    display: none;
    margin-bottom: 20px;
}

.desktop-activity {
    display: block;
}

/* Responsive Design */
@media (max-width: 1023px) {
    .blog-post-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .desktop-activity {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    /* Show mobile activity widget at top */
    .mobile-activity-widget {
        display: block;
    }
    
    /* Hide desktop activity widget */
    .desktop-activity {
        display: none;
    }
    
    .blog-post-layout {
        gap: 30px;
        display: block;
    }
    
    /* Sidebar comes after main content */
    .blog-post-sidebar {
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
        order: 2;
    }
    
    .blog-post-main {
        order: 1;
    }
    
    .post-engagement {
        flex-direction: column;
        gap: 8px;
    }
    
    .sidebar-widget {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .mobile-activity-widget {
        margin-bottom: 15px;
    }
    
    .blog-post-sidebar {
        margin-top: 30px;
    }
    
    .sidebar-post-item {
        padding: 8px;
    }
    
    .sidebar-post-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .sidebar-post-title {
        font-size: 0.85rem;
    }
}
