/* ternYpe admin panel — layout on top of the public site's css/style.css */
body.admin { background: #f2f1ec; overflow-x: hidden; } /* belt-and-braces: never let any long label cause the whole page to scroll sideways */

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr); /* minmax(0,…) — without it a flex/grid track won't shrink below its content's natural width, which is exactly what let long labels push the page wider than the screen */
  min-height: 100vh;
  max-width: 100%;
}

.admin-sidebar {
  background: #14213a;
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.admin-sidebar h2 { color: #fff; font-size: 1.1rem; }
.admin-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #cfd6e4;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.3;
}
.admin-nav-btn:hover, .admin-nav-btn.active { background: rgba(255,255,255,.1); color: #fff; }

.admin-main { padding: 32px; min-width: 0; max-width: 100%; overflow-x: hidden; }
.admin-topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.admin-topbar > div:first-child { min-width: 0; flex: 1 1 280px; } /* lets the title wrap/shrink instead of forcing the topbar wider than the screen */
#editor-title { overflow-wrap: break-word; word-break: break-word; }

.admin-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.admin-row > span:first-child { min-width: 0; overflow-wrap: break-word; flex: 1 1 200px; }
.admin-row button { margin-left: 8px; }

#entry-form-wrap {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px;
  margin-top: 20px;
  max-width: 640px;
}
#entry-form-wrap label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
#entry-form-wrap input, #entry-form-wrap textarea, #entry-form-wrap select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
}

/* Drag-and-drop image field — used for every photo/logo/cover-image field
   instead of a plain URL textbox (see admin/js/crud.js fieldInputHtml). */
.image-field { margin-top: 6px; }
.image-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  background: #fafaf7;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.image-dropzone:hover, .image-dropzone:focus-visible { border-color: var(--color-primary); background: var(--color-primary-tint); }
.image-dropzone.drag-over { border-color: var(--color-accent); background: var(--color-accent-tint); }
.image-dropzone .image-preview { max-width: 140px; max-height: 140px; border-radius: 10px; object-fit: cover; box-shadow: var(--shadow-sm); }
.image-dropzone-hint { margin: 0; font-size: .85rem; font-weight: 600; color: var(--color-text-muted); }
.image-dropzone-hint small { display: block; font-weight: 400; margin-top: 2px; }
.image-url-fallback { margin-top: 8px !important; font-size: .82rem !important; }
.image-field-status { font-size: .78rem; color: var(--color-secondary); font-weight: 600; min-height: 1.2em; margin-top: 4px; }
.image-field-status.is-error { color: var(--color-accent); }

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
}
.login-card label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
}

/* 2026-11 update: logo, help texts, thumbnails, image hints and alt text */
.admin-logo { background: #fff; border-radius: 10px; padding: 6px 10px; height: 64px; width: auto; align-self: flex-start; margin-bottom: 6px; }
.admin-site-link { margin-top: auto; color: #cfd6e4; font-size: .88rem; font-weight: 600; padding: 10px 12px; }
.admin-site-link:hover { color: #fff; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#collection-help { max-width: 70ch; }
.admin-notice { background: var(--color-secondary-tint); border: 1px solid #bfe0cc; border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.admin-notice p { margin: 0; font-weight: 600; color: #1d5c3a; }
.admin-row { gap: 12px; }
.admin-thumb { width: 52px; height: 40px; border-radius: 8px; background: #f1f3f6; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.admin-thumb img { width: 100%; height: 100%; object-fit: contain; }
.admin-row-title { min-width: 0; overflow-wrap: break-word; flex: 1 1 200px; font-weight: 600; }
.form-field { display: block; margin-bottom: 18px; }
.field-label { display: block; font-weight: 700; font-size: .9rem; }
.field-help, .field-hint { display: block; font-weight: 400; font-size: .8rem; color: var(--color-text-muted); margin: 3px 0 0; }
.field-hint { background: var(--color-primary-tint); color: var(--color-primary-dark); border-radius: 8px; padding: 6px 10px; margin: 6px 0 8px; }
.image-dropzone.is-logo .image-preview {
  object-fit: contain; max-width: 220px;
  background: repeating-conic-gradient(#eef0f3 0% 25%, #fff 0% 50%) 50% / 16px 16px; /* shows transparency */
}
.image-remove { margin-top: 6px; background: none; border: none; color: var(--color-accent); font-weight: 600; cursor: pointer; padding: 0; font-size: .82rem; }
.alt-label { display: block; margin-top: 8px; font-weight: 600; font-size: .85rem; }
.alt-label small { font-weight: 400; color: var(--color-text-muted); }
#entry-form-wrap { max-width: 760px; }
#entry-form-wrap .alt-label input { margin-top: 4px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; border-top: 1px solid var(--color-border); }
.admin-row > span.admin-thumb { flex: 0 0 52px; }
