/* Styles for every client's admin.html.
   Layered on top of site.css, so the tokens (--bg, --text, --accent …) all
   come from there and the admin inherits the light/dark toggle for free.

   Design brief: this has to feel simpler than a generic dashboard. That
   means big hit areas, one column, labels in plain words, and no chrome that
   doesn't do anything. */

/* The [hidden] attribute hides things via the UA stylesheet's
   `[hidden] { display: none }`, which is the weakest possible declaration —
   ANY class-level display rule beats it. `.signin-wrap` below sets
   display:flex, so `element.hidden = true` on those panes silently did
   nothing and the sign-in form stayed on screen underneath the admin.
   This guard has to come first and has to be !important. */
[hidden] { display: none !important; }

/* ── sign in ── */
.signin-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.25rem 6rem;
}

.signin {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.signin h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 400;
}

.signin p.hint { font-size: 14px; color: var(--text-mid); }

/* ── page header ──
   core/site.css's .page-header is sized for a marketing page's hero — on a
   utility screen like this one it reads as oversized. Scoped to #admin-view
   only, so book.html and the public pages (which don't use #admin-view)
   keep the bigger display type where it actually fits. */
#admin-view .page-header {
  margin-bottom: 2rem;
}
#admin-view .page-header h1 {
  font-size: 1.6rem;
  animation: none;
}
#admin-view .page-header .page-sub {
  font-size: 14px;
  animation: none;
}

/* ── tabs ── */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  overflow-x: auto;
}

.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.85rem 0.25rem;
  margin-right: 1.5rem;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel[hidden] { display: none; }

/* ── forms ──
   The "add new" form sits below the existing-items list in every panel
   (see admin.html — reordered so you see what's already there before
   making more of it), so the breathing room it used to add below itself
   now needs to come from above instead. */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.5rem;
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  background: var(--bg2);
  margin-top: 2.5rem;
}

.form-title {
  font-family: var(--serif);
  font-size: 1.15rem;
}

.field { display: flex; flex-direction: column; gap: 0.4rem; }

.field label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-mid);
}

.field .help {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea,
select {
  font-family: inherit;
  /* 16px minimum: iOS Safari zooms the whole page on focus below this, and
     smaller than this is hard going for the audience anyway. */
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  padding: 0.75rem 0.85rem;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--tag-bg);
}

textarea { resize: vertical; min-height: 6rem; line-height: 1.6; }

/* Native pickers render dark-on-dark in some browsers without this. */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"] { color-scheme: dark; }

/* The native up/down spinner reads as an odd outlier next to every other
   field — typing a number, or using the keyboard's up/down arrows, still
   works without it. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 9rem; }

/* Checkbox sits inline with its label, so it opts out of .field's column. */
.check {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.check label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--text);
  font-weight: 400;
}

/* ── buttons ── */
.btn {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.85rem 1.5rem;
  border-radius: 2px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--bg);
  transition: background 0.2s, opacity 0.2s;
}
.btn:hover { background: var(--accent2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; background: var(--accent); }

.btn-ghost {
  background: none;
  border-color: var(--border-mid);
  color: var(--text-mid);
}
.btn-ghost:hover { background: none; border-color: var(--accent); color: var(--accent); }

.btn-danger { background: none; border-color: transparent; color: var(--accent2); padding: 0.4rem 0; }
.btn-danger:hover { background: none; text-decoration: underline; }

.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ── inline status ── */
.status { font-size: 13px; color: var(--text-dim); }
.status.ok    { color: var(--accent); }
.status.error { color: var(--accent2); }

/* ── image picker ── */
.image-picker { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.image-preview {
  width: 84px;
  height: 84px;
  border-radius: 3px;
  border: 1px dashed var(--border-mid);
  background: var(--bg3);
  object-fit: cover;
  flex-shrink: 0;
}
.image-preview[data-empty="true"] { object-fit: contain; padding: 1.5rem; opacity: 0.3; }

/* The real file input is visually hidden but still focusable via its label. */
.file-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.file-input:focus-visible + .file-label { border-color: var(--accent); color: var(--accent); }

.file-label {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  color: var(--text-mid);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.file-label:hover { border-color: var(--accent); color: var(--accent); }

/* ── existing-items list ── */
.admin-list { border-top: 1px solid var(--border); }

.admin-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
}

.admin-row-main { display: flex; gap: 1rem; align-items: flex-start; min-width: 0; }

.admin-thumb {
  width: 52px; height: 52px;
  border-radius: 3px;
  object-fit: cover;
  background: var(--bg3);
  flex-shrink: 0;
}

.admin-row-text { min-width: 0; }
.admin-row-title { font-family: var(--serif); font-size: 1.02rem; }
.admin-row-when {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.admin-row-note {
  font-size: 14px;
  color: var(--text-mid);
  margin-top: 0.3rem;
  overflow-wrap: anywhere;
  max-width: 52ch;
  /* Same as the public page: show the line breaks that were typed, so this
     list reads back exactly what will appear on the site. */
  white-space: pre-wrap;
}

/* Supporting detail — the address, the member-since/website line. Steps back
   so the blurb above it reads as the content. */
.admin-row-meta {
  font-size: 13px;
  color: var(--text-dim);
}

.admin-row-meta a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.admin-row-actions { display: flex; gap: 1rem; flex-shrink: 0; align-items: center; }

/* Used for Edit/Delete in list rows and the forgot-password link. Padded to a
   ~44px hit area: with no padding these render 16px tall, which is under even
   the 24px WCAG minimum, let alone comfortable. */
.link-btn {
  background: none;
  border: none;
  padding: 0.85rem 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-mid);
  transition: color 0.2s;
}
.link-btn:hover { color: var(--accent); }
.link-btn.danger:hover { color: var(--accent2); }

/* ── photo grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
}

.photo-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg3);
  border: 1px solid var(--border);
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
/* The thumbnail button fills the square so the whole tile is the hit area. */
.photo-cell .thumb-btn { display: block; width: 100%; height: 100%; }

.photo-caption {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.5rem 0.6rem;
  width: 100%;
  transition: border-color 0.2s;
}
.photo-caption::placeholder { color: var(--text-dim); }
.photo-caption:hover { border-color: var(--border-mid); }
.photo-caption:disabled { opacity: 0.5; }

.photo-album {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-mid);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.45rem 0.5rem;
  width: 100%;
}
.photo-album:hover { border-color: var(--border-mid); }
.photo-album:disabled { opacity: 0.5; }

.photo-meta {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
  /* Long editor emails would otherwise widen the grid column. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.62);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}
.photo-cell:hover .photo-remove,
.photo-remove:focus-visible { opacity: 1; }
.photo-remove:hover { background: var(--terra); }

/* Touch devices have no hover, so the control has to be permanently visible. */
@media (hover: none) {
  .photo-remove { opacity: 1; }
}

/* ── upload progress ── */
.progress {
  height: 3px;
  background: var(--bg3);
  border-radius: 999px;
  overflow: hidden;
}
.progress[hidden] { display: none; }
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s linear;
}

@media (max-width: 680px) {
  .form { padding: 1.15rem; }
  .admin-row { flex-direction: column; gap: 0.75rem; }
  .admin-row-actions { padding-left: 68px; }
}
