/* Blog CSS - Main Styles */

/* ===== VARIABLES ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Georgia', serif;
    
    --container-max-width: 1200px;
    --sidebar-width: 320px;
}

/* ===== RESET & BASE ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== BLOG CONTAINER ===== */
.blog-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Override main styles.css blog styles to prevent conflicts */
.blog-container .blog {
    padding: 0;
    background-color: transparent;
}

.blog-container .blog-grid {
    display: block;
    grid-template-columns: none;
    gap: 0;
    margin-bottom: 0;
}

.blog-container .blog-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.blog-container .blog-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: auto;
    min-height: 250px;
    background: #f8f9fa;
    aspect-ratio: auto;
}

.blog-container .blog-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

/* ===== HERO SECTION - Updated to match News style ===== */
.blog-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 0 60px;
    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,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.blog-hero .container {
    position: relative;
    z-index: 2;
}

.blog-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    line-height: 1.2;
}



.blog-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 400;
}

/* ===== SEARCH AND FILTERS SECTION ===== */
.blog-filters {
    background: white;
    padding: 30px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.filters-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

/* Search Form - Updated to match News style */
.blog-search-form {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    max-width: 800px;
}

.search-input-group {
    position: relative;
    flex: 1;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
    outline: none;
}

.search-input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: #5a6fd8;
    transform: translateY(-50%) scale(1.05);
}

/* Filter Groups */
.filter-group {
    position: relative;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.category-select,
.sort-select {
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    background: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.category-select:focus,
.sort-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.results-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== BLOG MAIN CONTENT ===== */
.blog-main {
    padding: 3rem 0;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 3rem;
    align-items: start;
}

.blog-content {
    min-height: 500px;
}

/* ===== BLOG CARDS ===== */
.blog-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.blog-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Pinned Post Specific Styles - More specific to override main styles */
.blog-content .blog-card.pinned-post {
    border: 2px solid #1e3a8a;
    position: relative;
    background: linear-gradient(135deg, #fff9f0 0%, #ffffff 100%);
}

.blog-content .pinned-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #1e3a8a;  /* Dark blue background */
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(1, 31, 202, 0.3);  /* Dark blue shadow */
    border: 2px solid #1e40af;  /* Slightly lighter blue border */
}

/* Blog Image - More specific to override main styles */
.blog-content .blog-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: auto;
    min-height: 250px;
    background: #f8f9fa;
}

.blog-content .blog-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.blog-content .blog-card:hover .blog-image img {
    transform: scale(1.05);
}

/* Pinned post image specific styling */
.blog-content .blog-card.pinned-post .blog-image {
    height: 300px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.blog-content .blog-card.pinned-post .blog-image img {
    height: 300px;
    object-fit: cover;
    width: 100%;
    display: block;
    transition: opacity 0.3s ease;
}

/* Image loading states */
.blog-content .blog-image img:not([src]),
.blog-content .blog-image img[src=""] {
    opacity: 0;
}

.blog-content .blog-image img[src]:not([src=""]) {
    opacity: 1;
}

/* Fallback for images that fail to load */
.blog-content .blog-image:not(:has(img[src]))::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.875rem;
}

.blog-content .blog-image:not(:has(img[src]))::after {
    content: '📷';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    opacity: 0.5;
}

/* Image loading and error states */
.blog-content .blog-image.image-loaded img {
    opacity: 1;
}

.blog-content .blog-image.image-error {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.blog-content .image-fallback {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.blog-content .fallback-content {
    text-align: center;
    color: #6c757d;
}

.blog-content .fallback-content i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    opacity: 0.5;
}

.blog-content .fallback-content span {
    font-size: 0.875rem;
    display: block;
}

/* Pinned post specific image enhancements */
.blog-content .blog-card.pinned-post .blog-image {
    position: relative;
}

.blog-content .blog-card.pinned-post .blog-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    pointer-events: none;
    z-index: 1;
}

.blog-content .blog-card.pinned-post .blog-image img {
    position: relative;
    z-index: 2;
}

/* Loading animation for images */
@keyframes imageLoading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.blog-content .blog-image img:not([src]),
.blog-content .blog-image img[src=""] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: imageLoading 1.5s infinite;
}

