/* ==========================================================================
   SINGLE POST STYLES - MOBILE OPTIMIZED
   ==========================================================================
   TABLE OF CONTENTS
   
   1.0: Post Layout & Structure
       1.1: Unified Post Container
       1.2: General Layout & Container
       1.3: Post Header & Meta
       1.4: Post Intro Section (ACF) - Full Width
       1.5: Entry Content Typography & Elements

   2.0: Components
       2.1: Table of Contents (Plugin)
       2.2: Author Box
       2.3: Sticky "Get Tool" Bar
       
   3.0: Responsive Styles (Single Post Specific)
       3.1: Mobile Breakpoints (< 768px)
       3.2: Sticky Bar Responsive Adjustments
   ========================================================================== */

/* ==========================================================================
   1.0: Post Layout & Structure
   ========================================================================== */
   
/* 1.1: Unified Post Container - Ensures consistent width */
.single-post .entry-header,
.single-post .entry-content,
.single-post .author-box,
.single .comments-area,
.single .ast-related-posts-wrap,
.single .ast-pagination {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* 1.1.1: Post Intro Section gets special full-width treatment */
.single-post .post-intro-section {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0; /* Remove padding for full width */
    padding-right: 0; /* Remove padding for full width */
    width: 100%;
    box-sizing: border-box;
}

/* 1.2: General Layout & Container */
.single-post #primary { 
    padding: 40px 0 60px 0; 
    background-color: #f7f9fb; 
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px); 
    background-size: 20px 20px; 
}
.single-post .site-main > article { 
    background-color: #fff; 
    border: 1px solid var(--border-color); 
    padding: 0; 
    border-radius: var(--radius-lg); 
    box-shadow: 0 10px 30px rgba(35, 84, 162, 0.07); 
    overflow: hidden;
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
}

/* 1.3: Post Header & Meta */
.single-post .entry-header { 
    text-align: left; 
    padding-top: clamp(2rem, 5vw, 3rem);
    padding-bottom: clamp(2rem, 5vw, 3rem);
    background: var(--bg-light); 
    border-bottom: 1px solid var(--border-color); 
}
.single-post .entry-header .post-categories a { 
    display: inline-block; 
    background-color: rgba(35, 84, 162, 0.1); 
    color: var(--brand-primary); 
    font-size: 0.8rem; 
    font-weight: 600; 
    padding: 6px 12px; 
    border-radius: var(--radius-full); 
    margin-bottom: 1rem; 
    transition: background-color 0.2s ease; 
}
.single-post .entry-header .post-categories a:hover { 
    background-color: rgba(35, 84, 162, 0.2); 
}
.single-post .entry-title { 
    color: var(--text-heading); 
    font-size: clamp(2.2rem, 5vw, 3.2rem); 
    line-height: 1.2; 
    margin-bottom: 1.5rem; 
    font-weight: 800; 
}
.single-post .entry-meta { 
    display: none; /* Hide default meta to replace it */
}
.entry-meta-custom { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
}
.author-avatar img { 
    border-radius: 50%; 
    border: 2px solid var(--border-color); 
    display: block; 
}
.meta-text .author-name { 
    color: var(--text-body); 
    font-weight: 600; 
    font-size: 1rem; 
}
.meta-text .author-name a { 
    color: var(--brand-primary); 
    text-decoration: none; 
    background: none; 
    transition: color 0.2s ease; 
}
.meta-text .author-name a:hover { 
    color: var(--brand-primary-hover); 
}
.meta-text .posted-on { 
    color: var(--text-light); 
    font-size: 0.9rem; 
}

/* 1.4: Post Intro Section (ACF) - Full Width */
.post-intro-section { 
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
}
.post-intro-section .post-intro-wrapper {
    display: grid; 
    grid-template-columns: 2fr 3fr; 
    gap: 0; 
    background: #fff; 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-lg); 
    overflow: hidden; 
    box-shadow: var(--shadow-md); 
    width: 100%;
    max-width: 100%;
}
.post-intro-image img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
}
.post-intro-content { 
    padding: clamp(1.5rem, 3vw, 2rem); 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
}
.post-intro-content .intro-subtitle { 
    font-size: clamp(1.1rem, 2vw, 1.25rem); 
    color: var(--text-heading); 
    font-weight: 600; 
    line-height: 1.4; 
    margin-top: 0; 
    margin-bottom: 1.5rem; 
    border-left: 3px solid var(--brand-primary); 
    padding-left: 1rem; 
}
.intro-details-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1rem; 
}
.detail-item { 
    display: flex; 
    flex-direction: column; 
}
.detail-label { 
    font-size: 0.75rem; 
    color: var(--text-light); 
    font-weight: 500; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    margin-bottom: 4px; 
}
.detail-value { 
    font-size: 1rem; 
    font-weight: 600; 
    color: var(--text-heading); 
}
.detail-value.rating-value { 
    color: var(--brand-primary); 
}

