/* single-post.css */
/* =============================================================================
   SINGLE POST PAGE STYLES (single.php)
============================================================================= */

.single-post-wrapper {
    background: white;
    color: #e5e5e5;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
}

.single-post-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 2rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.single-post-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23333" stroke-width="0.5" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.1;
}

.post-header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

.post-breadcrumbs {
    margin-bottom: 2rem;
    margin-top: 3rem;
    font-size: 0.9rem;
    opacity: 0.8;
    animation: fadeInUp 0.6s ease-out;
}

.post-breadcrumbs a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-breadcrumbs a:hover {
    color: #60a5fa;
}

.breadcrumb-separator {
    margin: 0 0.75rem;
    opacity: 0.5;
}

.current-page {
    color: #9ca3af;
}

.post-category-badge {
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.category-badge i {
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.post-title {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: #ffffff;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 3rem;
    font-size: 0.9rem;
    color: #9ca3af;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-item i {
    color: #3b82f6;
    font-size: 0.85rem;
}

.post-featured-image {
    margin-top: 2rem;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.featured-img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-featured-image:hover .featured-img {
    transform: scale(1.02);
}

.post-content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem 4rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    position: relative;
}

.table-of-contents {
    position: sticky;
    top: 100px; /* Increased top margin to prevent navbar overlap */
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border-radius: 15px;
    padding: 1.5rem;
    height: fit-content;
    max-height: calc(100vh - 120px); /* Adjusted for increased top margin */
    overflow-y: auto;
    border: 1px solid #333;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    width: 100%;
    order: 1; /* Desktop order */
}

/* Custom Scrollbar Styles for TOC */
.table-of-contents::-webkit-scrollbar {
    width: 8px;
}

.table-of-contents::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin: 4px 0;
}

.table-of-contents::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.table-of-contents::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.table-of-contents::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

/* Firefox Scrollbar */
.table-of-contents {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(255, 255, 255, 0.05);
}

/* Smooth scrollbar appearance transition */
.table-of-contents:hover::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.table-of-contents.collapsed .toc-nav {
    display: none;
}

.table-of-contents.collapsed {
    max-height: auto;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #333;
}

.toc-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-header i {
    color: #3b82f6;
}

.toc-toggle {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.toc-toggle:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

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

.toc-item {
    margin: 0;
}

.toc-link {
    display: block;
    padding: 0.5rem 0;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: all 0.3s ease;
    border-radius: 0 8px 8px 0;
}

.toc-link:hover,
.toc-link.active {
    color: #3b82f6;
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
    padding-left: 1rem;
}

.toc-level-2 .toc-link {
    padding-left: 1.5rem;
    font-size: 0.85rem;
}

.toc-level-3 .toc-link {
    padding-left: 2.25rem;
    font-size: 0.8rem;
}

.toc-level-4 .toc-link {
    padding-left: 3rem;
    font-size: 0.75rem;
}

.post-content-main {
    min-width: 0;
    max-width: 100%;
    padding-right: 0;
    order: 2; /* Desktop order */
}

.post-content {
    padding: 0;
    margin: 0;
    text-align: justify;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: #3264A7 !important;
    font-weight: 700;
    line-height: 1.3;
    margin: 2.5rem 0 1rem;
    scroll-margin-top: 140px; /* Increased scroll margin for headings */
    text-align: left; /* Keep headings left-aligned */
}

.post-content h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.post-content h2 {
    font-size: 2rem;
    color: #3264A7;
    position: relative;
    padding-bottom: 0.5rem;
}

.post-content h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    border-radius: 2px;
}

.post-content h3 {
    font-size: 1.5rem;
    color: #000000a9;
}

.post-content h4 {
    font-size: 1.25rem;
    color: #0073ff;
}

.post-content p {
    margin-bottom: 1.5rem;
    color: #000000a6;
    font-size: 1.1rem;
    text-align: justify;
}

.post-content .faq-item,
.post-content details {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    margin: 1.5rem 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.post-content .faq-item:hover,
.post-content details:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.post-content .faq-question,
.post-content summary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    position: relative;
    transition: all 0.3s ease;
}

.post-content .faq-question:hover,
.post-content summary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.post-content .faq-question::after,
.post-content summary::after {
    content: '+';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.post-content details[open] summary::after {
    content: '−';
    transform: translateY(-50%) rotate(180deg);
}

.post-content .faq-answer,
.post-content details div {
    padding: 1.5rem;
    color: #374151;
    font-size: 1rem;
    line-height: 1.6;
    background: white;
}

.post-content .faq-answer p,
.post-content details div p {
    margin-bottom: 1rem;
    color: #374151;
}

.post-content .faq-answer p:last-child,
.post-content details div p:last-child {
    margin-bottom: 0;
}

.post-content a {
    color: #3b82f6 !important;
    text-decoration: none;
    position: relative;
    font-weight: 500;
    transition: all 0.3s ease;
}

.post-content a:hover {
    color: #60a5fa !important;
    text-decoration: underline;
}

.post-content a:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 2px;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    text-align: justify; 
}

.post-content li {
    margin-bottom: 0.5rem;
    color: #00000085;
}

/* Fixed list styling to show bullets/dots */
.post-content ul {
    list-style-type: disc; /* Ensure bullets are shown */
}

.post-content ul li {
    list-style-type: disc; /* Force disc bullets */
    display: list-item; /* Ensure proper list item display */
}

.post-content ul li::marker {
    color: #3b82f6;
}

.post-content ol {
    list-style-type: decimal; /* Ensure numbers are shown */
}

.post-content ol li {
    list-style-type: decimal; /* Force decimal numbers */
    display: list-item; /* Ensure proper list item display */
}

.post-content ol li::marker {
    color: #3b82f6;
    font-weight: 600;
}

/* Nested lists */
.post-content ul ul {
    list-style-type: circle;
    margin-top: 0.5rem;
}

.post-content ul ul ul {
    list-style-type: square;
}

.post-content ol ol {
    list-style-type: lower-alpha;
    margin-top: 0.5rem;
}

.post-content ol ol ol {
    list-style-type: lower-roman;
}

.post-content blockquote {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-left: 4px solid #3b82f6;
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-radius: 0 15px 15px 0;
    position: relative;
    font-style: italic;
    color: #e2e8f0;
}

.post-content blockquote::before {
    content: '"';
    font-size: 4rem;
    color: #3b82f6;
    position: absolute;
    top: -10px;
    left: 15px;
    opacity: 0.3;
}

.post-content pre {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

.post-content code {
    background: #1f2937;
    color: #f59e0b;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: #1f2937;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.post-content th,
.post-content td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #374151;
}

.post-content th {
    background: #374151;
    color: #f8fafc;
    font-weight: 600;
}

.post-content td {
    color: #d1d5db;
}

.post-content tr:last-child td {
    border-bottom: none;
}

.post-footer {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid #333;
}

.post-tags-section {
    margin-bottom: 3rem;
}

.tags-title {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tags-title i {
    color: #3b82f6;
}

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

.tag-link {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    color: #e5e5e5 !important;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #4b5563;
}

.tag-link:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.author-bio-section {
    margin-bottom: 3rem;
}

.author-bio-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    border: 1px solid #333;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.author-avatar {
    flex-shrink: 0;
}

.author-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #3b82f6;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.author-info {
    flex: 1;
}

.author-name {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.author-role {
    color: #3b82f6;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.author-description {
    color: #d1d5db;
    line-height: 1.6;
    margin: 0 0 1rem;
}

.author-social {
    display: flex;
    gap: 0.75rem;
}

.author-website {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #374151;
    color: #e5e5e5 !important;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
}

.author-website:hover {
    background: #3b82f6;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.related-posts-section {
    margin-bottom: 3rem;
}

.related-posts-title {
    color: #3b82f6;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.related-posts-title i {
    color: #3b82f6;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.related-post-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.related-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.related-post-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.related-post-image {
    height: 200px;
    overflow: hidden;
}

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

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

.related-post-content {
    padding: 1.5rem;
}

.related-post-title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 1rem;
    transition: color 0.3s ease;
}

.related-post-card:hover .related-post-title {
    color: #3b82f6;
}

.related-post-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #9ca3af;
}

