/* =================================================================
   CODEQUIRY BLOG - OPTIMIZED STYLES
   Version: 2.0
   Performance: Optimized for fast loading
   ================================================================= */

:root {
    --primary: #667eea;
    --primary-dark: #5a6fd8;
    --secondary: #764ba2;
    --danger: #ff6b6b;
    --success: #51cf66;
    --warning: #ffd43b;
    --info: #74c0fc;
    --dark: #1a202c;
    --gray: #4a5568;
    --gray-light: #e2e8f0;
    --bg-light: #f7fafc;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 16px;
    --transition: all 0.3s ease;
}

/* =================================================================
   BLOG LIST PAGE
   ================================================================= */

/* Hero Section */
.blog-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 6rem 0 4rem;
    padding-top: calc(6rem + 60px);
    position: relative;
    overflow: hidden;
    margin-top: 60px;
}

.blog-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    opacity: 0.3;
}

.blog-hero-content {
    position: relative;
    z-index: 2;
    color: white;
    text-align: center;
}

.blog-hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 1rem;
    color: white;
}

.blog-hero p {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 2rem;
    color: white;
}

/* Search Section */
.blog-search {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    margin: 0 auto;
}

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

.blog-search-input input {
    flex: 1;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.blog-search-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.blog-search-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.blog-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Category Filters */
.category-filters {
    background: white;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--gray-light);
}

.filter-btns {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.filter-btn {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--gray-light);
    background: white;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
}

/* Blog Grid */
.blog-grid {
    padding: 4rem 0;
    background: var(--bg-light);
}

.blog-posts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Blog Post Card */
.blog-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.blog-card-img {
    position: relative;
    height: 220px;
    overflow: hidden;
}

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

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

.blog-card-img-placeholder {
    height: 100%;
    background: linear-gradient(135deg, var(--gray-light) 0%, #cbd5e0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.blog-card-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    z-index: 2;
}

.blog-card-time {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(0,0,0,0.7);
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    z-index: 2;
}

.blog-card-body {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
    color: var(--dark);
}

.blog-card-title a {
    color: var(--dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-card-title a:hover {
    color: var(--primary);
}

.blog-card-excerpt {
    color: var(--gray);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex: 1;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--gray);
}

.blog-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

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

.blog-card-tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-light);
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--gray);
}

.blog-card-link {
    padding: 0.5rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.blog-card-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* Featured Post */
.featured-post {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 3rem;
}

.featured-post-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.featured-post-img {
    height: 400px;
    position: relative;
}

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

.featured-post-content {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--warning);
    color: white;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.featured-post-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--dark);
}

.featured-post-excerpt {
    font-size: 1.125rem;
    color: var(--gray);
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* =================================================================
   BLOG POST PAGE
   ================================================================= */

/* Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0,0,0,0.05);
    z-index: 9999;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0;
    transition: width 0.2s ease;
}

/* Post Hero */
.post-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 8rem 0 4rem;
    padding-top: calc(8rem + 60px);
    margin-top: 60px;
    color: white;
    text-align: center;
    position: relative;
}

.post-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    opacity: 0.3;
}

.post-hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
}

.post-breadcrumb {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: white;
}

.post-breadcrumb span {
    color: rgba(255,255,255,0.8);
}

.post-breadcrumb a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-breadcrumb a:hover {
    color: white;
}

.post-breadcrumb i {
    color: white;
}

.post-category {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    color: white;
}

.post-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    color: white;
}

.post-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    color: white;
}

.post-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.95;
    color: white;
}

.post-meta-item i {
    color: white;
}

.post-summary {
    font-size: 1.25rem;
    line-height: 1.6;
    opacity: 0.95;
    margin-bottom: 2rem;
    color: white;
}

/* Post Content */
.post-content-section {
    padding: 4rem 0;
    background: var(--bg-light);
}

.post-content {
    background: white;
    border-radius: var(--radius);
    padding: 3rem;
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin: 0 auto;
}

