/* Attachment lightbox -- shared by the staff panel and the client portal.
   See js/lightbox.js. */

/* Fixed-size thumbnail for images embedded inline in a thread post's body
   (rewritten from cid: references -- see Format::viewableImages()). Each
   <img data-cid> gets wrapped at runtime (js/lightbox.js) in a
   .thread-image-wrap so a download badge can be positioned over it. */
.thread-image-wrap {
    position: relative;
    display: inline-block;
    margin: 4px 6px 4px 0;
    vertical-align: top;
    line-height: 0;
}
.thread-image-wrap img[data-cid] {
    display: block;
    max-width: 606px;
    max-height: 400px;
    width: auto;
    height: auto;
    margin: 0;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: zoom-in;
}

a[data-mime] {
    cursor: pointer;
}

/* Explicit, always-visible download affordance -- deliberately not a
   hover-only reveal, so it reads as an obvious download control rather
   than relying on (inconsistent, browser-specific) native image hover
   overlays. Shared look; positioning differs by context below. */
.lightbox-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    text-decoration: none;
    line-height: 1;
}
.lightbox-download-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
}

/* Corner badge over an inline thumbnail image */
.lightbox-download-btn.overlay {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 24px;
    height: 24px;
    font-size: 13px;
}

/* Small icon next to an attachment's filename link */
.lightbox-download-btn.inline {
    width: 20px;
    height: 20px;
    font-size: 11px;
    margin-left: 4px;
    vertical-align: middle;
}

.attachment-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.attachment-lightbox.open {
    display: flex;
}
.attachment-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
}
.attachment-lightbox-dialog {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
}
.attachment-lightbox-close,
.attachment-lightbox-download {
    position: absolute;
    color: #fff;
    text-decoration: none;
    opacity: 0.8;
}
.attachment-lightbox-close:hover,
.attachment-lightbox-download:hover {
    opacity: 1;
    color: #fff;
}
.attachment-lightbox-close {
    top: -36px;
    right: 0;
    font-size: 28px;
    line-height: 1;
}
.attachment-lightbox-download {
    /* Bottom, not top -- a top offset can land underneath the app's own
       fixed header bar and become unclickable/invisible. */
    bottom: -36px;
    right: 0;
    font-size: 20px;
    line-height: 1.4;
}
.attachment-lightbox-stage img,
.attachment-lightbox-stage video {
    display: block;
    max-width: 92vw;
    max-height: 88vh;
}
.attachment-lightbox-stage embed.attachment-lightbox-pdf {
    width: 85vw;
    height: 88vh;
}
.attachment-lightbox-loading,
.attachment-lightbox-error {
    color: #fff;
    padding: 40px;
    text-align: center;
}