/* 1.5: Entry Content Typography & Elements */
.single-post .entry-content {
    padding-top: clamp(0.5rem, 3vw, 1.5rem);
    padding-bottom: clamp(1.5rem, 4vw, 3rem);
}
.single-post .entry-content > *:first-child { 
    margin-top: 0; 
}
.single-post .entry-content h2 { 
    font-size: 1.8rem; 
    line-height: 1.3; 
    margin-top: 2em;
    margin-bottom: 0.8em;
    padding-left: 15px;
    border-left: 3px solid var(--brand-primary);
}
.single-post .entry-content h3 { 
    font-size: 1.5rem; 
    margin-top: 2em;
    margin-bottom: 0.8em;
    color: var(--brand-primary); 
    font-weight: 700; 
}
.single-post .entry-content p,
.single-post .entry-content ul,
.single-post .entry-content ol {
    margin-bottom: 1em;
    line-height: 1.6;
}
.single-post .entry-content a { 
    color: var(--brand-primary); 
    text-decoration: none; 
    background-image: linear-gradient(to right, var(--brand-primary-hover), var(--brand-primary)); 
    background-size: 0% 2px; 
    background-position: 0% 100%; 
    background-repeat: no-repeat; 
    transition: background-size 0.3s ease-in-out; 
}
.single-post .entry-content a:hover { 
    background-size: 100% 2px; 
}
.single-post .entry-content blockquote { 
    border: none; 
    padding: 1.5rem;
    margin: 1.5em 0;
    background-color: var(--bg-light); 
    border-radius: var(--radius-md); 
    border-left: 4px solid var(--brand-primary); 
    font-style: normal; 
    font-size: 1.1rem; 
    color: var(--text-heading); 
    position: relative; 
}
.single-post .entry-content blockquote p { 
    margin: 0; 
}
.single-post .entry-content blockquote::before { 
    content: '"'; 
    position: absolute; 
    left: -12px; 
    top: -10px; 
    font-size: 5rem; 
    font-family: Georgia, serif; 
    color: rgba(35, 84, 162, 0.1); 
    z-index: 1; 
}
.single-post .entry-content ul { 
    list-style: none; 
    padding-left: 0; 
}
.single-post .entry-content ul li,
.single-post .entry-content li {
    position: relative; 
    padding-left: 35px; 
    margin-bottom: 0.5em;
}
.single-post .entry-content ul li::before { 
    content: '✓'; 
    position: absolute; 
    left: 0; top: 2px; 
    color: #fff; 
    background-color: var(--brand-primary); 
    border-radius: 50%; 
    width: 24px; 
    height: 24px; 
    font-weight: 600; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 14px; 
    line-height: 1; 
}
.entry-content table { 
    width: 100%; 
    border-collapse: collapse; 
    margin: 2em 0; 
    font-size: 0.9rem; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md); 
    overflow: hidden; 
}
.entry-content th, .entry-content td { 
    padding: 10px 12px; 
    text-align: left; 
    border-bottom: 1px solid var(--border-color); 
    border-right: 1px solid var(--border-color); 
}
.entry-content th:last-child, .entry-content td:last-child { 
    border-right: none; 
}
.entry-content thead th { 
    background-color: #f1f5f9; 
    color: var(--text-heading); 
    font-weight: 600; 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    letter-spacing: 0.5px; 
}
.entry-content tbody tr:nth-of-type(even) { 
    background-color: var(--bg-light); 
}
.entry-content tbody tr:last-of-type td { 
    border-bottom: 0; 
}

/* ==========================================================================
   2.0: Components
   ========================================================================== */

/* 2.1: Table of Contents (Plugin) */
#toc_container { 
    background: var(--bg-light); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md); 
    padding: 25px 30px; 
    margin: 2em 0; 
}
#toc_container .toc_title { 
    font-size: 1.2rem; 
    font-weight: 700; 
    color: var(--text-heading); 
    margin: 0 0 15px 0; 
    display: block; 
}
#toc_container ul { 
    list-style: none; 
    padding-left: 5px; 
    counter-reset: toc-counter; 
}
#toc_container ul li { 
    padding-left: 0; 
    font-size: 1rem; 
    position: relative; 
    margin-bottom: 0.75em; 
}
#toc_container ul li a { 
    background-image: none; 
    transition: color 0.2s ease, transform 0.2s ease; 
    display: inline-block; 
}
#toc_container ul li a:hover { 
    color: var(--brand-primary-hover); 
    transform: translateX(3px); 
}
#toc_container ul li::before { 
    counter-increment: toc-counter; 
    content: counter(toc-counter) "."; 
    font-weight: 600; 
    color: var(--brand-primary); 
    margin-right: 10px; 
}

