/* ===== Blog CSS Styles ===== */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* Blog Layout */
.blog-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.blog-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.blog-post-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

/* Blog Header */
.blog-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 3rem;
    text-align: center;
}

.blog-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.blog-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    font-weight: 300;
}

/* Search Form */
.blog-search-form {
    max-width: 500px;
    margin: 0 auto;
}

.search-input-group {
    position: relative;
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: white;
    font-size: 1rem;
    border-radius: 50px 0 0 50px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
}

.search-button {
    padding: 1rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0 50px 50px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Filter Notice */
.filter-notice {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-filter {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
}

.clear-filter:hover {
    text-decoration: underline;
}

/* Blog Posts Grid */
.blog-posts {
    display: grid;
    gap: 2rem;
}

.blog-post-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e0e0e0;
}

.blog-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

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

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

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

.post-content {
    padding: 1.5rem;
}

.post-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #666;
    flex-wrap: wrap;
}

.post-category {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-weight: 500;
    text-decoration: none;
}

.post-date, .post-reading-time {
    color: #757575;
}

.post-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-title a:hover {
    color: #1976d2;
}

.post-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

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

.tag {
    display: inline-block;
    background: #f5f5f5;
    color: #666;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    text-decoration: none;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
    transition: background-color 0.3s ease;
}

.tag:hover {
    background: #e0e0e0;
    color: #333;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.read-more {
    color: #1976d2;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: #1565c0;
    text-decoration: underline;
}

.post-views {
    color: #999;
    font-size: 0.875rem;
}

/* Individual Blog Post Styles */
.breadcrumb {
    margin-bottom: 2rem;
}

.breadcrumb-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
}

.breadcrumb-item {
    color: #666;
}

.breadcrumb-item:not(:last-child)::after {
    content: " / ";
    margin: 0 0.5rem;
    color: #ccc;
}

.breadcrumb-item a {
    color: #1976d2;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #333;
    font-weight: 500;
}

.blog-post-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.post-featured-image {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
}

.featured-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #333;
}

.post-author {
    color: #666;
    font-style: italic;
}

.post-content-body {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #333;
}

.post-content-body h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 2rem 0 1rem 0;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.post-content-body h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    color: #444;
}

.post-content-body h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: #555;
}

.post-content-body p {
    margin-bottom: 1.5rem;
}

.post-content-body ul, .post-content-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.post-content-body li {
    margin-bottom: 0.5rem;
}

