/* ==========================================================================
   Vehicle photos: the picker on the Stock form, thumbnails on Stock cards,
   and the gallery on the Dashboard. Builds on style.css and stock.css.
   ========================================================================== */

/* File inputs stay in the page (so phones open the camera or picker when they are clicked) but are not shown */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; pointer-events: none;
}

/* ---------- Live camera dialog ---------- */
.camera-dialog { width: min(560px, calc(100vw - 24px)); }
.camera-frame {
  aspect-ratio: 4 / 3; overflow: hidden; border-radius: 14px; background: #0d1f18;
}
.camera-frame video { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Photo picker (Stock form) ---------- */
.photo-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.photo-bar .btn:disabled { opacity: .5; cursor: not-allowed; }
.photo-count { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); }

.photo-grid {
  display: grid; gap: 10px; margin-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
.photo-grid:empty { display: none; }
.photo-thumb {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 12px; border: 1px solid var(--line); background: var(--mint);
}
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-tag {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px;
  background: rgba(15, 138, 95, .95); color: #fff; font-size: 11px; font-weight: 800;
}
.photo-remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(13, 31, 24, .78); color: #fff; font-size: 16px; line-height: 1;
}
.photo-remove:hover { background: #9f1239; }
.photo-remove:disabled { opacity: .5; cursor: default; }

.photo-msg { min-height: 1.3em; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.photo-msg.error { color: #9f1239; }

/* ---------- Thumbnails on Stock cards ---------- */
.photo-strip {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 0 6px; padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.photo-strip a { flex: 0 0 auto; }
.photo-strip img {
  display: block; width: 120px; height: 90px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); background: var(--mint);
}

/* ---------- Gallery on the Dashboard ---------- */
.photo-gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.photo-gallery a {
  display: block; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: 12px; border: 1px solid var(--line); background: var(--mint);
}
.photo-gallery img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s var(--ease); }
.photo-gallery a:hover img { transform: scale(1.04); }
