/* Shared multi-photo/video gallery for educator and parent chats. */
.medsi-gallery-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;width:min(280px,100%);max-width:100%;margin:4px 0 7px}
.medsi-gallery-grid .medsi-gallery-tile{position:relative;aspect-ratio:1.12/1;padding:0;border:0;border-radius:9px;background:#e9f5f6;overflow:hidden;min-width:0;cursor:pointer}
.medsi-gallery-tile img,.medsi-gallery-tile video{display:block;width:100%;height:100%;object-fit:cover}
.medsi-gallery-play{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:grid;place-items:center;width:35px;height:35px;border-radius:50%;background:rgba(9,82,91,.72);color:white;font-size:15px;padding-left:2px}
.medsi-gallery-lightbox{position:fixed;inset:0;z-index:22000;background:rgba(2,21,27,.93);display:grid;place-items:center;padding:12px}
.medsi-gallery-lightbox-panel{position:relative;display:grid;grid-template-columns:42px minmax(0,1fr) 42px;align-items:center;width:min(100%,940px);height:min(86dvh,790px);gap:4px}
.medsi-gallery-lightbox-media{display:grid;place-items:center;min-width:0;min-height:0;height:100%}
.medsi-gallery-lightbox-media img,.medsi-gallery-lightbox-media video{display:block;max-width:100%;max-height:100%;object-fit:contain;border-radius:5px}
.medsi-gallery-lightbox-close{position:absolute;right:4px;top:0;width:38px;height:38px;border:0;border-radius:50%;background:rgba(255,255,255,.16);color:#fff;font-size:29px;z-index:2;cursor:pointer}
.medsi-gallery-arrow{min-height:48px;min-width:38px;border:0;border-radius:14px;background:rgba(255,255,255,.13);color:#fff;font-size:38px;line-height:1;cursor:pointer}
.medsi-gallery-arrow:disabled{opacity:.22;cursor:default}
.medsi-gallery-counter{position:absolute;bottom:0;left:50%;transform:translateX(-50%);border-radius:999px;background:rgba(255,255,255,.13);color:#fff;padding:5px 13px;font-size:13px;font-weight:700}
.medsi-gallery-lightbox button:focus-visible,.medsi-gallery-tile:focus-visible{outline:3px solid #17c2ca;outline-offset:2px}
@media(max-width:560px){.medsi-gallery-lightbox{padding:5px}.medsi-gallery-lightbox-panel{grid-template-columns:33px minmax(0,1fr) 33px;height:90dvh;gap:2px}.medsi-gallery-arrow{min-width:30px;font-size:30px}.medsi-gallery-lightbox-media img,.medsi-gallery-lightbox-media video{max-height:80dvh}}

/* Keep the five selected thumbnails inside the mobile composer width. */
.educator-exact-clone #chatImagePreview.chat-image-preview{box-sizing:border-box;display:flex;flex-wrap:wrap;gap:6px;max-width:100%;padding:4px 0;margin:0}
.educator-exact-clone #chatImagePreview .preview-item{flex:none;width:62px;height:62px}
.educator-exact-clone #chatImagePreview .preview-item img,
.educator-exact-clone #chatImagePreview .preview-item video{width:100%;height:100%;object-fit:cover}
.educator-exact-clone #chatImagePreview .preview-remove-btn{width:23px;height:23px;min-height:23px;font-size:16px}

.medsi-gallery-tile-status{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:rgba(233,245,246,.5);color:#31636a;font:13px system-ui}
.medsi-gallery-tile-status.is-error{background:rgba(233,245,246,.9);padding:10px;font-weight:600}
.medsi-gallery-tile-status.is-video{inset:auto 8px 8px auto;display:block;padding:4px 8px;border-radius:999px;background:rgba(9,82,91,.72);color:#fff;font-weight:600}
.medsi-gallery-spinner{display:block;width:25px;height:25px;box-sizing:border-box;border:3px solid rgba(15,199,206,.2);border-top-color:#0fc7ce;border-radius:50%;animation:medsiGallerySpin .72s linear infinite}
@keyframes medsiGallerySpin{to{transform:rotate(360deg)}}
.medsi-gallery-lightbox-media{position:relative}
.medsi-gallery-load-status{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:grid;place-items:center;width:52px;height:52px;padding:0;border:0;border-radius:50%;background:rgba(255,255,255,.92);color:#174a52;max-width:90%;cursor:wait}
.medsi-gallery-load-status .medsi-gallery-spinner{width:27px;height:27px}
.medsi-gallery-load-status.is-error{width:auto;height:auto;min-height:44px;padding:10px 14px;border-radius:12px;background:#fff;color:#174a52;font-size:13px;font-weight:600;cursor:pointer}
.medsi-gallery-load-status:disabled{opacity:.96}
@media(prefers-reduced-motion:reduce){.medsi-gallery-spinner{animation:none;border-top-color:#0fc7ce}}

/* Stable X position on iOS: two centered strokes, independent of font glyph baseline. */
.medsi-gallery-lightbox-close{appearance:none;box-sizing:border-box;padding:0!important;font-size:0!important;line-height:0!important}
.medsi-gallery-lightbox-close::before,.medsi-gallery-lightbox-close::after{content:'';position:absolute;left:50%;top:50%;width:18px;height:2.5px;border-radius:2px;background:currentColor;pointer-events:none}
.medsi-gallery-lightbox-close::before{transform:translate(-50%,-50%) rotate(45deg)}
.medsi-gallery-lightbox-close::after{transform:translate(-50%,-50%) rotate(-45deg)}