/* Ensure pinned post images are properly sized */
.blog-content .blog-card.pinned-post .blog-image {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-content .blog-card.pinned-post .blog-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    object-position: center;
}

/* Responsive adjustments for pinned post images */
@media (max-width: 768px) {
    .blog-content .blog-card.pinned-post .blog-image {
        min-height: 250px;
    }
    
    .blog-content .blog-card.pinned-post .blog-image img {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .blog-content .blog-card.pinned-post .blog-image {
        min-height: 200px;
    }
    
    .blog-content .blog-card.pinned-post .blog-image img {
        height: 200px;
    }
}

.blog-card-content {
    padding: 1.5rem;
}

.blog-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.category-link {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
}

.category-link:hover {
    background: var(--primary-dark);
}

.post-date {
    color: var(--text-secondary);
}



.blog-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.blog-title a:hover {
    color: var(--primary-color);
}

.blog-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.blog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.post-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.post-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.posts-grid .blog-card {
    margin-bottom: 0;
}

.posts-grid .blog-title {
    font-size: 1.25rem;
}

/* ===== SIDEBAR ===== */
.blog-sidebar {
    position: sticky;
    top: 2rem;
}

.sidebar-widget {
    background: var(--bg-primary);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid #e1e5e9;
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Newsletter Widget */
.newsletter-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.newsletter-widget .widget-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
}

.newsletter-widget .widget-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.newsletter-widget p {
    margin-bottom: 20px;
    opacity: 0.9;
    line-height: 1.6;
    font-size: 0.95rem;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.newsletter-input {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    color: #6c757d;
    background: rgba(255,255,255,0.9);
    outline: none;
    transition: background 0.3s ease;
}

.newsletter-input:focus {
    background: rgb(255, 255, 255);
}

.newsletter-input::placeholder {
    color: #6c757d;
}

.newsletter-btn {
    padding: 12px 25px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.newsletter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Categories List */
.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: #f8fafc;
    text-decoration: none;
    transition: color 0.2s;
}

.category-link:hover {
    color: var(--primary-color);
}

.category-count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.tag-link:hover {
    background: var(--primary-color);
    color: white;
}

/* Featured Posts List */
.featured-posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.featured-post-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.featured-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.featured-post-image {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.featured-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-post-content {
    flex: 1;
}

.featured-post-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.featured-post-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.featured-post-title a:hover {
    color: var(--primary-color);
}

.featured-post-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Recent Posts List */
.recent-posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-post-item {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.recent-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-post-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.recent-post-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.recent-post-title a:hover {
    color: var(--primary-color);
}

.recent-post-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== PAGINATION ===== */
.pagination-wrapper {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.page-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ===== NO POSTS ===== */
.no-posts {
    text-align: center;
    padding: 4rem 2rem;
}

.no-posts-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-posts-content i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.no-posts-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.no-posts-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .blog-sidebar {
        position: static;
    }
    
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .filters-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .blog-search-form {
        flex-direction: column;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .blog-hero {
        padding: 60px 0 40px;
    }
    
    .blog-title {
        font-size: 2.5rem;
    }
    
    .blog-subtitle {
        font-size: 1rem;
    }
    
    .blog-filters {
        padding: 20px 0;
    }
    
    .filters-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .category-select,
    .sort-select {
        width: 100%;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-meta,
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .blog-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .post-stats {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .blog-hero {
        padding: 40px 0 30px;
    }
    
    .blog-title {
        font-size: 2rem;
    }
    
    .blog-card-content {
        padding: 1rem;
    }
    
    .sidebar-widget {
        padding: 1rem;
    }
    
    .blog-filters {
        padding: 15px 0;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.blog-card,
.sidebar-widget {
    animation: fadeIn 0.6s ease-out;
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

.hidden { display: none; }
.visible { display: block; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.w-full { width: 100%; }
.h-full { height: 100%; } 