/**
 * Single Post Styles
 * Mobile-first responsive design for article layout
 */

/* ===========================
   WRAPPER
   =========================== */

.single-post-wrapper {
    min-height: 100vh;
    background: #0f172a;
}

.single-post-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 1;
    margin-top: 400px;
}

/* ===========================
   ARTICLE HEADER - Full Width
   =========================== */

.article-header {
    position: relative;
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0;
    z-index: 2;
}

.article-header-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.article-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.7));
    z-index: 2;
}

.article-header-content {
    position: relative;
    z-index: 3;
    max-width: 1200px;
    padding: 2rem;
    color: #fff;
    text-align: left;
    width: 100%;
}

/* Breadcrumb */
.article-breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

.article-breadcrumb a {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.article-breadcrumb a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Title */
.article-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    color: #fff;
}

/* Meta Description */
.article-meta-description {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.article-meta-description p {
    margin: 0;
}

/* Meta Info */
.article-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.875rem;
}

.article-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-author img {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.article-date i {
    margin-right: 0.5rem;
}

/* ===========================
   SINGLE POST CONTAINER
   =========================== */

.single-post-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    position: relative;
    z-index: 2;
}

/* ===========================
   SIDEBAR - Left Side
   =========================== */

.single-post-sidebar {
    position: relative;
    order: 2;
}

.article-sidebar-wrapper {
    position: relative;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
    background: var(--theme-palette-color-1, #007bff);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: background 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--theme-palette-color-2, #0056b3);
}

.sidebar-toggle i {
    font-size: 1.25rem;
}

.sidebar-content {
    display: none;
}

.sidebar-content.active {
    display: block;
}

/* Unified Sidebar Section */
.sidebar-section.unified-section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
       max-height: calc(100vh - 4rem);
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.sidebar-section-header i:first-child {
    color: var(--theme-palette-color-1, #007bff);
    font-size: 1.125rem;
}

.sidebar-section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
    flex: 1;
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #666;
    transition: color 0.3s ease, transform 0.3s ease;
    margin-left: auto;
}

.toc-toggle:hover {
    color: #333;
}

.toc-toggle i {
    transition: transform 0.3s ease;
    font-size: 0.875rem;
}

.toc-toggle[aria-expanded="false"] i {
    transform: rotate(180deg);
}

/* Table of Contents - Scrollable */
.toc-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    min-height: 100px;
}

.toc-content.collapsed {
    display: none;
}

.toc-content ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    counter-reset: toc-counter;
}

.toc-content > ul > li {
    counter-increment: toc-counter;
}

.toc-content > ul > li::before {
    content: counter(toc-counter) "." counter(toc-sub-counter);
    color: var(--theme-palette-color-1, #007bff);
    font-weight: 600;
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

.toc-content ul ul {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    counter-reset: toc-sub-counter;
}

.toc-content ul ul li {
    counter-increment: toc-sub-counter;
}

.toc-content li {
    margin-bottom: 0.75rem;
    position: relative;
}

.toc-content a {
    color: #4b5563;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0.25rem 0;
}

.toc-content a:hover {
    color: var(--theme-palette-color-1, #007bff);
    transform: translateX(4px);
}

.toc-content a.active {
    color: var(--theme-palette-color-1, #007bff);
    font-weight: 600;
}

/* Custom scrollbar for TOC */
.toc-content::-webkit-scrollbar {
    width: 4px;
}

.toc-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.toc-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Share Section Footer - Always Visible */
.share-section-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid #e8e8e8;
}

.share-section-footer h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: #1a1a1a;
    text-align: left;
}

.share-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.share-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: transparent;
    border: none;
    text-decoration: none;
    color: #666;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-size: 1.25rem;
    border-radius: 50%;
}

.share-button:hover {
    transform: translateY(-4px) scale(1.05);
}

.share-button i {
    font-size: 1.25rem;
}

.share-facebook {
    color: #1877f2;
}

.share-facebook:hover {
    background: #1877f2;
    color: #fff;
}

.share-linkedin {
    color: #0a66c2;
}

.share-linkedin:hover {
    background: #0a66c2;
    color: #fff;
}

.share-twitter {
    color: #000;
}

.share-twitter:hover {
    background: #000;
    color: #fff;
}

.share-email {
    color: #666;
}

.share-email:hover {
    background: #666;
    color: #fff;
}

/* ===========================
   ARTICLE CONTENT
   =========================== */

.single-post-content {
    order: 1;
    max-width: 100%;
}

.entry-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #374151;
    font-weight: 400;
    max-width: 750px;
}

.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-weight: 700;
    color: #111827;
    scroll-margin-top: 2rem;
    letter-spacing: -0.02em;
}

.entry-content h2 {
    font-size: 2.25rem;
    border-bottom: none;
    padding-bottom: 0;
}

.entry-content h3 {
    font-size: 1.75rem;
    font-weight: 600;
}

.entry-content h4 {
    font-size: 1.375rem;
    font-weight: 600;
}

.entry-content p {
    margin-bottom: 1.5rem;
}

.entry-content a {
    color: var(--theme-palette-color-1, #007bff);
    text-decoration: underline;
}

.entry-content a:hover {
    color: var(--theme-palette-color-2, #0056b3);
}

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

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.entry-content li {
    margin-bottom: 0.5rem;
}

.entry-content blockquote {
    border-left: 4px solid var(--theme-palette-color-1, #007bff);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #555;
}

.entry-content code {
    background: #f8f9fa;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.entry-content pre {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
}

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

/* Entry Footer */
.entry-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e9ecef;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tags-label {
    font-weight: 600;
    color: #333;
}

.post-tags a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #e9ecef;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.post-tags a:hover {
    background: var(--theme-palette-color-1, #007bff);
    color: #fff;
}

/* ===========================
   TABLET - 768px and up
   =========================== */

@media (min-width: 768px) {
    .article-header {
        min-height: 500px;
    }

    .article-title {
        font-size: 3rem;
    }

    .article-meta-description {
        font-size: 1.25rem;
    }

    .single-post-wrapper::after {
        margin-top: 500px;
    }

    .single-post-container {
        padding: 4rem 2rem;
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar-content {
        display: block !important;
    }
}

/* ===========================
   DESKTOP - 1024px and up
   =========================== */

@media (min-width: 1024px) {
    .article-header {
        min-height: 600px;
    }

    .article-title {
        font-size: 3.5rem;
    }

    .single-post-wrapper::after {
        margin-top: 600px;
    }

    .single-post-container {
        grid-template-columns: 300px 1fr;
        gap: 4rem;
        padding: 5rem 2rem;
    }

    .single-post-sidebar {
        order: 1;
    }

    .single-post-content {
        order: 2;
    }

    .article-sidebar-wrapper {
        position: sticky;
        top: 6rem;
        max-height: calc(100vh - 6rem);
        overflow-y: auto;
    }

    /* Custom scrollbar for sidebar */
    .article-sidebar-wrapper::-webkit-scrollbar {
        width: 6px;
    }

    .article-sidebar-wrapper::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    .article-sidebar-wrapper::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }

    .article-sidebar-wrapper::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* ===========================
   LARGE DESKTOP - 1200px and up
   =========================== */

@media (min-width: 1200px) {
    .single-post-container {
        grid-template-columns: 320px 1fr;
        gap: 5rem;
        padding: 6rem 3rem;
    }

    .entry-content {
        font-size: 1.125rem;
    }
}
