.detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Item Header */
.item-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--primary-copper);
}

.item-title {
    font-size: 2.25rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--primary-teal);
    word-wrap: break-word;
}

.item-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--neutral-dim);
    font-size: 0.95rem;
}

.meta-item i {
    color: var(--primary-copper);
}

/* Gallery Styles */
.featured-image-container {
    margin-bottom: 2.5rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
}

.gallery-main {
    position: relative;
    height: 500px;
    overflow: hidden;
}

.gallery-item {
    width: 100%;
    height: 100%;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.gallery-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    transform: translateY(-50%);
    z-index: 10;
}

.gallery-nav {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-nav:hover {
    background-color: var(--primary-copper);
    color: white;
    transform: scale(1.1);
}

.gallery-nav i {
    font-size: 1.2rem;
}

.gallery-thumbnails {
    display: flex;
    padding: 1rem;
    gap: 0.5rem;
    /* background-color: var(--neutral-light); */
    overflow-x: auto;
    justify-content: center;
}

.thumbnail-item {
    flex: 0 0 auto;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail-item.active,
.thumbnail-item:hover {
    opacity: 1;
    border-color: var(--primary-copper);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-caption {
    text-align: center;
    margin: 1rem 0;
    font-style: italic;
    color: var(--neutral-dim);
    min-height: 1.5rem;
}

/* Table of Contents */
.toc-sidebar-mobile {
    margin-bottom: 2rem;
    display: block;
}

.toc-sidebar-mobile details {
    background-color: var(--neutral-light);
    border-radius: 8px;
    padding: 1rem;
}

.toc-sidebar-mobile summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--primary-teal);
    font-size: 1.1rem;
}

.toc-sidebar-desktop {
    display: none;
}

.toc-sticky {
    position: sticky;
    top: 2rem;
}

.toc-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-teal);
}

.toc-nav {
    margin-bottom: 2rem;
}

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

.toc-item {
    margin-bottom: 0.5rem;
}

.toc-item.toc-level-3 {
    padding-left: 1rem;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    color: var(--neutral-dark);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.toc-link:hover,
.toc-link.active {
    background-color: var(--neutral-medium);
    color: var(--primary-copper);
}

.toc-link i {
    font-size: 0.8rem;
    color: var(--primary-copper);
}

/* Item Content Layout */
.item-content {
    max-width: 100%;
}

.content-wrapper {
    line-height: 1.7;
    font-size: 1.1rem;
    color: var(--neutral-dark);
    max-width: 100%;
    overflow-wrap: break-word;
}

.content-wrapper h2,
.content-wrapper h3,
.content-wrapper h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-teal);
    scroll-margin-top: 80px;
}

.content-wrapper h2 {
    font-size: 1.6rem;
    padding-bottom: 0.5rem;
}

.content-wrapper h3 {
    font-size: 1.4rem;
}

.content-wrapper h4 {
    font-size: 1.2rem;
}

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

.item-content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.item-content {
    max-width: 100%;
}

/* Tags */
.item-tags {
    margin: 2.5rem 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--neutral-medium);
}

.item-tags h3 {
    margin-bottom: 1rem;
    color: var(--primary-teal);
    font-size: 1.3rem;
}

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

.tag {
    background-color: var(--neutral-medium);
    color: var(--neutral-dark);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.tag:hover {
    background-color: var(--primary-copper);
    color: white;
}


/* Share Section */
.item-share {
    margin: 2.5rem 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--neutral-medium);
}

.item-share h3 {
    margin-bottom: 1rem;
    color: var(--primary-teal);
    font-size: 1.3rem;
}

.share-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.share-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.share-button.facebook {
    background-color: #3b5998;
    color: white;
}

.share-button.twitter {
    background-color: #1da1f2;
    color: white;
}

.share-button.linkedin {
    background-color: #0077b5;
    color: white;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Sidebar */
.item-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.related-items h3 {
    margin-bottom: 1rem;
    color: var(--primary-teal);
    font-size: 1.3rem;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.related-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--neutral-light);
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

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

.related-image {
    flex: 0 0 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
}

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

.related-content {
    flex: 1;
    min-width: 0;
}

.related-content h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--neutral-dark);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.related-content time {
    font-size: 0.8rem;
    color: var(--neutral-dim);
}

/* Responsive Design */
@media (min-width: 992px) {
    .item-content-wrapper {
        grid-template-columns: 250px 1fr 300px;
        gap: 2rem;
    }

    .toc-sidebar-mobile {
        display: none;
    }

    .toc-sidebar-desktop {
        display: block;
    }

    .item-title {
        font-size: 2.5rem;
    }

    .content-wrapper {
        font-size: 1.15rem;
    }

    .gallery-main {
        height: 600px;
    }
}

@media (max-width: 991px) {
    .item-title {
        font-size: 2rem;
    }

    .gallery-main {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .detail-container {
        padding: 1.5rem 1rem;
    }

    .item-title {
        font-size: 1.75rem;
    }

    .item-meta {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .gallery-main {
        height: 350px;
    }

    .gallery-controls {
        padding: 0 0.5rem;
    }

    .gallery-nav {
        width: 40px;
        height: 40px;
    }

    .thumbnail-item {
        width: 60px;
        height: 60px;
    }

    .share-buttons {
        justify-content: center;
    }

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

    .related-image {
        flex: 0 0 100%;
        height: 150px;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 576px) {
    .detail-container {
        padding: 1rem 0.75rem;
    }

    .item-title {
        font-size: 1.5rem;
    }

    .gallery-main {
        height: 300px;
    }

    .content-wrapper {
        font-size: 1rem;
    }

    .content-wrapper h2 {
        font-size: 1.4rem;
    }

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

    .share-buttons {
        flex-direction: column;
        align-items: center;
    }

    .share-button {
        width: 100%;
        justify-content: center;
    }
}

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--primary-copper);
    z-index: 9999;
    transition: width 0.2s ease;
}

/* Copy code button */
.copy-code {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--neutral-medium);
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.copy-code:hover {
    opacity: 1;
}