/* Administration › Gallery — what Gallery.jsx adds on top of the gallery rules in src/index.css
   (grid, items, tools): the select tick and bar, the list view, the full-screen viewer with zoom,
   Create task and Take photo. */

/* ── Select ─────────────────────────────────────────────────────────── */
.gallery-tick {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%; padding: 0;
  border: 2px solid var(--hk-muted); background: rgba(255, 255, 255, .92); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transition: opacity .15s, background .15s, border-color .15s;
}
.gallery-item-img-wrap:hover .gallery-tick, .gallery-tick:focus-visible, .gallery-tick--show { opacity: 1; }
.gallery-tick--on { background: var(--hk-teal); border-color: var(--hk-teal); }
@media (hover: none) { .gallery-tick { opacity: 1; } }
.gallery-grid--selecting .gallery-item-img-wrap { cursor: pointer; }
.gallery-grid--selecting .gallery-item-img-wrap:hover .gallery-item-img { transform: none; }
.gallery-item--sel .gallery-item-img-wrap { border: 2px solid var(--hk-teal); box-shadow: 0 0 0 3px var(--hk-mint); }
.gallery-select-on { background: var(--hk-mint); border-color: var(--hk-teal); color: var(--hk-teal); }

.gallery-selbar {
  position: sticky; top: 72px; z-index: 5;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--hk-line); border-radius: 11px;
  padding: 8px 12px; margin-bottom: 16px; box-shadow: 0 4px 14px rgba(25, 59, 56, .07);
}
.gallery-selbar-count { font-size: 14px; color: var(--hk-ink); }
.gallery-selbar-gap { flex: 1; }
.gallery-selbar .hk-textbtn:disabled { opacity: .4; cursor: not-allowed; }

.gallery-notice { justify-content: space-between; align-items: center; color: var(--hk-teal); background: var(--hk-mint); margin-top: 0; }
.gallery-notice .hk-textbtn { font-size: 16px; }