.post-content-body blockquote {
    border-left: 4px solid #1976d2;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #666;
    background: #f8f9fa;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

.post-content-body code {
    background: #f5f5f5;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.post-content-body pre {
    background: #282c34;
    color: #abb2bf;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.post-content-body th,
.post-content-body td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.post-content-body th {
    background: #f8f9fa;
    font-weight: 600;
}

.post-tags-section {
    margin: 3rem 0;
    padding: 2rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.tags-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.social-sharing {
    margin: 3rem 0;
    text-align: center;
}

.sharing-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.sharing-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.share-button.twitter {
    background: #1da1f2;
    color: white;
}

.share-button.linkedin {
    background: #0077b5;
    color: white;
}

.share-button.facebook {
    background: #1877f2;
    color: white;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Related Posts */
.related-posts {
    margin: 3rem 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.related-post-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.related-post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.related-post-image {
    height: 150px;
    overflow: hidden;
}

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

.related-post-content {
    padding: 1rem;
}

.related-post-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.related-post-title a {
    color: #333;
    text-decoration: none;
}

.related-post-title a:hover {
    color: #1976d2;
}

.related-post-excerpt {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.related-post-meta {
    font-size: 0.75rem;
    color: #999;
}

/* Sidebar Styles */
.blog-sidebar,
.blog-post-sidebar {
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.sidebar-widget {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.recent-posts-list,
.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-post-item,
.category-item {
    margin-bottom: 0.75rem;
}

.recent-post-link,
.category-link {
    display: block;
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.recent-post-link:hover,
.category-link:hover {
    background: #f8f9fa;
    color: #1976d2;
}

.recent-post-title {
    font-weight: 500;
    display: block;
    margin-bottom: 0.25rem;
}

.recent-post-date {
    font-size: 0.75rem;
    color: #999;
}

.category-item.active .category-link {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

.post-count {
    color: #999;
    font-size: 0.875rem;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-cloud-item {
    background: #f5f5f5;
    color: #666;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.tag-cloud-item:hover {
    background: #1976d2;
    color: white;
}

/* Table of Contents */
.toc-widget {
    position: sticky;
    top: 2rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 0.5rem;
}

.toc-link {
    display: block;
    color: #666;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.toc-link:hover {
    background: #f8f9fa;
    color: #1976d2;
}

.toc-h2 {
    font-weight: 600;
}

.toc-h3 {
    padding-left: 1rem;
}

.toc-h4 {
    padding-left: 2rem;
    font-size: 0.85rem;
}

/* Pagination */
.pagination {
    margin: 3rem 0;
    text-align: center;
}

.pagination-list {
    display: inline-flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.pagination-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #666;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.pagination-link:hover {
    background: #f8f9fa;
    color: #333;
}

.pagination-link.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.no-posts h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #1976d2;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    margin-top: 1rem;
}

.btn:hover {
    background: #1565c0;
}

/* Ad Containers */
.ad-container {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin: 2rem 0;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    color: #999;
    font-size: 0.875rem;
    font-style: italic;
}

.ad-header {
    margin: 0 0 2rem 0;
}

.ad-content {
    margin: 3rem 0;
}

.ad-footer {
    margin: 2rem 0 0 0;
}

.ad-widget .ad-container {
    min-height: 300px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .blog-layout,
    .blog-post-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .blog-sidebar,
    .blog-post-sidebar {
        position: static;
        max-height: none;
        order: -1;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .blog-main {
        padding: 1rem;
    }
    
    .blog-title {
        font-size: 2.5rem;
    }
    
    .blog-subtitle {
        font-size: 1.1rem;
    }
    
    .blog-header {
        padding: 3rem 0;
    }
    
    .blog-post-content {
        padding: 1.5rem;
    }
    
    .post-title {
        font-size: 2rem;
    }
    
    .post-content-body {
        font-size: 1rem;
    }
    
    .post-content-body h2 {
        font-size: 1.5rem;
    }
    
    .post-content-body h3 {
        font-size: 1.25rem;
    }
    
    .featured-image {
        height: 250px;
    }
    
    .sharing-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .pagination-list {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .blog-title {
        font-size: 2rem;
    }
    
    .post-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .post-footer {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .search-input-group {
        flex-direction: column;
        border-radius: 8px;
    }
    
    .search-input,
    .search-button {
        border-radius: 8px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .blog-post-card,
    .blog-post-content,
    .sidebar-widget {
        background: #1e1e1e;
        color: #e0e0e0;
        border-color: #333;
    }
    
    .post-title a,
    .widget-title {
        color: #e0e0e0;
    }
    
    .post-excerpt,
    .post-meta {
        color: #b0b0b0;
    }
    
    .recent-post-link:hover,
    .category-link:hover,
    .toc-link:hover {
        background: #333;
    }
    
    .tag,
    .tag-cloud-item {
        background: #333;
        color: #e0e0e0;
    }
    
    .post-content-body code {
        background: #333;
        color: #e0e0e0;
    }
    
    .ad-container {
        background: #2a2a2a;
        border-color: #444;
    }
}

/* Print Styles */
@media print {
    .blog-sidebar,
    .blog-post-sidebar,
    .social-sharing,
    .ad-container,
    .pagination {
        display: none;
    }
    
    .blog-layout,
    .blog-post-layout {
        grid-template-columns: 1fr;
    }
    
    .blog-post-content {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .blog-post-card,
    .sidebar-widget {
        border: 2px solid #000;
    }
    
    .post-title a:hover,
    .read-more:hover {
        text-decoration: underline;
        background: yellow;
        color: black;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Indicators */
.search-input:focus,
.pagination-link:focus,
.read-more:focus,
.share-button:focus,
.toc-link:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #1976d2;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}