.related-post-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.related-post-meta i {
    color: #3b82f6;
    font-size: 0.8rem;
}

.post-navigation {
    margin-bottom: 3rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: stretch;
}

.nav-links > * {
    flex: 1;
}

.nav-link {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border-radius: 15px;
    padding: 2rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-height: 140px;
    justify-content: space-between;
    height: 100%;
}

.nav-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border-color: #3b82f6;
}

.nav-direction {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.next-link .nav-direction {
    justify-content: flex-end;
}

.nav-direction i {
    color: #3b82f6;
}

.nav-title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    transition: color 0.3s ease;
    flex-grow: 1;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    hyphens: auto;
}

.nav-link:hover .nav-title {
    color: #3b82f6;
}

.next-link .nav-title {
    text-align: right;
    justify-content: flex-end;
}

.back-to-blog {
    text-align: center;
    margin-top: 2rem;
}

.back-to-blog-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    color: #ffffff !important;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.back-to-blog-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

.back-to-blog-btn i {
    transition: transform 0.3s ease;
}

.back-to-blog-btn:hover i {
    transform: translateX(-3px);
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .post-content-container {
        grid-template-columns: 250px 1fr;
        gap: 2rem;
    }

    .post-header-container {
        max-width: 1200px;
    }
}

@media (max-width: 768px) {
    .post-content-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1.5rem 1rem 3rem;
    }

    .table-of-contents {
        position: relative;
        top: 0;
        order: 1; /* Mobile order - TOC comes first */
        margin-top: 0;
        margin-bottom: 2rem;
    }

    /* Mobile: TOC is collapsed by default */
    .table-of-contents.collapsed .toc-nav {
        display: none;
    }

    .post-content-main {
        order: 2; /* Mobile order - content comes after TOC */
        max-width: none;
    }

    .post-header-container {
        padding: 0 1rem;
        max-width: none;
    }

    .post-meta {
        flex-direction: column;
        gap: 1rem;
    }

    .author-bio-card {
        flex-direction: column;
        text-align: center;
    }

    .nav-links {
        flex-direction: column;
    }

    .next-link .nav-direction,
    .next-link .nav-title {
        justify-content: flex-start;
        text-align: left;
    }

    .related-posts-grid {
        grid-template-columns: 1fr;
    }

    .nav-link {
        min-height: 120px;
        height: auto;
    }
}

@media (max-width: 480px) {
    .post-header-container {
        padding: 0 0.75rem;
    }

    .post-content-container {
        padding: 1rem 0.75rem 3rem;
    }

    .post-content h1 {
        font-size: 1.75rem;
    }

    .post-content h2 {
        font-size: 1.5rem;
    }

    .post-content h3 {
        font-size: 1.25rem;
    }

    .table-of-contents {
        padding: 1rem;
    }

    .author-bio-card {
        padding: 1.5rem;
    }

    .nav-link {
        padding: 1.5rem;
        min-height: 110px;
    }

    .post-breadcrumbs {
        margin-top: 2.5rem;
    }
}

/* Print Styles */
@media print {
    .table-of-contents,
    .post-navigation,
    .back-to-blog,
    .related-posts-section {
        display: none;
    }

    .post-content-container {
        grid-template-columns: 1fr;
    }

    .single-post-wrapper {
        background: white;
        color: black;
    }

    .post-content {
        background: white;
        box-shadow: none;
        border: none;
    }
}