/* Photo gallery: the same grid, uploader and viewer for animals, crops, health records, notes and production. */
.agx-gallery { --agx-tile: 160px; }
.agx-gallery[data-size="s"] { --agx-tile: 96px; }
.agx-gallery[data-size="m"] { --agx-tile: 160px; }
.agx-gallery[data-size="l"] { --agx-tile: 300px; }

.agx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.agx-count { color: #6c757d; font-size: .85rem; margin-right: auto; }
.agx-sizes { display: inline-flex; border: 1px solid #dfe4ea; border-radius: 8px; overflow: hidden; }
.agx-sizes button { border: 0; background: #fff; padding: .25rem .6rem; font-size: .8rem; color: #6c757d; line-height: 1.4; }
.agx-sizes button + button { border-left: 1px solid #dfe4ea; }
.agx-sizes button.active { background: #1f6428; color: #fff; }

.agx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--agx-tile), 1fr)); gap: .6rem; }
.agx-tile { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #eef1f4; cursor: zoom-in; border: 2px solid transparent; }
.agx-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agx-tile.is-primary { border-color: #1f6428; }
.agx-badge { position: absolute; left: 6px; top: 6px; background: #1f6428; color: #fff; font-size: .7rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .2rem; }
.agx-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: .9rem .5rem .3rem; font-size: .75rem; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agx-actions { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.agx-tile:hover .agx-actions, .agx-tile:focus-within .agx-actions { opacity: 1; }
@media (hover: none) { .agx-actions { opacity: 1; } }
.agx-actions button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: #333; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.agx-actions button:hover { background: #fff; color: #1f6428; }
.agx-actions button.danger:hover { color: #c62828; }
.agx-gallery[data-size="s"] .agx-badge span, .agx-gallery[data-size="s"] .agx-cap { display: none; }
.agx-gallery[data-size="s"] .agx-actions button { width: 22px; height: 22px; font-size: .75rem; }

.agx-tile.is-uploading { cursor: progress; background: #f4f6f8; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #6c757d; font-size: .75rem; gap: .35rem; }
.agx-tile.is-uploading .agx-bar-progress { width: 60%; height: 4px; border-radius: 4px; background: #dfe4ea; overflow: hidden; }
.agx-tile.is-uploading .agx-bar-progress i { display: block; height: 100%; width: 40%; background: #1f6428; animation: agx-slide 1s infinite ease-in-out; }
@keyframes agx-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.agx-tile.is-failed { cursor: default; color: #c62828; background: #fdecea; display: flex; align-items: center; justify-content: center; text-align: center; font-size: .75rem; padding: .5rem; }

.agx-empty { border: 2px dashed #cfd6dd; border-radius: 12px; padding: 1.6rem 1rem; text-align: center; color: #6c757d; }
.agx-empty i { font-size: 2rem; color: #1f6428; display: block; }
.agx-gallery.is-dragover .agx-grid, .agx-gallery.is-dragover .agx-empty { outline: 2px dashed #1f6428; outline-offset: 4px; }

/* Viewer */
.agx-viewer { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 14, 12, .94); display: flex; flex-direction: column; color: #fff; }
.agx-viewer-top { display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; }
.agx-viewer-top .agx-pos { margin-right: auto; font-size: .9rem; opacity: .8; }
.agx-viewer button, .agx-viewer a.agx-btn { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 8px; padding: .4rem .7rem; font-size: .85rem; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.agx-viewer button:hover, .agx-viewer a.agx-btn:hover { background: rgba(255, 255, 255, .25); }
.agx-viewer button.danger:hover { background: #c62828; }
.agx-viewer-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 3.2rem; }
.agx-viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.agx-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; padding: 0 !important; justify-content: center; font-size: 1.5rem !important; }
.agx-nav.prev { left: .5rem; } .agx-nav.next { right: .5rem; }
.agx-viewer-foot { padding: .6rem .9rem 1rem; display: flex; gap: .5rem; align-items: center; }
.agx-viewer-foot input { flex: 1; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); color: #fff; border-radius: 8px; padding: .4rem .7rem; font-size: .9rem; }
.agx-viewer-foot input::placeholder { color: rgba(255, 255, 255, .5); }

/* Profile photo card (Overview) */
.agx-profile { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #eef1f4 center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: #6c757d; }
.agx-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-top: .5rem; }
.agx-strip div { aspect-ratio: 4 / 3; border-radius: 6px; background: #eef1f4 center / cover no-repeat; cursor: pointer; }
.agx-strip div.more { display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; color: #1f6428; }

/* Little camera button + count on table rows */
.agx-cam { border: 1px solid #dfe4ea; background: #fff; color: #495057; border-radius: 8px; padding: .15rem .5rem; font-size: .8rem; line-height: 1.4; white-space: nowrap; }
.agx-cam:hover { border-color: #1f6428; color: #1f6428; }
.agx-cam b { font-weight: 600; margin-left: .2rem; }
@media (max-width: 575px) {
  .agx-bar .btn { flex: 1 1 40%; order: -1; justify-content: center; }
  .agx-count { margin-right: auto; }
}
/* A species sample picture (no photo of this animal yet) */
.detail-sample-badge { position: absolute; left: .6rem; bottom: .6rem; display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .65rem; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff; font-size: .78rem; font-weight: 600; }
