/**
 * Single Blog Post Styles
 * Based on Figma design: https://www.figma.com/design/HdhVruCm1xwQDVCTo1yHyd/Website-TAM-dental?node-id=606-7507
 */

.single-post-container {
    background: #ffffff;
    /* Ensure container doesn't block sticky positioning */
    overflow: visible;
}

/* Force all parent elements to not interfere with sticky */
body.single-post article.single-post-container,
body.single article.single-post-container {
    overflow: visible !important;
}

/* Hero Section */
.post-hero-section {
    padding: 96px 32px 64px;
    background: #ffffff;
}

.post-hero-section .container {
    max-width: 1216px;
    margin: 0 auto;
}

.post-hero-content {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

/* Post Meta Information */
.post-hero-meta {
    flex: 1;
    max-width: 600px;
}

.post-meta-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    background: #F6FBFD;
    color: #0B76AD;
    border: 1px solid #DBF0FB;
}

.reading-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 4px;
    background: #FAFAFA;
    border: 1px solid #E9EAEB;
    border-radius: 9999px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #414651;
}

/* Post Title */
.post-hero-section .post-title {
    font-family: 'Poppins', sans-serif;
    font-size: 60px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -2.5%;
    color: #181D27;
    margin: 0 0 24px 0;
}

/* Post Excerpt */
.post-hero-section .post-excerpt {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 300;
    line-height: 1.5;
    letter-spacing: -2.5%;
    color: #535862;
    margin-bottom: 48px;
}

/* Author Information */
.post-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.author-details {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: -1.25%;
    color: #181D27;
}

.publish-date {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.5;
    letter-spacing: -1.25%;
    color: #535862;
}

/* Featured Image */
.post-featured-image {
    flex: 1;
    max-width: 720px;
    height: 720px;
    border-radius: 16px;
    overflow: hidden;
}

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

/* Content Section */
.post-content-section {
    padding: 64px 32px;
    background: #ffffff;
    /* Ensure parent doesn't block sticky */
    overflow: visible;
}

.post-content-section .container {
    max-width: 1216px;
    margin: 0 auto;
    /* Ensure container doesn't block sticky */
    overflow: visible;
}

.post-content-wrapper {
    display: flex;
    gap: 64px;
    align-items: flex-start;
    position: relative;
    /* Ensure wrapper doesn't block sticky */
    overflow: visible;
}

/* Sidebar */
.post-sidebar {
    width: 280px;
    position: -webkit-sticky;
    position: sticky;
    top: 100px; /* Increased to account for header */
    flex-shrink: 0;
    z-index: 10;
    /* Ensure sidebar has height constraint */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    /* Add smooth scroll */
    scroll-behavior: smooth;
    /* Ensure sticky works in Safari */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Custom scrollbar for sidebar */
.post-sidebar::-webkit-scrollbar {
    width: 4px;
}

.post-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.post-sidebar::-webkit-scrollbar-thumb {
    background: #D5D7DA;
    border-radius: 2px;
}

.post-sidebar::-webkit-scrollbar-thumb:hover {
    background: #B8BCC3;
}

.sidebar-divider {
    width: 100%;
    height: 1px;
    background: #E9EAEB;
    margin: 32px 0;
}

/* TOC Section specific styles */
.toc-section {
    /* Remove max-height and overflow from TOC section to allow sidebar to handle scrolling */
    padding-right: 8px;
}

.toc-title {
    color: #14A2EB;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: -1.25%;
    margin: 0 0 16px 0;
}

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

.toc-list li {
    margin-bottom: 12px;
}

.toc-list a {
    color: #535862;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: -1.25%;
    text-decoration: none;
    transition: all 0.2s ease;
    display: block;
    padding: 4px 8px;
    border-radius: 4px;
    position: relative;
}

.toc-list a:hover {
    color: #14A2EB;
    background: rgba(20, 162, 235, 0.05);
}

.toc-list a.active {
    color: #14A2EB;
    background: rgba(20, 162, 235, 0.1);
    font-weight: 600;
}

.toc-list a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #14A2EB;
    border-radius: 2px;
}

.toc-list a.toc-h3 {
    padding-left: 28px;
    font-size: 14px;
}

[lang="ar"] .toc-list a.active::before {
    left: auto;
    right: 0;
}

/* Social Share Buttons */
.social-share-buttons {
    display: flex;
    gap: 12px;
}

.social-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid #D5D7DA;
    border-radius: 8px;
    color: #A4A7AE;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0px 1px 2px 0px rgba(10, 13, 18, 0.05);
}

.social-share-btn:hover {
    background: #F5F5F5;
    color: #535862;
    transform: translateY(-2px);
}

.social-share-btn.copied {
    background: #10B981;
    color: #ffffff;
    border-color: #10B981;
}

/* Main Content */
.post-main-content {
    flex: 1;
    max-width: 800px;
    min-height: 100vh; /* Ensure content is tall enough for sticky to work */
}

.post-content-body {
    font-family: 'Poppins', sans-serif;
    color: #535862;
}

/* Content Typography */
.post-content-body p {
    font-size: 18px;
    font-weight: 300;
    line-height: 1.56;
    letter-spacing: -1.11%;
    margin-bottom: 24px;
}

