/* ===================================
   Blog Detail Page Styles
   =================================== */

/* Reading Progress Bar */
.reading-progress-bar {
    position: fixed;
    top: 76px; /* Position after header (header height is 80px) */
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--bg-light-gray);
    z-index: 999; /* Below header (header is z-index 1000) */
}

.reading-progress-fill {
    height: 100%;
    background: var(--primary-green);
    width: 0%;
    transition: width 0.1s ease;
}

.blog-detail-page {
    padding: var(--spacing-3xl) 0;
    background: var(--color-white);
    position: relative;
    overflow: visible;
}

/* ===================================
   Header Section
   =================================== */

.blog-detail-header {
    text-align: center;
    margin: 180px 0 32px 0
}

.blog-detail-title {
    font-size: 48px;
    font-weight: var(--font-weight-bold);
    color: var(--text-dark);
    line-height: 1.2;
    margin: 0 0 var(--spacing-lg);
}

.blog-detail-subtitle {
    font-size: 18px;
    font-weight: var(--font-weight-regular);
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0 0 var(--spacing-xl);
}

.blog-detail-meta-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
    font-size: 14px;
}

.blog-meta-category,
.blog-meta-read-time,
.blog-meta-date {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.category-label,
.meta-label {
    color: var(--text-dark);
    font-weight: var(--font-weight-regular);
}

.meta-value {
    color: var(--text-dark);
    font-weight: var(--font-weight-regular);
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
}

.category-badge.badge-guide {
    background-color: #B0D0F0;
    color: #1565c0;
}

.category-badge.badge-rule {
    background-color: #F9DCD9;
    color: #c62828;
}

.category-badge.badge-safety {
    background-color: #9FF4D1;
    color: #2e7d32;
}

.category-badge.badge-rules {
    background-color: #F9DCD9;
    color: #c62828;
}

/* ===================================
   Featured Image (Full Width)
   =================================== */

.blog-detail-featured-image {
    width: 100%;
    margin-bottom: var(--spacing-3xl);
    border-radius: 12px;
    overflow: hidden;
}

.blog-detail-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===================================
   Main Content Layout (2 Columns)
   =================================== */

.blog-detail-layout {
    display: flex;
    gap: var(--spacing-xl);
    margin-top: 80px;
    align-items: flex-start;
}

/* ===================================
   Left Sidebar - Share & TOC
   =================================== */

.blog-left-sidebar {
    flex: 0 0 25%;
    max-width: 25%;
    position: relative;
}

.blog-sidebar-sticky {
    position: relative;
    top: 0;
    text-align: left;
    z-index: 100;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    transition: none;
}

/* Content Wrapper - Contains article and related posts */
.blog-detail-content-wrapper {
    flex: 1;
    min-width: 0;
}

.blog-detail-main-content {
    max-width: 100%;
}

/* Share Section */
.blog-share-section {
    margin-bottom: var(--spacing-md);
}

.share-title {
    font-size: 20px;
    font-weight: var(--font-weight-bold);
    color: var(--text-dark);
    margin: 0 0 var(--spacing-md);
}

.share-buttons-vertical {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    background: var(--color-white);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover {
    background: var(--bg-light-gray);
    border-color: var(--border-dark);
    transform: translateY(-2px);
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

/* Table of Contents Section */
.blog-toc-section {
    margin-top: 36px;
    background: var(--color-white);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: var(--spacing-md);
}

.toc-title {
    font-size: 20px;
    font-weight: var(--font-weight-bold);
    color: var(--text-dark);
    margin: 0 0 var(--spacing-xl);
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.toc-nav a {
    display: block;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 16px;
    line-height: 1.6;
    padding: 0;
    border-left: none;
    transition: all 0.3s ease;
}

.toc-nav a:hover {
    color: var(--primary-green);
}

.toc-nav a.active {
    color: var(--primary-green);
    font-weight: var(--font-weight-semibold);
}

/* ===================================
   Main Content Area
   =================================== */

.blog-article-content {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-dark);
    text-align: left;
}

.blog-article-content h1,
.blog-article-content h2,
.blog-article-content h3,
.blog-article-content h4,
.blog-article-content h5,
.blog-article-content h6 {
    color: var(--text-dark);
    font-weight: var(--font-weight-bold);
    margin: var(--spacing-xl) 0 var(--spacing-md);
    line-height: 1.3;
}

.blog-article-content h1 {
    font-size: 36px;
}

.blog-article-content h2 {
    font-size: 30px;
}

.blog-article-content h3 {
    font-size: 24px;
}

.blog-article-content h4 {
    font-size: 20px;
}

.blog-article-content p {
    margin: 0 0 var(--spacing-lg);
}

.blog-article-content ul,
.blog-article-content ol {
    margin: 0 0 var(--spacing-lg);
    padding-left: var(--spacing-xl);
}

.blog-article-content li {
    margin-bottom: var(--spacing-sm);
}

.blog-article-content a {
    color: var(--primary-green);
    text-decoration: underline;
}

.blog-article-content a:hover {
    color: var(--primary-green-dark);
}

.blog-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: var(--spacing-lg) 0;
}

.blog-article-content blockquote {
    border-left: 4px solid var(--primary-green);
    padding-left: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
    font-style: italic;
    color: var(--text-gray);
}

.blog-article-content code {
    background: var(--bg-light-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.blog-article-content pre {
    background: var(--bg-light-gray);
    padding: var(--spacing-lg);
    border-radius: 8px;
    overflow-x: auto;
    margin: var(--spacing-lg) 0;
}

.blog-article-content pre code {
    background: none;
    padding: 0;
}

/* PDF Download Section */
.blog-article-content .file-download {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin: var(--spacing-xl) 0;
    background: var(--bg-light-gray);
}

.blog-article-content .file-download .file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-article-content .file-download .file-info {
    flex: 1;
}

.blog-article-content .file-download .file-name {
    font-weight: var(--font-weight-semibold);
    color: var(--text-dark);
    margin: 0;
}

.blog-article-content .file-download .file-size {
    font-size: 12px;
    color: var(--text-gray);
    margin: 0;
}

/* ===================================
   Related Posts Section
   =================================== */

.related-posts-section {
    margin-top: var(--spacing-xxl);
    padding-top: var(--spacing-xxl);
}

.related-posts-title {
    font-size: 28px;
    font-weight: var(--font-weight-bold);
    color: var(--text-dark);
    text-align: left;
}

.related-posts-grid {
    margin: 24px 0 124px;
}


/* ===================================
   Responsive Design
   =================================== */

/* Tablet (md: 960-1279px) */
@media (max-width: 1279px) {
    .reading-progress-bar {
        top: 76px; /* Adjust for tablet header (two rows) */
    }

    .blog-detail-title {
        font-size: 40px;
    }
}

/* Tablet Small (sm: 600-959px) */
@media (max-width: 959px) {

    .blog-detail-page {
        padding: var(--spacing-xl) 0;
    }

    .blog-detail-layout {
        flex-direction: column;
        margin-top: 60px;
    }

    .blog-left-sidebar {
        display: none;
    }

    .blog-detail-main-content {
        max-width: 100%;
    }

    .blog-detail-title {
        font-size: 32px;
    }

    .blog-detail-subtitle {
        font-size: 16px;
    }

    .blog-detail-meta-bar {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: flex-start;
    }
}

/* Mobile (xs: <600px) */
@media (max-width: 599px) {
    .blog-detail-page {
        padding: var(--spacing-xl) 0;
    }

    .blog-detail-header {
        margin-bottom: var(--spacing-xl);
    }

    .blog-detail-title {
        font-size: 28px;
    }

    .blog-detail-subtitle {
        font-size: 14px;
    }

    .blog-detail-meta-bar {
        font-size: 12px;
    }

    .blog-article-content {
        font-size: 14px;
    }

    .blog-article-content h2 {
        font-size: 24px;
    }

    .blog-article-content h3 {
        font-size: 20px;
    }

    .blog-article-content h4 {
        font-size: 18px;
    }

    .related-posts-title {
        font-size: 22px;
    }
}
