/* Blog Specific Styles */
.right{
    position: absolute;
    left: 0;
}
.ellipsis {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.post-excerpt{
    margin-bottom: 1rem;
}

:root {
    --primary-color: #3366cc;
    --secondary-color: #004d99;
    --accent-color: #ff6b6b;
    --text-color: #333333;
    --light-text: #666666;
    --border-color: #dddddd;
    --light-gray: #f5f5f5;
    --card-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Hero Section Improvements */
.blog-hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #002244 100%);
    padding: 8rem 2rem 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.blog-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.1;
}

.blog-hero .title {
    color: white;
    font-size: 2.8rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.blog-hero .subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.hero-search {
    max-width: 600px;
    margin: 2rem auto 0;
    display: flex;
    gap: 0.5rem;
}

.hero-search input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hero-search button {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: background 0.3s;
}

.hero-search button:hover {
    background: #ff5252;
}

/* Post Card Improvements */
.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.post-image {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.post-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-content h3 {
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    line-height: 1.4;
}

.post-content h3 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.post-content h3 a:hover {
    color: var(--primary-color);
}

.post-excerpt {
    color: var(--light-text);
    margin-bottom: 1.5rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

.btn-outline {
    align-self: flex-start;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 30px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Popular Posts Improvements */
.post-list-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    transition: background 0.3s;
    text-decoration: none;
    margin-bottom: 1rem;
}

.post-list-item:hover {
    background: var(--light-gray);
}

.post-list-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.post-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-list-content {
    flex: 1;
}

.post-list-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.post-list-content h3 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.post-list-content h3 a:hover {
    color: var(--primary-color);
}

/* Category Section Improvements */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.category-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

.category-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.category-posts-list {
    margin-bottom: 1rem;
}

.category-post-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.category-post-item h4 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.category-post-item h4 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.category-post-item h4 a:hover {
    color: var(--primary-color);
}

.view-all {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
}

.view-all:hover {
    text-decoration: underline;
}

/* Sidebar Improvements */
.sidebar-widget {
    background: white;
    padding: 1.8rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
}

.sidebar-widget h3 {
    margin-bottom: 1.2rem;
    font-size: 1.3rem;
    position: relative;
    padding-bottom: 0.8rem;
}

.sidebar-widget h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.newsletter-form input {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.btn-primary {
    padding: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #2855b0;
}

.featured-resource {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
}

.resource-card {
    text-align: center;
}

.resource-card img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.resource-card h4 {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.resource-card p {
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    color: var(--light-text);
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
    
    .blog-sidebar {
        order: -1;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
}

.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.blog-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* Post Cards */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.post-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
}

.post-image {
    position: relative;
    margin: 2rem;
}

.post-image img {
    width: 100%;
    object-fit: cover;
}

.category-tag {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.post-meta i {
    margin-right: 0.3rem;
    margin-left: 1rem;
}

.post-meta i:first-child {
    margin-left: 0;
}

.post-content {
    padding: 1.5rem;
}

.post-content>h2 {
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.h2child>h3 {
    margin-top: 1rem;
    margin-bottom: .2rem;
}

.h3child {
    padding-left: 2rem;
}

.h2child>ul {
    padding-left: 2rem;
}

.h3child>ul,ol {
    padding-left: 2rem;
}

.que{
    margin-top: 1rem;
    margin-bottom: 0.2rem
}

/* Sidebar */
.sidebar-widget {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-box {
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.search-box button {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Categories List */
.categories-list {
    list-style: none;
}

.categories-list li {
    margin: 0.5rem 0;
}

.categories-list a {
    display: flex;
    justify-content: space-between;
    color: var(--text-color);
    text-decoration: none;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--light-gray);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.9rem;
    color: var(--text-color);
    text-decoration: none;
}

/* Single Post Page */
.single-post-container {
    max-width: 800px;
    margin: 8rem auto 2rem;
    padding: 0 2rem;
}

.post-header {
    text-align: center;
    margin-bottom: 2rem;
}

.post-featured-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Share Buttons */
.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: opacity 0.3s;
}

.share-btn:hover {
    opacity: 0.9;
}

.facebook { background: #3b5998; }
.twitter { background: #1da1f2; }
.linkedin { background: #0077b5; }
.copy-link { background: #333; }

/* Comments Section */
.comments-section {
    padding-top: 3rem;
}

#username {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 1rem;
    resize: vertical;
}

#comment-text {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 1rem;
    resize: vertical;
}

.comment {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.comment-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reply-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
}

#comments-container {
    margin-top: 20px;
    border-top: 1px solid #e0e0e0;
}
.comment {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-author {
    font-weight: bold;
    color: #333;
}

.comment-date {
    color: #888;
    font-size: 0.8em;
}

.comment-actions {
    position: absolute;
    top: 10px;
    right: 10px;
}

.comment-actions button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    margin-left: 10px;
}

#comment-form,
.edit-form {
    margin-top: 20px;
}

/* Related Posts */
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.related-post-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.related-post-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.related-post-card h4 {
    padding: 1rem;
    margin: 0;
}

/* Animations */
.animate-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.animate-left {
    opacity: 0;
    transform: translateX(-20px);
    animation: fadeInLeft 0.6s ease forwards;
}

.animate-right {
    opacity: 0;
    transform: translateX(20px);
    animation: fadeInRight 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hover Animations */
.post-card:hover .post-image img {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    transition: all 0.3s ease;
}

/* Loading Animation for Images */
.post-image img {
    transition: opacity 0.3s ease;
}

.post-image.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        order: -1;
    }

    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .blog-hero {
        padding: 6rem 1rem 3rem;
    }

    .blog-container {
        padding: 1rem;
    }

    .post-card {
        margin-bottom: 1.5rem;
    }

    .share-grid {
        grid-template-columns: 1fr 1fr;
    }

    .comment {
        flex-direction: column;
    }

    .comment-avatar {
        width: 40px;
        height: 40px;
    }

    .related-posts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .post-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .share-grid {
        grid-template-columns: 1fr;
    }

    .tags-cloud {
        gap: 0.3rem;
    }

    .tag {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }

    .blog-layout {
            flex-direction: column;
        }

        .blog-main {
            order: 1; /* Main content first */
        }

        .blog-sidebar {
            order: 2; /* Sidebar second */
        }
}

/* Accessibility Improvements */
.post-card:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-outline:focus,
.btn-solid:focus,
.share-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.blog-sidebar {
            position: relative; /* Ensure proper positioning context for sticky content */
        }

        .sticky-sidebar-content {
            position: -webkit-sticky; /* For Safari */
            position: sticky;
            z-index: 100;
            top: 80px; /* Adjust as needed for desired sticky position */
            /* Add any other styling for the sticky content, e.g., background, padding */
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }

/* Print Styles */
@media print {
    .share-buttons,
    .comments-section,
    .blog-sidebar {
        display: none;
    }

    .blog-post {
        margin: 0;
    }

    .post-content {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .post-card,
    .sidebar-widget,
    .comment-form textarea {
        background: #2d3748;
        color: #e2e8f0;
    }

    .tag {
        background: #4a5568;
        color: #e2e8f0;
    }

    .post-meta {
        color: #a0aec0;
    }
}

#message {
    margin-left: 10px;
    color: green;
    opacity: 0;
    transition: opacity 0.3s ease;
}