.post-content-body h2 {
    font-size: 26px;
    font-weight: 500;
    line-height: 1.38;
    letter-spacing: -3.85%;
    color: #181D27;
    margin: 40px 0 20px;
}

.post-content-body h3 {
    font-size: 22px;
    font-weight: 500;
    line-height: 1.36;
    letter-spacing: -4.55%;
    color: #181D27;
    margin: 32px 0 16px;
}

.post-content-body ul,
.post-content-body ol {
    margin: 0 0 24px 0;
    padding-left: 24px;
}

.post-content-body li {
    font-size: 18px;
    font-weight: 300;
    line-height: 1.56;
    margin-bottom: 12px;
}

.post-content-body blockquote {
    margin: 48px 0;
    padding: 32px;
    background: #FAFAFA;
    border-left: 2px solid #7F56D9;
    border-radius: 8px;
}

.post-content-body blockquote p {
    font-size: 22px;
    font-weight: 400;
    line-height: 1.36;
    letter-spacing: -4.55%;
    color: #181D27;
    margin: 0;
}

.post-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    margin: 32px 0;
}

.post-content-body .wp-caption {
    max-width: 100%;
    margin: 32px 0;
}

.post-content-body .wp-caption-text {
    font-size: 14px;
    color: #535862;
    text-align: center;
    margin-top: 8px;
}

/* Post Footer */
.post-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #E9EAEB;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-badge {
    display: inline-block;
    padding: 2px 10px;
    background: #F6FBFD;
    color: #0B76AD;
    border: 1px solid #DBF0FB;
    border-radius: 9999px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.43;
    letter-spacing: -1.43%;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag-badge:hover {
    background: #0B76AD;
    color: #ffffff;
}

/* Related Posts Section */
.related-posts-section {
    padding: 64px 32px;
    background: #F9FAFB;
}

.related-posts-section .container {
    max-width: 1216px;
    margin: 0 auto;
}

.related-posts-header {
    margin-bottom: 32px;
}

.related-posts-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 32px;
    font-weight: 500;
    line-height: 1.31;
    letter-spacing: -3.13%;
    color: #181D27;
    margin: 0;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.related-post-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.related-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.related-post-image {
    width: 100%;
    height: 240px;
    overflow: hidden;
}

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

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

.related-post-content {
    padding: 24px;
}

.related-post-meta {
    margin-bottom: 8px;
}

.related-post-date {
    color: #0B76AD;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.43;
    letter-spacing: -0.2px;
}

.related-post-title {
    margin: 0 0 12px 0;
}

.related-post-title a {
    color: #181D27;
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.2px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.related-post-title a:hover {
    color: #0B76AD;
}

.related-post-excerpt {
    color: #535862;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.related-post-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Category badge colors (reuse from other sections) */
.category-badge.category-general {
    background: #F6FBFD;
    color: #0B76AD;
    border-color: #DBF0FB;
}

.category-badge.category-implant,
.category-badge.category-implants {
    background: #FFFAEB;
    color: #B54708;
    border-color: #FEDF89;
}

.category-badge.category-kids-dental {
    background: #F0F9FF;
    color: #0369A1;
    border-color: #BAE6FD;
}

/* RTL Support */
[lang="ar"] .single-post-container {
    direction: rtl;
}

[lang="ar"] .post-hero-content {
    flex-direction: row-reverse;
}

[lang="ar"] .post-author-info {
    flex-direction: row-reverse;
}

[lang="ar"] .post-content-wrapper {
    flex-direction: row-reverse;
}

[lang="ar"] .post-sidebar {
    margin-right: 0;
    margin-left: 64px;
}

[lang="ar"] .toc-list a.toc-h3 {
    padding-left: 0;
    padding-right: 20px;
}

[lang="ar"] .post-content-body {
    text-align: right;
}

[lang="ar"] .post-content-body ul,
[lang="ar"] .post-content-body ol {
    padding-left: 0;
    padding-right: 24px;
}

[lang="ar"] .post-content-body blockquote {
    border-left: none;
    border-right: 2px solid #7F56D9;
}

[lang="ar"] .post-hero-section .post-title,
[lang="ar"] .post-hero-section .post-excerpt,
[lang="ar"] .related-posts-header h2 {
    text-align: right;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .post-hero-content {
        flex-direction: column;
    }
    
    .post-featured-image {
        max-width: 100%;
        height: 500px;
    }
    
    .post-content-wrapper {
        flex-direction: column;
    }
    
    .post-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        margin-bottom: 48px;
    }
    
    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .post-hero-section {
        padding: 64px 24px 48px;
    }
    
    .post-hero-section .post-title {
        font-size: 36px;
    }
    
    .post-hero-section .post-excerpt {
        font-size: 18px;
    }
    
    .post-content-section {
        padding: 48px 24px;
    }
    
    .post-featured-image {
        height: 400px;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .social-share-buttons {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .post-hero-section {
        padding: 48px 16px 32px;
    }
    
    .post-hero-section .post-title {
        font-size: 28px;
    }
    
    .post-content-body p,
    .post-content-body li {
        font-size: 16px;
    }
    
    .post-content-body h2 {
        font-size: 22px;
    }
    
    .post-content-body h3 {
        font-size: 20px;
    }
}