/* Media gallery, uploader, lightbox and tag review. Plain CSS: the panel's Tailwind build only has Filament's own classes. */
[x-cloak] { display: none !important; }
.am-gallery { display: flex; flex-direction: column; gap: 12px; }
.am-muted { color: #6b7280; font-size: 0.875rem; }
.am-error { color: #b91c1c; font-size: 0.875rem; }
.am-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; font-size: 0.875rem; cursor: pointer; }
.am-btn:hover { background: #f9fafb; }
.am-btn--danger { color: #b91c1c; border-color: #fecaca; }
.am-link { background: none; border: 0; color: #b45309; text-decoration: underline; cursor: pointer; font-size: 0.875rem; }
.am-upload { border: 2px dashed #d1d5db; border-radius: 10px; padding: 14px; }
.am-upload--over { border-color: #f59e0b; background: #fffbeb; }
.am-upload__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.am-batch, .am-edit { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: flex-end; }
.am-batch label, .am-edit label { display: flex; flex-direction: column; font-size: 0.8rem; color: #374151; }
.am-batch input, .am-edit input { border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 8px; min-width: 160px; }
.am-batch__wide input { min-width: 320px; }
.am-files { list-style: none; margin: 10px 0 0; padding: 0; max-height: 220px; overflow: auto; font-size: 0.85rem; }
.am-files li { display: grid; grid-template-columns: minmax(0, 1fr) 160px 140px; gap: 8px; align-items: center; padding: 2px 0; }
.am-files li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-toolbar { position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; }
.am-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.am-tile { position: relative; margin: 0; border-radius: 8px; overflow: hidden; background: #f3f4f6; border: 2px solid transparent; }
.am-tile--selected { border-color: #f59e0b; }
.am-tile__img { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: #e5e7eb; cursor: zoom-in; position: relative; }
.am-tile__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.am-tile__check { position: absolute; top: 6px; left: 6px; z-index: 2; width: 18px; height: 18px; }
.am-tile figcaption { font-size: 0.75rem; padding: 4px 6px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-badge { position: absolute; bottom: 6px; left: 6px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; }
.am-badge--error { background: #b91c1c; }
.am-type { position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; }
.am-more { align-self: center; }
.am-lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .9); display: flex; align-items: center; justify-content: center; }
.am-lightbox__body { position: relative; max-width: 96vw; max-height: 96vh; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.am-lightbox__body img, .am-lightbox__body video { max-width: 92vw; max-height: 84vh; object-fit: contain; }
.am-lightbox__meta { color: #e5e7eb; font-size: 0.875rem; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.am-lightbox__meta .am-link { color: #fcd34d; }
.am-lightbox__nav, .am-lightbox__close { position: fixed; background: rgba(255, 255, 255, .15); color: #fff; border: 0; font-size: 2rem; width: 48px; height: 48px; border-radius: 24px; cursor: pointer; }
.am-lightbox__prev { left: 16px; top: 50%; }
.am-lightbox__next { right: 16px; top: 50%; }
.am-lightbox__close { right: 16px; top: 16px; }
/* Tag review */
.am-review { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.am-review__img { background: #111827; border-radius: 8px; display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.am-review__img img { max-width: 100%; max-height: 75vh; object-fit: contain; }
.am-review__side { display: flex; flex-direction: column; gap: 8px; }
.am-review__side input { border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 8px; }
.am-sugg { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 4px 6px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; cursor: pointer; }
.am-sugg kbd { background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 4px; padding: 0 5px; font-size: 0.75rem; }
.am-chip { display: inline-flex; gap: 4px; align-items: center; background: #fef3c7; border-radius: 12px; padding: 2px 8px; font-size: 0.8rem; margin: 2px; }
.am-notice { margin-bottom: 12px; padding: 8px 12px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: 0.875rem; }
/* Readable in Filament's dark mode too: light controls always carry dark text; labels follow the page text. */
.am-btn, .am-sugg, .am-batch input, .am-edit input, .am-review__side input { color: #111827; }
.am-chip { color: #78350f; }
.am-batch label, .am-edit label { color: inherit; }
.am-toolbar { color: #111827; }
.dark .am-muted { color: #9ca3af; }
.dark .am-upload--over { background: #451a03; }
.am-batch input, .am-edit input, .am-review__side input { background: #fff; }
/* Search (plan 3) */
.am-topsearch { flex: 1; max-width: 420px; margin: 0 12px; }
.am-topsearch input { width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 10px; background: #fff; color: #111827; }
.am-search { display: flex; flex-direction: column; gap: 14px; }
.am-search__bar { display: flex; gap: 8px; }
.am-search__bar input { flex: 1; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 12px; background: #fff; color: #111827; font-size: 1rem; }
.am-search__filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.am-search__filters label { display: flex; flex-direction: column; font-size: 0.8rem; color: inherit; gap: 2px; }
.am-search__filters select, .am-search__filters input { border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 6px; background: #fff; color: #111827; }
.am-search__filters input[type=number] { width: 80px; }
.am-search__group h3 { font-weight: 600; margin-bottom: 6px; display: flex; gap: 10px; align-items: baseline; }
.am-search__group ul { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 4px; }
.am-search__pager { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.am-search-tile { display: block; text-decoration: none; }
.am-search-tile .am-tile__img { display: block; }
.am-search-cap { display: block; font-size: 0.75rem; padding: 4px 6px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Lightbox "Muuda andmeid" */
.am-lbedit { background: #fff; color: #111827; border-radius: 8px; padding: 10px 12px; width: min(640px, 92vw); }
.am-lbedit__form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.am-lbedit__form label { display: flex; flex-direction: column; font-size: 0.8rem; color: #374151; }
.am-lbedit__form input, .am-lbedit__form textarea { border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 8px; background: #fff; color: #111827; min-width: 180px; }
.am-lbedit__wide { flex-basis: 100%; }
.am-lbedit__wide textarea { width: 100%; }
.am-lbedit__note { margin: 0 0 6px; font-size: 0.9rem; }
.am-lightbox { overflow-y: auto; flex-direction: column; gap: 8px; }
.am-lbtag { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; }
.am-lbtag label { display: flex; flex-direction: column; font-size: 0.8rem; color: #374151; }
.am-lbtag input { border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 8px; background: #fff; color: #111827; }
.am-lbtag__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; max-height: 30vh; overflow-y: auto; }
.am-lightbox__body--editing img, .am-lightbox__body--editing video { max-height: 40vh; }

/* Face recognition (plan 6): boxes on the review picture, similar-faces grid. */
.am-review__frame { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
.am-review__frame img { display: block; }
.am-face { position: absolute; padding: 0; background: transparent; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); cursor: pointer; line-height: 1.2; }
.am-face span { position: absolute; top: 100%; left: -2px; margin-top: 2px; white-space: nowrap; font-size: 0.7rem; padding: 1px 4px; background: rgba(0, 0, 0, .7); color: #fff; }
.am-face--confirmed { border-color: #22c55e; }
.am-face--selected { border-color: var(--vm-red, #dc0200); border-width: 3px; z-index: 2; }
.am-face--selected span { background: var(--vm-red, #dc0200); }
.am-sugg-row { display: flex; gap: 6px; align-items: center; }
.am-sugg-row .am-sugg { flex: 1; }
.am-facegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; }
.am-facecard { display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.am-facecrop { display: block; width: 100%; background-repeat: no-repeat; background-color: #e5e5e5; border-radius: 2px; }
.am-facecard:has(input:checked) .am-facecrop { outline: 3px solid var(--vm-red, #dc0200); outline-offset: 1px; }
.am-facecard__meta { display: flex; gap: 6px; align-items: center; font-size: 0.8rem; }
/* "Kavalehed" tab: file, its public link and "Kopeeri link" on one row. */
.am-playbill { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0; }
.am-playbill input { flex: 1 1 320px; min-width: 0; border: 1px solid #d1d5db; border-radius: 6px; padding: 4px 8px; font-size: 0.8rem; background: #f9fafb; color: #111827; }
.am-lightbox__about { flex-basis: 100%; text-align: center; color: #fcd34d; }
.am-chip { display: inline-flex; align-items: center; gap: 2px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 12px; padding: 0 4px 0 8px; margin: 2px 2px 2px 0; }
.am-chip__x { border: 0; background: none; cursor: pointer; color: #b91c1c; font-size: 1rem; line-height: 1; padding: 0 4px; }