.post-featured-img {
    margin-bottom: 3rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.post-featured-img img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
}

.post-body {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--dark);
}

.post-body h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    padding-left: 1rem;
    border-left: 4px solid var(--primary);
    color: var(--dark);
}

.post-body h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    color: var(--dark);
}

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

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

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

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
}

.post-body blockquote {
    padding: 1.5rem;
    margin: 2rem 0;
    background: var(--bg-light);
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
    font-style: italic;
}

.post-body code {
    background: var(--bg-light);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.9em;
    color: #e53e3e;
}

.post-body pre {
    background: var(--dark);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 2rem 0;
}

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

/* Post Footer */
.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--gray-light);
}

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

.post-tags h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--dark);
}

.post-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.post-tag {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--gray-light);
    border-radius: 50px;
    color: var(--gray);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.post-tag:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
}

.post-share {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.post-share h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--dark);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    transition: var(--transition);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.share-btn.twitter:hover {
    background: #1da1f2;
    border-color: #1da1f2;
    color: white;
}

.share-btn.linkedin:hover {
    background: #0077b5;
    border-color: #0077b5;
    color: white;
}

.share-btn.facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: white;
}

.share-btn.copy:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
}

/* Sidebar */
.post-sidebar {
    position: sticky;
    top: 2rem;
}

.sidebar-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.sidebar-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark);
}

.toc-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toc-link {
    padding: 0.5rem;
    color: var(--gray);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
}

.toc-link:hover, .toc-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.author-profile {
    text-align: center;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 3px solid var(--gray-light);
}

.author-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.author-title {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.author-bio {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--gray);
}

/* Post Navigation */
.post-nav {
    padding: 3rem 0;
    background: white;
}

.post-nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.post-nav-item {
    padding: 2rem;
    background: var(--bg-light);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--dark);
    transition: var(--transition);
    border: 2px solid transparent;
}

.post-nav-item:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.post-nav-label {
    font-size: 0.9rem;
    color: var(--gray);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.post-nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark);
}

/* Gradient Backgrounds */
.bg-gradient-danger {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #51cf66, #40c057);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #ffd43b, #fab005);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #74c0fc, #339af0);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* Responsive */
@media (max-width: 1024px) {
    .featured-post-grid {
        grid-template-columns: 1fr;
    }
    
    .featured-post-img {
        height: 300px;
    }
    
    .post-nav-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-posts {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .blog-hero {
        padding: 4rem 0 2rem;
    }
    
    .blog-hero h1 {
        font-size: 2rem;
    }
    
    .blog-hero p {
        font-size: 1.1rem;
    }
    
    .blog-posts {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .featured-post-content {
        padding: 2rem;
    }
    
    .featured-post-title {
        font-size: 1.5rem;
    }
    
    .post-hero {
        padding: 5rem 0 2rem;
    }
    
    .post-content {
        padding: 2rem 1.5rem;
    }
    
    .post-body {
        font-size: 1rem;
    }
    
    .share-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .blog-hero {
        padding: 3rem 0 1.5rem;
    }
    
    .blog-hero h1 {
        font-size: 1.75rem;
    }
    
    .blog-search {
        padding: 0.75rem;
    }
    
    .blog-search-input {
        flex-direction: column;
    }
    
    .blog-search-input input,
    .blog-search-btn {
        width: 100%;
    }
    
    .filter-btns {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }
    
    .featured-post-content {
        padding: 1.5rem;
    }
    
    .post-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .blog-card-title {
        font-size: 1.25rem;
    }
}

/* Navigation fix for blog pages */
body {
    padding-top: 0;
    margin-top: 0;
}

/* Ensure proper spacing for fixed navigation */
.navbar-clean.fixed-top ~ * {
    margin-top: 0;
}

/* Loading Optimization */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Print Styles */
@media print {
    .blog-hero, .category-filters, .post-hero, .post-share, .post-nav, .post-sidebar {
        display: none;
    }
    
    .post-content {
        box-shadow: none;
        padding: 0;
    }
}

