/* Things that hold other things: panels, filter bars, dialogs, toasts,
   notices, the empty state and the sign in card. */

/* ---------- Panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.panel-head h2 {
  font-size: var(--fs-cell);
  font-weight: 600;
}

.panel-head .btn {
  margin-left: auto;
}

.panel-body {
  padding: var(--s4);
}

.panel-foot {
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-meta);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

/* ---------- Filter bar ---------- */

.filters {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
}

.filters .field {
  min-width: 0;
}

.filter-count {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-left: auto;
}

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.4);
  display: grid;
  place-items: center;
  padding: var(--s4);
  z-index: 60;
  animation: fade var(--t-base) var(--ease-out);
}

.modal {
  width: min(560px, 100%);
  max-height: 88dvh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
  animation: pop var(--t-base) var(--ease-out);
}

.modal-head {
  display: flex;
  align-items: center;
  padding: var(--s4);
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: var(--fs-title);
  font-weight: 600;
}

.modal-head .btn {
  margin-left: auto;
}

.modal-body {
  padding: var(--s4);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  padding: var(--s4);
  border-top: 1px solid var(--border);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(6px);
  }
}

.toast-stack {
  position: fixed;
  right: var(--s5);
  bottom: var(--s5);
  display: grid;
  gap: var(--s2);
  z-index: 80;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok-fg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
  font-size: var(--fs-cell);
  animation: slide var(--t-base) var(--ease-out);
}

@keyframes slide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Empty state ---------- */

.empty {
  display: grid;
  gap: var(--s3);
  justify-items: center;
  text-align: center;
  padding: var(--s9) var(--s4);
  color: var(--text-muted);
}

.empty i {
  font-size: 32px;
  color: var(--text-faint);
}

.empty h3 {
  font-size: var(--fs-title);
  font-weight: 600;
  color: var(--text);
}

.empty p {
  font-size: var(--fs-cell);
  max-width: 44ch;
}

/* ---------- Notice ---------- */

.notice {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius);
  font-size: var(--fs-cell);
  border: 1px solid transparent;
}

.notice i {
  font-size: 18px;
  flex-shrink: 0;
}

.notice-danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: color-mix(in srgb, var(--danger-fg) 30%, transparent);
}

.notice-warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-color: color-mix(in srgb, var(--warn-fg) 30%, transparent);
}

.notice-info {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

/* ---------- Sign in ---------- */

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--s4);
  background: var(--bg);
}

.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s7);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s7);
}

.auth-title {
  font-size: var(--fs-page);
  font-weight: 600;
}

.auth-sub {
  font-size: var(--fs-cell);
  color: var(--text-muted);
  margin-top: var(--s1);
}

.auth-foot {
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-meta);
  color: var(--text-faint);
  text-align: center;
}

/* ---------- Additions for the application ---------- */

/* Forms use <label class="field"><span>Label</span><input></label>, so the
   first span carries the label styling. */
.field > span:first-child {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text-muted);
}

.field input[type="file"] {
  height: auto;
  padding: var(--s2) var(--s3);
  background: var(--surface-2);
  cursor: pointer;
}

.field p.help {
  margin: 0;
  font-size: var(--fs-cell);
}

.toast-problem {
  border-left-color: var(--danger-fg);
}

/* The add-photo tile is a one-field form, so it has to sit in the grid itself. */
.add-photo-form {
  display: contents;
}

label.add-photo {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  width: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-faint);
  cursor: pointer;
  font-size: 20px;
}

label.add-photo:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* A dialog is hidden until it is opened. */
.overlay[hidden] {
  display: none;
}