/* 2.2: Author Box */
.author-box { 
    margin-top: 3rem;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--bg-light); 
    border: 1px solid var(--border-color); 
    border-top: 4px solid var(--brand-primary); 
    padding-top: calc(2.5rem - 4px); 
    border-radius: var(--radius-lg); 
    display: flex; 
    align-items: flex-start; 
    text-align: left; 
    gap: 25px; 
}
.author-box .avatar { 
    width: 80px; 
    height: 80px; 
    border-radius: 50%; 
    margin-bottom: 0; 
    flex-shrink: 0; 
}
.author-box .author-info { 
    flex: 1; 
    min-width: 0; 
}
.author-box h4 { 
    font-size: 1.5rem; 
    margin: 0 0 0.5rem 0; 
}
.author-box p { 
    font-size: 1rem; 
    line-height: 1.7; 
    margin: 0; 
}

/* 2.3: Sticky "Get Tool" Bar */
.sticky-tool-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--border-color);
    padding: 12px 0;
    z-index: 998;
    transform: translateY(100%);
    animation: slideUp 0.5s 1s ease-out forwards;
}
@keyframes slideUp {
    to { transform: translateY(0); }
}
.sticky-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.sticky-bar-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0; 
}
.sticky-bar-logo {
    width: 40px;
    height: 40px;
    background-color: var(--bg-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.sticky-bar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sticky-bar-title {
    display: none; /* Hide on mobile by default */
    font-weight: 600;
    color: var(--text-heading);
    font-size: 18px;
}
.sticky-bar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.sticky-bar-rating {
    display: none; /* Hide on very small screens, will be shown via media query */
}
.sticky-bar-rating .stars {
    color: var(--color-warning);
    font-size: 1rem;
    letter-spacing: 1px;
}
.sticky-bar-rating .rating-num {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
}

/* ==========================================================================
   3.0: Responsive Styles (Single Post Specific)
   ========================================================================== */

/* 3.1: Mobile Breakpoints (< 768px) */
@media (max-width: 768px) {
    .single-post #primary { 
        padding: 20px 0 40px 0;
    }
    
    /* Reduced padding on mobile for content areas */
    .single-post .entry-header, 
    .single-post .entry-content,
    .single-post .author-box,
    .single .comments-area,
    .single .ast-related-posts-wrap,
    .single .ast-pagination { 
        padding-left: 10px; /* Reduced from 20px to 10px */
        padding-right: 10px; /* Reduced from 20px to 10px */
    }
    
    /* Post Intro Section - Full width on mobile with zero padding */
    .post-intro-section { 
        margin: 1.5rem 0; /* Remove auto margins, use zero horizontal */
        padding-left: 0; /* Complete removal of padding */
        padding-right: 0; /* Complete removal of padding */
        max-width: 100%; /* Ensure full width */
    }
    
    .post-intro-section .post-intro-wrapper {
        grid-template-columns: 1fr;
        border-left: none; /* Remove left border for full width */
        border-right: none; /* Remove right border for full width */
        border-radius: 0; /* Remove border radius for full width */
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Smaller image/icon on mobile */
    .post-intro-image {
        height: 120px; /* Much smaller fixed height on mobile */
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--bg-light);
    }
    
    .post-intro-image img {
        width: auto;
        height: 80px; /* Constrain image to smaller size */
        max-width: 100%;
        object-fit: contain; /* Show full image within smaller space */
    }
    
    .post-intro-content { 
        padding: 1rem; 
    }
    
    .intro-details-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Social Sharing */
    .ast-post-social-sharing {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .ast-post-social-sharing .social-share-title {
        text-align: center;
        margin-bottom: 0;
    }
    
    /* Ensure the main article container has minimal padding on mobile */
    .single-post .site-main > article {
        margin-left: 10px;
        margin-right: 10px;
        max-width: calc(100% - 20px);
    }
}

/* 3.1.1: Extra small mobile optimization (< 480px) */
@media (max-width: 480px) {
    .single-post .entry-header, 
    .single-post .entry-content,
    .single-post .author-box,
    .single .comments-area,
    .single .ast-related-posts-wrap,
    .single .ast-pagination { 
        padding-left: 8px; /* Even more minimal padding */
        padding-right: 8px; /* Even more minimal padding */
    }
    
    .single-post .site-main > article {
        margin-left: 8px;
        margin-right: 8px;
        max-width: calc(100% - 16px);
    }
    
    .post-intro-content { 
        padding: 0.75rem; /* Reduce padding further on very small screens */
    }
    
    /* Even smaller image on very small screens */
    .post-intro-image {
        height: 100px; /* Even smaller on tiny screens */
    }
    
    .post-intro-image img {
        height: 60px; /* Smaller image size for tiny screens */
    }
}

/* 3.2: Sticky Bar Responsive Adjustments */
@media (max-width: 375px) {
    .sticky-bar-rating {
        display: flex;
        align-items: center;
        gap: 6px;
    }
}

@media (min-width: 375px) {
    .sticky-bar-rating {
        display: flex;
        align-items: center;
        gap: 6px;
    }
}

@media (min-width: 768px) {
    .sticky-bar-title {
        display: block; /* Show title on tablets and larger */
    }
    .sticky-bar-actions {
        gap: 20px;
    }
    .sticky-bar-rating .stars,
    .sticky-bar-rating .rating-num {
        font-size: 1.1rem;
    }
}