/* ============================================================================
   PictU — delivery, gallery, admin, toast
   ----------------------------------------------------------------------------
   Same tokens, same rules as style.css: hairline depth, restrained radius,
   one pink per screen. Delivery treats the photograph as the hero and the
   four channels as peer actions separated by rules rather than four floating
   cards.
   ========================================================================== */

/* ===== DELIVERY =========================================================== */

.delivery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}

.delivery-photo {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
}

.delivery-actions {
  display: flex;
  flex-direction: column;
}

/* Channels are peers: separated by hairlines, not boxed into identical cards. */
.action-group {
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
}

.action-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.action-group__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}

.action-group__head .ico {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--ink-3);
}

.action-group__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
}

.delivery-note {
  margin-bottom: var(--s-3);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}

.delivery-note strong {
  color: var(--accent-strong);
  font-weight: var(--fw-semibold);
}

.email-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.email-form input[type='email'] {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-ui);
}

.email-form input[type='email']::placeholder {
  color: var(--ink-3);
}

.email-form input[type='email']:focus {
  border-color: var(--accent);
}

.field-status {
  margin-top: var(--s-2);
  min-height: 1.25rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.field-status[data-status='ok'] {
  color: var(--ok);
}

.field-status[data-status='err'] {
  color: var(--err);
}

.field-status[data-status='info'] {
  color: var(--ink-2);
}

.qr-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
}

#qrImageWrap img {
  width: min(16rem, 100%);
  padding: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.qr-note {
  min-height: 1.25rem;
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

/* ===== SHARED STATE BLOCKS (loading / empty / error) ====================== */

.state-block {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-7) var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink-2);
  text-align: center;
  font-size: var(--fs-ui);
}

.state-block .ico {
  width: 2rem;
  height: 2rem;
  color: var(--ink-3);
  stroke-width: 1.5;
}

.state-block--err {
  border: 1px solid var(--line);
  border-left: 3px solid var(--err);
  color: var(--ink);
}

.state-block--err .ico {
  color: var(--err);
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== GALLERY ============================================================
   Images keep their natural height: a photo collection should read as
   photographs, not as a uniform tile grid.
   ======================================================================== */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: var(--s-4);
}

.gallery-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface-sunken);
}

/* ===== ADMIN ==============================================================
   Information-dense and quiet. Approve is the only filled action; reject,
   hide and delete step down in weight so the affirmative choice is obvious.
   ======================================================================== */

.admin-wrap {
  max-width: 60rem;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.admin-header h1 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--track-display);
}

.admin-account {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.admin-card {
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.admin-card h2 {
  margin-bottom: var(--s-3);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
}

.admin-card form {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-width: 20rem;
}

.admin-card label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--ink-2);
}

.admin-card input {
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}

.admin-card input:focus {
  border-color: var(--accent);
}

.admin-note {
  color: var(--ink-2);
  font-size: var(--fs-ui);
}

.admin-queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.admin-submission {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.admin-submission img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--surface-sunken);
}

.admin-meta {
  display: grid;
  gap: 2px;
  padding: var(--s-3);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.admin-meta strong {
  color: var(--ink);
  font-weight: var(--fw-semibold);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: 0 var(--s-3) var(--s-3);
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 var(--s-3);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.admin-approve {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--ink-invert);
}

.admin-approve:hover {
  background: #1a6b49;
  border-color: #1a6b49;
}

.admin-reject {
  border-color: var(--err);
  color: var(--err);
}

.admin-reject:hover {
  background: var(--err-soft);
}

.admin-hide {
  border-color: var(--line-strong);
  color: var(--warn);
}

.admin-hide:hover {
  border-color: var(--warn);
}

.admin-delete {
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.admin-delete:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.admin-audit {
  overflow-x: auto;
  margin-bottom: var(--s-4);
}

.admin-audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.admin-audit-table th,
.admin-audit-table td {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.admin-audit-table th {
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
}

.admin-audit-table td {
  color: var(--ink);
}

.admin-audit-table code {
  color: var(--ink-2);
  font-size: var(--fs-xs);
}

/* ===== TOASTS =============================================================
   A floating element, so the shadow is earned. Semantic colour, not four
   arbitrary backgrounds.
   ======================================================================== */

/* Anchored on both edges rather than `left:50%` alone. With only `left` set,
   a fixed box shrink-to-fits against the space to the *right* of `left`, so
   the container was capped at half the viewport and long messages wrapped
   early (visible at 390px). Both edges give it the full width to work with,
   and `align-items` does the centering instead of a transform. */
.toast-container {
  position: fixed;
  right: 0;
  bottom: var(--s-4);
  left: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  max-width: 100%;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--stage);
  color: var(--ink-invert);
  font-size: var(--fs-ui);
  font-weight: var(--fw-medium);
  text-align: left;
  box-shadow: var(--sh-toast);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-ok {
  background: var(--ok);
}

.toast-err {
  background: var(--err);
}

.toast-info {
  background: var(--stage);
}

/* ===== RESPONSIVE ========================================================= */

@media (max-width: 900px) {
  .delivery-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .delivery-photo {
    position: static;
  }
}

@media (max-width: 767px) {
  .action-group {
    padding: var(--s-3) 0;
  }

  .email-form .primary {
    flex: 1 1 100%;
  }

  .admin-card {
    padding: var(--s-4);
  }

  .toast-container {
    bottom: var(--s-3);
  }
}

/* ===== REDUCED MOTION ===================================================== */

@media (prefers-reduced-motion: reduce) {
  .toast,
  .admin-btn,
  .spinner {
    transition: none;
    animation: none;
  }

  .toast {
    transform: none;
  }

  .toast-visible {
    transform: none;
  }
}
