/* Blog Specific Styles */

/* Universal Mobile Fix for Blog Pages */
* {
    box-sizing: border-box;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
}

/* Enhanced code block styling with copy buttons */
pre[class*="language-"] {
    position: relative;
    margin: 1rem 0 !important;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: visible;
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    padding: 1rem !important;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

pre[class*="language-"]:hover .copy-to-clipboard-button {
    opacity: 1;
}

/* Also style any remaining Quill code blocks */
.ql-syntax {
    position: relative;
    margin: 1rem 0 !important;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    padding: 1rem !important;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* Language-specific code styling */
code[class*="language-"] {
    background: transparent !important;
    color: inherit !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* Syntax highlighting colors */
.token.comment {
    color: #a0aec0 !important;
    font-style: italic !important;
}

.token.keyword {
    color: #63b3ed !important;
}

.token.string {
    color: #68d391 !important;
}

.token.number {
    color: #fbb6ce !important;
}

.token.function {
    color: #ffd700 !important;
}

.token.operator {
    color: #e2e8f0 !important;
}

.token.preprocessor {
    color: #9f7aea !important;
}

/* Fix spacing issues in blog content */
.post-content p {
    margin: 0.5rem 0 !important;
}

.post-content p:empty {
    margin: 0 !important;
    display: none !important;
}

.post-content br:only-child {
    display: none !important;
}

/* Reduce excessive spacing between elements */
.post-content > *:first-child {
    margin-top: 0 !important;
}

.post-content > *:last-child {
    margin-bottom: 0 !important;
}

.copy-to-clipboard-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: #e2e8f0;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* Show copy button by default on mobile */
@media (max-width: 768px) {
    .copy-to-clipboard-button {
        opacity: 0.7;
    }
}

.copy-to-clipboard-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-to-clipboard-button:active {
    background: rgba(255, 255, 255, 0.3);
}

/* Ensure copy buttons show on hover for both types */
.ql-syntax:hover .copy-to-clipboard-button,
pre[class*="language-"]:hover .copy-to-clipboard-button {
    opacity: 1;
}
.blog-header {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 8rem 0 4rem;
    text-align: center;
}

.blog-header h1 {
    font-size: 3rem;
    color: #333;
    margin-bottom: 1rem;
}

.blog-header p {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Search Functionality */
.search-container {
    margin-top: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-input-group {
    display: flex;
    background: white;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    color: #333;
    background: transparent;
    outline: none;
}

.search-input::placeholder {
    color: #999;
}

.search-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button:hover {
    background: #5a67d8;
}

.clear-search {
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    align-self: center;
}

.clear-search:hover {
    opacity: 1;
}

.search-results-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #667eea;
}

.search-results-info p {
    margin: 0;
    color: #666;
    font-weight: 500;
}

.blog-content {
    padding: 4rem 0;
}

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

.blog-main {
    background: white;
}

/* Blog Posts List */
.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.blog-post {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
    overflow: hidden;
}

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

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.post-meta time {
    color: #666;
    font-size: 0.9rem;
}

.post-category {
    padding: 0.25rem 0.75rem;
    background: #e8f4fd;
    color: #667eea;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Featured Image Styles */
.post-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    margin-bottom: 0;
}

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

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

.post-content {
    padding: 2rem;
}

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

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

.post-title a:hover {
    color: #667eea;
}

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

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: #764ba2;
}

/* Single Post */
.single-post {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
}

.post-header .post-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

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

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

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
}

.back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.back-to-blog:hover {
    color: #764ba2;
}

/* Sidebar */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-widget {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.sidebar-widget h3 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.sidebar-widget p {
    color: #666;
    line-height: 1.6;
}



.categories {
    list-style: none;
}

.categories li {
    margin-bottom: 0.5rem;
}

.categories a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.categories a:hover {
    color: #667eea;
}

.categories a::before {
    content: '→';
    color: #667eea;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.pagination-link:hover,
.pagination-link.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* No Posts State */
.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.no-posts i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 1rem;
}

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

.no-posts p {
    color: #666;
}

/* Responsive Blog Layout */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .blog-header {
        padding: 6rem 0 3rem;
    }

    .blog-header h1 {
        font-size: 2.5rem;
    }

    .blog-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0;
    }

    .blog-posts {
        gap: 2rem;
    }

    .blog-post {
        padding: 1.5rem;
        margin: 0;
    }

    .single-post {
        padding: 1.5rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .post-header .post-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .post-meta {
        font-size: 0.9rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .post-content {
        font-size: 16px;
        line-height: 1.6;
    }

    .post-content h1,
    .post-content h2,
    .post-content h3 {
        margin-top: 2rem;
        margin-bottom: 1rem;
        font-size: 1.5rem;
    }

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

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

    .sidebar-widget {
        padding: 1.5rem;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .pagination-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .back-to-blog {
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

    .blog-header {
        padding: 5rem 0 2rem;
    }

    .blog-header h1 {
        font-size: 2rem;
    }

    .blog-layout {
        gap: 1.5rem;
    }

    .blog-post {
        padding: 1rem;
        margin: 0;
    }

    .single-post {
        padding: 1rem;
        margin: 0;
        box-shadow: none;
        border-radius: 8px;
    }

    .sidebar-widget {
        padding: 1rem;
    }

    .post-header .post-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .post-meta {
        font-size: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .post-content {
        font-size: 16px;
    }

    .post-content h1,
    .post-content h2,
    .post-content h3 {
        font-size: 1.3rem;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }

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

    .post-content code {
        font-size: 14px;
        padding: 2px 4px;
        background: #f8f9fa;
        border-radius: 4px;
        word-break: break-word;
    }

    .post-content pre {
        overflow-x: auto;
        font-size: 14px;
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .search-container {
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    .search-input-group {
        border-radius: 15px;
    }
    
    .search-input, .search-button {
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .back-to-blog {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
}
