/* Blog System Styles */

/* --- Layout --- */
.blog-page-container {
    padding: 4rem 0;
    background: #f9fafb;
    min-height: 80vh;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 3rem;
}

@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
}

/* --- Blog Grid --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.blog-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e5e7eb;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.blog-card-image {
    height: 200px;
    overflow: hidden;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-meta {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.blog-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.blog-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.blog-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.blog-title a:hover {
    color: #2563eb;
}

.blog-excerpt {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    flex-grow: 1;
}

.blog-read-more {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
}

.recent-posts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-post-item {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.recent-post-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.recent-post-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.recent-post-info h4 a {
    text-decoration: none;
    color: #374151;
    transition: color 0.2s;
}

.recent-post-info h4 a:hover {
    color: #2563eb;
}

.recent-post-date {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.page-btn:hover:not(:disabled) {
    border-color: #2563eb;
    color: #2563eb;
}

.page-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Single Blog Post --- */
.single-blog-header {
    margin-bottom: 2rem;
}

.single-blog-meta {
    display: flex;
    gap: 1.5rem;
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.single-blog-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.single-blog-image {
    width: 100%;
    height: 400px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.single-blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Markdown Content Styling */
.blog-content {
    color: #374151;
    font-size: 1.1rem;
    line-height: 1.8;
}

.blog-content h1,
.blog-content h2,
.blog-content h3 {
    color: #1f2937;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.blog-content h2 {
    font-size: 1.8rem;
}

.blog-content h3 {
    font-size: 1.5rem;
}

.blog-content p {
    margin-bottom: 1.5rem;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
}

.blog-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.blog-content blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #4b5563;
    color: #1f2937;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f3f4f6;
}

.recent-posts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-post-item {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.recent-post-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.recent-post-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.recent-post-info h4 a {
    text-decoration: none;
    color: #374151;
    transition: color 0.2s;
}

.recent-post-info h4 a:hover {
    color: #2563eb;
}

.recent-post-date {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.page-btn:hover:not(:disabled) {
    border-color: #2563eb;
    color: #2563eb;
}

.page-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Single Blog Post --- */
.single-blog-header {
    margin-bottom: 2rem;
}

.single-blog-meta {
    display: flex;
    gap: 1.5rem;
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.single-blog-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.single-blog-image {
    width: 100%;
    height: 400px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.single-blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Markdown Content Styling */
.blog-content {
    color: #374151;
    font-size: 1.1rem;
    line-height: 1.8;
}

.blog-content h1,
.blog-content h2,
.blog-content h3 {
    color: #1f2937;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.blog-content h2 {
    font-size: 1.8rem;
}

.blog-content h3 {
    font-size: 1.5rem;
}

.blog-content p {
    margin-bottom: 1.5rem;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
}

.blog-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.blog-content blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #4b5563;
    background: #f3f4f6;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

.blog-carousel-container {
    padding: 1rem 0 3rem 0;
    position: relative;
}

/* --- Carousel --- */
.blog-carousel-track {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 5px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    justify-content: center;
    align-items: stretch;
    /* Ensure cards stretch to equal height */
}

.blog-carousel-track::-webkit-scrollbar {
    display: none;
}

/* Force width for cards in carousel */
.blog-carousel-track .blog-card {
    flex: 0 0 350px;
    /* Fixed width for carousel items */
    width: 350px;
    min-width: 350px;
    height: auto;
    /* Allow flex to stretch it */
}

/* Responsive for mobile */
@media (max-width: 768px) {
    .blog-carousel-track {
        justify-content: flex-start;
        /* Allow scrolling on mobile */
        padding-left: 1rem;
    }

    .blog-carousel-track .blog-card {
        flex: 0 0 300px;
        width: 300px;
        min-width: 300px;
    }
}

/* Updated Read More Button */
.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: #f3f4f6;
    color: #1f2937 !important;
    /* Override global link colors */
    text-decoration: none !important;
    /* Force no underline */
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
    margin-top: auto;
    /* Pushes to bottom */
    width: fit-content;
    border: 1px solid transparent;
}

.read-more-btn svg {
    transition: transform 0.3s ease;
}

.read-more-btn:hover {
    background-color: #2563eb;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    text-decoration: none !important;
}

.read-more-btn:hover svg {
    transform: translateX(4px);
}

/* Ensure cards are equal height and content aligns */
.blog-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.blog-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}



/* --- Single Blog Post --- */
.single-blog-header {
    margin-bottom: 2rem;
}

.single-blog-meta {
    display: flex;
    gap: 1.5rem;
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.single-blog-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.single-blog-image {
    width: 100%;
    height: 400px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.single-blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Markdown Content Styling */
.blog-content {
    color: #374151;
    font-size: 1.1rem;
    line-height: 1.8;
}

.blog-content h1,
.blog-content h2,
.blog-content h3 {
    color: #1f2937;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.blog-content h2 {
    font-size: 1.8rem;
}

.blog-content h3 {
    font-size: 1.5rem;
}

.blog-content p {
    margin-bottom: 1.5rem;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
}

.blog-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.blog-content blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #4b5563;
    background: #f3f4f6;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

.blog-carousel-container {
    padding: 1rem 0 3rem 0;
    position: relative;
}

/* --- Carousel --- */
.blog-carousel-track {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 5px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    justify-content: center;
    align-items: stretch;
    /* Ensure cards stretch to equal height */
}

.blog-carousel-track::-webkit-scrollbar {
    display: none;
}

/* Force width for cards in carousel */
.blog-carousel-track .blog-card {
    flex: 0 0 350px;
    /* Fixed width for carousel items */
    width: 350px;
    min-width: 350px;
    height: auto;
    /* Allow flex to stretch it */
}

/* Responsive for mobile */
@media (max-width: 768px) {
    .blog-carousel-track {
        justify-content: flex-start;
        /* Allow scrolling on mobile */
        padding-left: 1rem;
    }

    .blog-carousel-track .blog-card {
        flex: 0 0 300px;
        width: 300px;
        min-width: 300px;
    }
}

/* Updated Read More Button */
.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: #f3f4f6;
    color: #1f2937 !important;
    /* Override global link colors */
    text-decoration: none !important;
    /* Force no underline */
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
    margin-top: auto;
    /* Pushes to bottom */
    width: fit-content;
    border: 1px solid transparent;
}

.read-more-btn svg {
    transition: transform 0.3s ease;
}

.read-more-btn:hover {
    background-color: #2563eb;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    text-decoration: none !important;
}

.read-more-btn:hover svg {
    transform: translateX(4px);
}

/* Ensure cards are equal height and content aligns */
.blog-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.blog-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.blog-excerpt {
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

/* Remove underlines globally from blog card links */
.blog-card a {
    text-decoration: none !important;
}

/* --- Sidebar Widgets --- */
.sidebar-widget {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.contact-widget {
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    border: 1px solid #bfdbfe;
    text-align: center;
}

.sidebar-form .form-group {
    margin-bottom: 1rem;
}

.sidebar-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.sidebar-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-sidebar-submit {
    width: 100%;
    padding: 12px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-sidebar-submit:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Recent Posts Styling */
.recent-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recent-post-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    color: #4b5563;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.recent-post-link .icon {
    color: #9ca3af;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, color 0.2s ease;
}

.recent-post-link .text {
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.recent-post-link:hover {
    background-color: #f3f4f6;
    color: #2563eb;
}

.recent-post-link:hover .text {
    color: #2563eb;
}

.recent-post-link:hover .icon {
    color: #2563eb;
    transform: translateX(4px);
}

/* --- Sidebar Sticky --- */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: sticky;
    top: 100px;
    /* Adjust based on header height */
    height: fit-content;
    align-self: start;
}