/* ── List view ──────────────────────────────────────────────────────── */
.gallery-list { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--hk-line); border-radius: 11px; overflow: hidden; }
.gallery-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 46px; border-top: 1px solid var(--hk-line); }
.gallery-row:first-child { border-top: none; }
.gallery-row:hover { background: #fbfcfa; }
.gallery-row--sel { background: var(--hk-mint); }
.gallery-row--sel:hover { background: var(--hk-mint); }
.gallery-row .gallery-tick { top: 50%; left: 12px; margin-top: -12px; opacity: 1; }
.gallery-row-thumb { width: 64px; height: 48px; flex: none; border-radius: 7px; overflow: hidden; background: #eef3ef; border: 1px solid var(--hk-line); cursor: zoom-in; }
.gallery-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gallery-row-text .gallery-item-name { font-size: 13.5px; font-weight: 600; color: var(--hk-ink); }
.gallery-row-tools { display: flex; gap: 6px; flex: none; }
.gallery-row-tools .gallery-item-tool { background: #f0f6f2; color: var(--hk-teal); }
.gallery-row-tools .gallery-item-tool:hover { background: var(--hk-teal); color: #fff; }
.gallery-row-tools .gallery-item-tool--delete:hover { background: #dc2626; }

/* ── Full-screen viewer ─────────────────────────────────────────────── */
.gallery-viewer { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 22, 21, .94); display: flex; flex-direction: column; color: #fff; }
.gallery-viewer-top { display: flex; align-items: center; gap: 6px; padding: 10px 14px; }
.gallery-viewer-title { flex: 1; min-width: 0; }
.gallery-viewer-label { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-viewer-meta { font-size: 12px; color: rgba(255, 255, 255, .65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-viewer-zoom { font-size: 12px; min-width: 42px; text-align: center; color: rgba(255, 255, 255, .75); font-variant-numeric: tabular-nums; }
.gallery-viewer-btn { width: 38px; height: 38px; border-radius: 9px; border: none; background: rgba(255, 255, 255, .08); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.gallery-viewer-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .18); }
.gallery-viewer-btn:disabled { opacity: .35; cursor: default; }

.gallery-viewer-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; user-select: none; cursor: zoom-in; }
.gallery-viewer-stage--zoomed { cursor: grab; }
.gallery-viewer-stage--zoomed:active { cursor: grabbing; }
.gallery-viewer-img { max-width: calc(100% - 32px); max-height: calc(100% - 16px); object-fit: contain; transform-origin: center center; will-change: transform; -webkit-user-drag: none; }
.gallery-viewer-loading { color: rgba(255, 255, 255, .7); font-size: 14px; }
.gallery-viewer-stage .gallery-item-missing { width: 240px; height: 180px; }
.gallery-viewer-nav {
  position: absolute; top: 50%; margin-top: -26px; width: 52px; height: 52px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, .45); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.gallery-viewer-nav:hover { background: var(--hk-teal); }
.gallery-viewer-nav--prev { left: 16px; }
.gallery-viewer-nav--next { right: 16px; }

.gallery-viewer-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px 18px; }
.gallery-viewer-actions .hk-btn--secondary { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .25); }
.gallery-viewer-actions .hk-btn--secondary:hover:not(:disabled) { background: rgba(255, 255, 255, .2); }
.gallery-viewer-actions .gallery-viewer-delete:hover:not(:disabled) { background: #b53c3a; border-color: #b53c3a; }

/* ── Create task / Take photo ───────────────────────────────────────── */
.gallery-modal-backdrop { z-index: 1010; }
.gallery-task { position: relative; max-width: 480px; }
.gallery-task-head { display: flex; gap: 14px; align-items: center; padding-right: 24px; }
.gallery-task-thumb { width: 72px; height: 72px; flex: none; border-radius: 9px; overflow: hidden; background: #eef3ef; border: 1px solid var(--hk-line); }
.gallery-task textarea.form-input { resize: vertical; min-height: 70px; font-family: inherit; }

.gallery-camera { max-width: 640px; }
.gallery-camera-video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--hk-ink); display: block; }
.gallery-camera-wait { display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, .75); font-size: 14px; }

@media (max-width: 600px) {
  .gallery-row { padding-left: 42px; gap: 10px; }
  .gallery-row-thumb { width: 52px; height: 40px; }
  .gallery-viewer-zoom { display: none; }
  .gallery-viewer-nav { width: 42px; height: 42px; margin-top: -21px; }
  .gallery-viewer-nav--prev { left: 8px; }
  .gallery-viewer-nav--next { right: 8px; }
}

/* small icons: no room for three tools beside the tick (Create task stays in the viewer and Select) */
.gallery-grid--small .gallery-item-tool--task { display: none; }

/* task created from a photo: a success toast above everything, the viewer included */
.gallery-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 1100; display: flex; align-items: center; gap: 10px;
                 max-width: min(560px, calc(100vw - 32px)); padding: 12px 14px 12px 16px; border-radius: 12px; background: #125c58; color: #fff;
                 font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(10, 22, 21, .28); animation: gallery-toast-in .2s ease-out; }
.gallery-toast svg { flex: none; }
.gallery-toast button { flex: none; background: none; border: none; color: #fff; opacity: .8; font-size: 18px; line-height: 1; padding: 0 2px; cursor: pointer; }
.gallery-toast button:hover { opacity: 1; }
@keyframes gallery-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Create task, laid out as Share recipe (.rc-share, hk-Recipes.css) */
.rc-share .gallery-task-head { padding-right: 0; margin: -4px 0 14px; gap: 12px; }
.rc-share .gallery-task-thumb { width: 56px; height: 56px; }
.rc-share .gallery-task-head .rc-share-recipe { margin: 0; }
.rc-share textarea.form-input { resize: vertical; min-height: 60px; font-family: inherit; }
