/* Public wiki page (#441) */
.wiki-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.wiki-sidebar {
    position: sticky;
    top: 1rem;
}

.wiki-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 70vh;
    overflow-y: auto;
}

.wiki-list-item {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.4rem;
    text-decoration: none;
    color: inherit;
    border-left: 3px solid transparent;
}

.wiki-list-item:hover {
    background: rgba(127, 127, 127, 0.1);
}

.wiki-list-item.active {
    background: var(--bs-info-bg-subtle);
    border-left-color: var(--bs-info);
}

.wiki-list-item__title {
    display: block;
    font-weight: 600;
}

.wiki-list-item__subtitle {
    display: block;
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #888);
}

.wiki-article .wiki-text {
    line-height: 1.6;
    white-space: normal;
}

.wiki-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.wiki-image {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid rgba(127, 127, 127, 0.2);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.wiki-image:hover {
    transform: scale(1.03);
}

/* Lightbox overlay for wiki images (#441) */
.wiki-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
}

.wiki-image-overlay img {
    max-height: 85vh;
    max-width: 90vw;
    object-fit: contain;
    border-radius: 4px;
}

/* Mobile detail overlay (#441) — on phones the list and the article don't fit
   side by side, so tapping an entry slides its detail in over the list. The
   overlay is desktop-hidden; the media query below switches it on. */
.wiki-detail-overlay {
    display: none;
}

.wiki-detail-overlay__header {
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
    /* The inline content column is redundant on mobile — the overlay owns it. */
    .wiki-content-col {
        display: none;
    }

    .wiki-detail-overlay.open {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1050;
        overflow-y: auto;
        background: var(--bs-body-bg, #fff);
        padding: 1rem 1rem 3rem;
    }
}

/* Admin image upload previews (#441) */
.wiki-image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.wiki-image-preview {
    position: relative;
}

.wiki-image-preview img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 0.4rem;
    border: 1px solid rgba(127, 127, 127, 0.3);
}

.wiki-image-preview .wiki-img-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background: var(--bs-danger);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
}
