/*
 * EXIF Viewer (inc/exif-tool.inc.php). The shared layout is pt-ui.css; this
 * is the photo list, the two Save choices, and what the photo carries: the
 * summary (#exif-summary) and the full table (#exif-all), which are also
 * the phone editor's two panels (pt-app.css gives those a dark surface, so
 * colours here are currentColor and translucent).
 */
.exif-editor [hidden] { display: none !important; }

/* ── The photo ──────────────────────────────────────────────────────────── */
/* The summary under the photo is what people came for, so the photo box is
   shorter than the shared workspace and the column does not stick. */
@media (min-width: 768px) {
  .exif-editor .pt-tool-viewport { height: clamp(260px, 44vh, 440px) !important; min-height: 260px !important; }
  .exif-editor .pt-tool-stage { position: static; }
}
#exif-viewport { display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
.exif-img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.exif-where {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #d9480f;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.exif-where svg { width: 20px; height: 20px; }
#pt-app .exif-viewport { height: 100% !important; min-height: 0 !important; }

/* ── The photo list ─────────────────────────────────────────────────────── */
.exif-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.exif-file {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  outline: none;
}
.exif-thumb {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #eef1f5;
  cursor: pointer;
  border: 2px solid transparent;
}
.exif-thumb canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.exif-file.is-selected .exif-thumb { border-color: var(--bs-primary, var(--pt-accent, #0f70e6)); }
.exif-file:focus-visible .exif-thumb { box-shadow: 0 0 0 3px rgba(15, 112, 230, 0.45); }
.exif-file-pin {
  position: absolute;
  inset-block-end: 4px;
  inset-inline-start: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d9480f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.exif-file-pin svg { width: 12px; height: 12px; }
.exif-del {
  position: absolute;
  inset-block-start: 3px;
  inset-inline-end: 3px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(30, 34, 40, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.exif-del svg { width: 12px; height: 12px; }
/* A finger-sized target around the small x, grown outwards only: towards the
   middle it would catch taps meant for the photo (touch adjustment). */
.exif-del::before { content: ""; position: absolute; inset-block: -8px 0; inset-inline: 0 -8px; }
.exif-addbtn {
  border: 2px dashed #b8c2d1;
  background: transparent;
  color: #5a6475;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.exif-addbtn svg { width: 24px; height: 24px; }
.exif-addbtn:hover { border-color: var(--bs-primary, var(--pt-accent, #0f70e6)); color: var(--bs-primary, var(--pt-accent, #0f70e6)); }

/* ── What Save removes ──────────────────────────────────────────────────── */
.exif-modes { display: grid; gap: 8px; }
.exif-mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d5dbe5;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-align: start;
  min-height: 48px;
}
.exif-mode-name { font-weight: 600; font-size: 0.95rem; }
.exif-mode-note { font-size: 0.8rem; opacity: 0.75; }
/* Desktop: px, as the theme's (0.95rem was 19px on this site's 20px root). */
@media (min-width: 768px) {
  .exif-mode { padding: 8px 12px; }
  .exif-mode-name { font-size: 14px; }
  .exif-mode-note { font-size: 12.5px; line-height: 1.4; }
}
.exif-mode[aria-checked="true"] { border-color: var(--bs-primary, var(--pt-accent, #0f70e6)); background: rgba(15, 112, 230, 0.08); box-shadow: inset 0 0 0 1px var(--bs-primary, var(--pt-accent, #0f70e6)); }
.exif-mode:focus-visible { outline: 3px solid rgba(15, 112, 230, 0.45); outline-offset: 2px; }
.exif-hint { font-size: 0.8rem; color: #6c757d; }

/* ── The summary ────────────────────────────────────────────────────────── */
.exif-details { margin-top: 14px; }
.exif-alert {
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
}
.exif-alert.is-warn { background: rgba(217, 72, 15, 0.12); color: #b23c0c; }
.exif-alert.is-ok { background: rgba(43, 138, 62, 0.12); color: #237032; }
.exif-alert.is-info { background: rgba(15, 112, 230, 0.1); color: #2c5bb4; }
.exif-facts { margin: 0; }
.exif-fact {
  display: grid;
  grid-template-columns: minmax(7.5rem, 30%) minmax(0, 1fr);
  gap: 4px 14px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}
.exif-fact:last-child { border-bottom: 0; }
.exif-fact dt { display: flex; align-items: flex-start; gap: 8px; font-weight: 600; font-size: 0.9rem; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.exif-ic { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; opacity: 0.7; }
.exif-ic svg { width: 18px; height: 18px; display: block; }
.exif-fact dd { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; font-size: 0.9rem; }
.exif-val, .exif-sub, .exif-text { overflow-wrap: anywhere; max-width: 100%; }
.exif-sub { font-size: 0.82rem; opacity: 0.75; }
.exif-fact[data-k="location"]:not(.is-none) .exif-val { font-weight: 600; color: #b23c0c; }
.exif-fact.is-none dd .exif-val { opacity: 0.6; }
.exif-fact.is-none .exif-ic { opacity: 0.4; }
.exif-texts { display: flex; flex-direction: column; gap: 3px; }
.exif-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.exif-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.exif-acts .btn { min-height: 34px; display: inline-flex; align-items: center; }
.exif-preview { max-width: 160px; max-height: 120px; border-radius: 4px; border: 1px solid rgba(127, 127, 127, 0.3); }
.exif-chip {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(127, 127, 127, 0.14);
  opacity: 0.85;
}
.exif-chip.is-removed { background: rgba(217, 72, 15, 0.12); color: #b23c0c; opacity: 1; }

/* ── All metadata ───────────────────────────────────────────────────────── */
.exif-all { margin-top: 18px; }
.exif-all-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.exif-all-title { font-size: 1rem; font-weight: 700; margin: 0; }
.exif-group { border: 1px solid rgba(127, 127, 127, 0.22); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.exif-group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(127, 127, 127, 0.07);
}
.exif-group-n { font-weight: 400; opacity: 0.7; font-size: 0.82rem; }
.exif-group-head .exif-chip { margin: 0; }
.exif-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; table-layout: fixed; }
.exif-table th, .exif-table td { padding: 5px 12px; vertical-align: top; border-top: 1px solid rgba(127, 127, 127, 0.14); overflow-wrap: anywhere; }
.exif-table th { width: 42%; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; text-align: start; }
.exif-table td { white-space: pre-wrap; }

/* ── Phone editor panels ────────────────────────────────────────────────── */
.pt-app-panels #exif-summary,
.pt-app-panels #exif-all { max-height: 42vh; overflow-y: auto; overscroll-behavior: contain; padding: 2px 10px 8px; }
.pt-app-panels #exif-all { margin-top: 0; }
.pt-app-panels .exif-alert.is-warn { color: #b54708; background: rgba(255, 120, 60, 0.12); }
.pt-app-panels .exif-alert.is-ok { color: #157a3c; background: rgba(80, 200, 110, 0.12); }
.pt-app-panels .exif-alert.is-info { color: #1d4ed8; background: rgba(100, 150, 255, 0.12); }
.pt-app-panels .exif-fact[data-k="location"]:not(.is-none) .exif-val { color: #b54708; }
.pt-app-panels .exif-chip.is-removed { color: #b54708; background: rgba(255, 120, 60, 0.12); }
.pt-app-panels .exif-group-head { background: var(--pt-app-fill); }
.pt-app-panels .exif-hint { color: inherit; opacity: 0.7; }
/* The photos as a strip in the bottom bar. */
.pt-app-panels #exif-files { display: flex; gap: 8px; overflow-x: auto; padding: 2px 8px 4px; }
.pt-app-panels #exif-files .exif-file { flex: 0 0 64px; width: 64px; height: 64px; }
.pt-app-panels .exif-addbtn { border-color: var(--pt-app-line-strong); color: inherit; }

@media (max-width: 767px) {
  .exif-fact { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .exif-table th { width: 46%; }
}
