/* ---------- Upload dialog (issue #168) ----------
   A top-level popup, not a panel embedded in the side menu's settings
   list (Malte: "dass der Hochladen Button dann plötzlich im Seitenmenü
   sitzt ist verwirrend"). Same full-screen-overlay-with-centered-card
   pattern the app already uses for #lightbox-delete-confirm, just scaled
   up for a form instead of a two-button confirm. */

.upload-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.upload-dialog[hidden] {
  display: none;
}

.upload-dialog-card {
  position: relative;
  width: min(400px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--white);
  color: var(--black);
  padding: 28px 24px 24px;
}

.upload-dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--black);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.upload-dialog-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 18px;
}

.upload-file-list {
  margin-bottom: 20px;
}

.upload-file-list:empty {
  display: none;
}

.upload-file-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
  font-family: "Inter", sans-serif;
  font-size: 0.74rem;
}

.upload-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.upload-file-meta {
  flex: 0 0 auto;
  color: var(--grey);
  text-align: right;
}

/* No colored red/green - AI-HANDOFF.md's monochrome rule - a failed row
   reads via text + the same warning glyph upload-status uses, not color. */
.upload-file-row.failed .upload-file-meta {
  color: var(--black);
}

/* Issue #181: the failed-row text now includes the real error (name/
   message) + MIME type, not just a static string - can run well past the
   default flex:0 0 auto nowrap width and overflow the dialog card on a
   phone. Wrap it instead; a failed row is rare enough that reflowing the
   list is fine. */
.upload-file-row.failed .upload-file-meta,
/* Issue #184: same overflow risk as above - a geolocation-fallback error
   appended to an otherwise-successful row (site/js/upload.js). */
.upload-file-row.geo-warned .upload-file-meta {
  flex-basis: 60%;
  white-space: normal;
  word-break: break-word;
  text-align: left;
}

/* Issue #173 - collapsed by default (no [open]): both fields inside are
   fallbacks only, and a fully-exposed date/location pair read as
   mandatory even though most uploads never need them (per-file EXIF wins
   - site/js/upload.js). */
.upload-fallbacks {
  margin-bottom: 12px;
  border-top: 1px solid rgba(17, 17, 17, 0.1);
  padding-top: 12px;
}

.upload-fallbacks-summary {
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
  list-style: none;
  margin-bottom: 4px;
}

.upload-fallbacks-summary::-webkit-details-marker {
  display: none;
}

.upload-fallbacks-summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}

.upload-fallbacks[open] .upload-fallbacks-summary::before {
  transform: rotate(90deg);
}

.upload-fallbacks .filter-group:first-of-type {
  margin-top: 14px;
}

.upload-location-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* The Leaflet map itself is created lazily, only once this panel is first
   un-hidden (site/js/upload.js) - a hidden container has no measurable
   size, which is exactly the failure site/js/map.js's own initMap()
   comment already documents for the main map view. */
.upload-location-map-panel {
  margin-top: 10px;
}

.upload-location-search-results {
  margin-top: 4px;
}

.upload-location-search-results:empty {
  display: none;
}

.upload-location-search-results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: none;
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
  background: transparent;
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  color: var(--black);
  cursor: pointer;
}

.upload-location-map {
  width: 100%;
  height: 200px;
  margin-top: 8px;
  border: 1px solid var(--hairline);
}

.upload-location-map-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.upload-location-picked-label {
  font-family: "Inter", sans-serif;
  font-size: 0.68rem;
  color: var(--grey);
}

.upload-location-picked-label:empty {
  display: none;
}

.upload-status {
  font-family: "Inter", sans-serif;
  font-size: 0.68rem;
  color: var(--grey);
  margin: 8px 0;
  min-height: 1em;
  white-space: pre-line;
}

/* Issue #184: overlays the confirm/cancel buttons (site/js/upload.js's
   confirmBtn handler) when getCurrentPosition() fails with PERMISSION_
   DENIED. Fixed (not absolute) - .upload-dialog-card scrolls
   (max-height + overflow-y:auto, above), so absolute + top:50% would
   resolve against the card's full scrollable height and could land off
   the visible viewport on a phone with several files queued. .upload-dialog
   is already position:fixed; inset:0 (full viewport), so this centers on
   screen regardless of the card's scroll position. */
.upload-geo-confirm {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  width: min(300px, calc(100% - 48px));
  padding: 20px;
  border: 1px solid rgba(17, 17, 17, 0.3);
  border-radius: 6px;
  background: var(--white);
  color: var(--black);
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.upload-geo-confirm[hidden] {
  display: none;
}

.upload-geo-confirm p {
  margin: 0 0 16px;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  line-height: 1.4;
}

.upload-geo-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-geo-confirm-actions button {
  padding: 10px 0;
  border: 1px solid rgba(17, 17, 17, 0.3);
  border-radius: 4px;
  background: transparent;
  color: var(--black);
  font-family: "Inter", sans-serif;
  font-size: 0.76rem;
  cursor: pointer;
}

.upload-geo-confirm-actions .upload-geo-continue {
  background: var(--black);
  color: var(--white);
}
