/* ExaGuards photo gallery (Pages/Devices/Photos/Usr_PhotoGallery.razor): the "Photos" tab of a device / agent and the pictures block of a template / accessory.
   Classes xpg-*. The colours come from the desktop tokens (exa-desktop.css, --inv-*, --accent) with the literal after the comma as the fallback, so it looks right
   inside a desktop window, on its own and inside the dialogs (which live outside the frame). */

.xpg-scope {
    --xpg-text: var(--inv-text, #1A1F2E);
    --xpg-muted: var(--inv-muted, #5A6478);
    --xpg-line: var(--inv-line, #E1E6EF);
    --xpg-soft: var(--inv-soft, #EEF2F8);
    --xpg-card: var(--inv-card, #FFFFFF);
    --xpg-accent: var(--accent, #176916);
    --xpg-accent-soft: var(--accent-soft, rgba(47, 179, 46, .16));
    --xpg-good: var(--inv-good, #136019);
    --xpg-good-soft: var(--inv-good-soft, rgba(47, 179, 46, .16));
    --xpg-warn: var(--inv-warn, #981F19);
    --xpg-warn-soft: var(--inv-warn-soft, rgba(220, 38, 38, .12));
    --xpg-amber: var(--inv-amber, #724A05);
    --xpg-amber-soft: var(--inv-amber-soft, rgba(217, 119, 6, .16));
    font-family: var(--fb, 'Segoe UI Variable Text', 'Segoe UI', Roboto, system-ui, sans-serif);
    color: var(--xpg-text);
    padding: 10px 4px 4px;
}
[data-theme=dark] .xpg-scope {
    --xpg-text: var(--inv-text, #E6EAF2);
    --xpg-muted: var(--inv-muted, #9AA6BC);
    --xpg-line: var(--inv-line, #2D3A52);
    --xpg-soft: var(--inv-soft, #1F2A3C);
    --xpg-card: var(--inv-card, #17202F);
}
.xpg-scope *, .xpg-scope *::before, .xpg-scope *::after { box-sizing: border-box; }
.xpg-scope button { font-family: inherit; }

.xpg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.xpg-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.xpg-title .bi { color: var(--xpg-accent); }
.xpg-count { font-size: 12px; font-weight: 600; background: var(--xpg-soft); color: var(--xpg-muted); border-radius: 999px; padding: 1px 9px; }
.xpg-up { min-width: 260px; max-width: 420px; flex: 1 1 260px; }

.xpg-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--xpg-muted); background: var(--xpg-soft); border-radius: 8px; padding: 7px 11px; margin: 0 0 8px; }
.xpg-note.is-warn { color: var(--xpg-warn); background: var(--xpg-warn-soft); }
.xpg-note.is-good { color: var(--xpg-good); background: var(--xpg-good-soft); }
.xpg-note.is-busy { color: var(--xpg-amber); background: var(--xpg-amber-soft); }
.xpg-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: xpg-turn .8s linear infinite; flex: none; }
@keyframes xpg-turn { to { transform: rotate(360deg); } }

.xpg-empty { text-align: center; color: var(--xpg-muted); padding: 34px 12px; border: 1px dashed var(--xpg-line); border-radius: 12px; font-size: 13px; }
.xpg-empty .bi { display: block; font-size: 42px; opacity: .35; margin-bottom: 6px; }

.xpg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.xpg-tile { position: relative; border: 1px solid var(--xpg-line); border-radius: 12px; background: var(--xpg-card); overflow: hidden; display: flex; flex-direction: column; }
.xpg-tile.is-main { border-color: var(--xpg-accent); box-shadow: 0 0 0 2px var(--xpg-accent-soft); }
.xpg-tile.is-pending { border-style: dashed; }
.xpg-img { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; margin: 0; border: 0; background: var(--xpg-soft); cursor: zoom-in; }
.xpg-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xpg-name { font-size: 11.5px; color: var(--xpg-muted); padding: 5px 8px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.xpg-badge { position: absolute; top: 6px; left: 6px; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 999px; background: var(--xpg-accent); color: #fff; display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xpg-badge.is-wait { top: auto; bottom: 30px; background: var(--xpg-amber); }

.xpg-acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 5px; opacity: 0; transition: opacity .12s; }
.xpg-tile:hover .xpg-acts, .xpg-tile:focus-within .xpg-acts { opacity: 1; }
@media (hover: none) { .xpg-acts { opacity: 1; } }
.xpg-btn { width: 28px; height: 28px; border-radius: 8px; border: 0; background: rgba(20, 28, 44, .72); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; padding: 0; }
.xpg-btn:hover { background: var(--xpg-accent); }
.xpg-btn.is-danger:hover { background: var(--xpg-warn); }

.xpg-ask { position: absolute; inset: 0; background: rgba(20, 28, 44, .88); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 13px; text-align: center; padding: 8px; }
.xpg-ask-btns { display: flex; gap: 8px; }
.xpg-yes, .xpg-no { border: 0; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.xpg-yes { background: var(--xpg-warn); color: #fff; }
.xpg-no { background: rgba(255, 255, 255, .18); color: #fff; }

.xpg-foot { margin-top: 10px; font-size: 12px; color: var(--xpg-muted); }

/* the full-size view */
.xpg-lb { position: fixed; inset: 0; z-index: 100000; background: rgba(8, 12, 20, .86); display: flex; align-items: center; justify-content: center; padding: 48px 64px; cursor: zoom-out; }
.xpg-lb img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; cursor: default; background: #fff; }
.xpg-lb-x, .xpg-lb-nav { position: absolute; border: 0; border-radius: 50%; width: 42px; height: 42px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.xpg-lb-x:hover, .xpg-lb-nav:hover { background: rgba(255, 255, 255, .3); }
.xpg-lb-x { top: 14px; right: 14px; }
.xpg-lb-nav { top: 50%; margin-top: -21px; }
.xpg-lb-nav.is-prev { left: 12px; }
.xpg-lb-nav.is-next { right: 12px; }
.xpg-lb-cap { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); cursor: default; }

@media (max-width: 600px) {
    .xpg-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
    .xpg-lb { padding: 56px 8px; }
}
