/* ===== Blog Hero Section ===== */
.blog-hero {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 100px;
    background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    position: relative;
    overflow: hidden;
}

.blog-title {
    font-size: 3.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
}

.blog-subtitle {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* ===== Blog Section ===== */
.blog-section {
    padding: 6rem 0;
    min-height: 60vh;
}

.blog-list {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.blog-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 3rem;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(var(--primary-rgb), 0.05));
    opacity: 0;
    transition: opacity 0.5s ease;
}

.blog-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.blog-card:hover::before {
    opacity: 1;
}

.blog-card-header {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.blog-card-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.blog-card-meta {
    display: flex;
    gap: 2rem;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.blog-card-excerpt {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    position: relative;
    z-index: 1;
}

.blog-tag {
    padding: 0.5rem 1.2rem;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 100px;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.blog-card:hover .blog-tag {
    background: var(--primary-color);
    color: white;
}

/* ===== Loading State ===== */
.blog-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    color: var(--text-muted);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.blog-empty {
    text-align: center;
    padding: 4rem 0;
    color: var(--text-muted);
}

.blog-empty h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* ===== Blog Modal ===== */
.blog-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    z-index: 9999;
    overflow-y: auto;
    animation: fadeIn 0.4s ease;
}

.blog-modal.active {
    display: block;
}

/* Ensure body and html maintain dark theme always */
body.blog-modal-open {
    background-color: var(--bg-darker) !important;
}

html {
    background-color: var(--bg-darker) !important;
}

body {
    background-color: var(--bg-darker) !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.blog-modal-content {
    max-width: 900px;
    margin: 4rem auto;
    padding: 3rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    position: relative;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.blog-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 2rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.blog-modal-close:hover {
    background: var(--primary-color);
    transform: rotate(90deg) scale(1.1);
}

.blog-detail {
    padding: 1rem 0;
}

.blog-detail-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.blog-detail-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.blog-detail-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.blog-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Blog content styles - allowing inheritance for theme support */
.blog-detail-content {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.125rem;
}

/* Force blog content to respect theme colors even with inline styles */
.blog-detail-content *:not(pre):not(code) {
    color: inherit !important;
    background-color: transparent !important;
}

.blog-detail-content pre,
.blog-detail-content pre * {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}


/* Blog content inherits theme styles */

/* Specific elements styling */
.blog-detail-content h1,
.blog-detail-content h2,
.blog-detail-content h3,
.blog-detail-content h4,
.blog-detail-content h5,
.blog-detail-content h6 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

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

.blog-detail-content h2 {
    font-size: 1.75rem;
}

.blog-detail-content h3 {
    font-size: 1.5rem;
}

.blog-detail-content h4 {
    font-size: 1.25rem;
}

.blog-detail-content h5 {
    font-size: 1.125rem;
}

.blog-detail-content h6 {
    font-size: 1rem;
}

.blog-detail-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.blog-detail-content code {
    background: var(--bg-card);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    font-size: 0.9em;
}

.blog-detail-content pre {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

.blog-detail-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.blog-detail-content ul,
.blog-detail-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.blog-detail-content li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.blog-detail-content a {
    color: var(--primary-color) !important;
    text-decoration: underline;
}

.blog-detail-content a:hover {
    color: var(--primary-dark) !important;
}

.blog-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.blog-detail-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--text-secondary) !important;
    font-style: italic;
}

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

.blog-detail-content table th,
.blog-detail-content table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
    color: var(--text-secondary) !important;
}

.blog-detail-content table th {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
}

.blog-detail-content strong,
.blog-detail-content b {
    color: var(--text-primary) !important;
    font-weight: 600;
}

.blog-detail-content em,
.blog-detail-content i {
    color: var(--text-secondary) !important;
}

.blog-detail-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .blog-section {
        padding: 4rem 0;
    }

    .blog-title {
        font-size: 2.8rem;
    }

    .blog-card {
        padding: 2rem;
        border-radius: 20px;
    }

    .blog-card-title {
        font-size: 1.8rem;
    }

    .blog-modal-content {
        margin: 1.5rem;
        padding: 2rem;
        border-radius: 20px;
    }

    .blog-detail-title {
        font-size: 2.22rem;
    }
}

@media (max-width: 480px) {
    .blog-hero {
        padding-top: 100px;
    }

    .blog-title {
        font-size: 2.2rem;
    }

    .blog-card-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .blog-card-title {
        font-size: 1.5rem;
    }
}

/* Animation for blog cards */
.blog-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.blog-card:nth-child(1) {
    animation-delay: 0.1s;
}

.blog-card:nth-child(2) {
    animation-delay: 0.2s;
}

.blog-card:nth-child(3) {
    animation-delay: 0.3s;
}

.blog-card:nth-child(4) {
    animation-delay: 0.4s;
}

.blog-card:nth-child(5) {
    animation-delay: 0.5s;
}

.blog-card:nth-child(n+6) {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Active navigation link */
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a.active::after {
    width: 100%;
}