/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --ink: #1c2530;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --bg: #f7f8fa;
  --danger: #b91c1c;
  --ok: #15803d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); }

/* --- Flash messages --- */
.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}
.flash--notice { background: #ecfdf5; color: var(--ok); }
.flash--alert  { background: #fef2f2; color: var(--danger); }

/* --- Auth / login --- */
.auth {
  max-width: 22rem;
  margin: 6rem auto;
  padding: 2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.auth h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.auth__subtitle { margin: 0 0 1.5rem; color: var(--muted); }

/* --- Non-admin home --- */
.home__bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.home__body { max-width: 40rem; margin: 5rem auto; padding: 0 1.5rem; }
.home__body h1 { font-size: 1.5rem; margin: 0 0 1rem; }
.home__body p { color: var(--muted); margin: 0 0 0.75rem; }

/* --- Admin shell --- */
.admin__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.admin__nav a { margin-right: 1.25rem; text-decoration: none; font-weight: 600; }
.admin__session { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.9rem; }
.admin__main { max-width: 60rem; margin: 2rem auto; padding: 0 1.5rem; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; margin: 0; }

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); }
.table th { background: #f1f5f9; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.table tr.is-inactive td { color: var(--muted); font-style: italic; }
.row-actions { display: flex; gap: 0.75rem; align-items: center; }

/* --- Forms --- */
.form, .auth__form { display: flex; flex-direction: column; gap: 1rem; max-width: 26rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field input, .field select {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
}
.field small { color: var(--muted); }

.btn, input[type="submit"] {
  display: inline-block;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.linkish {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.errors { background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 0.75rem 1rem; color: var(--danger); }
.errors ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.detail dt { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.detail dd { margin: 0 0 0.75rem; }
.empty { color: var(--muted); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* --- Audit log --- */
.filter-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.filter-tab {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
}
.filter-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.audit-table td { font-size: 0.9rem; vertical-align: top; }
.audit-detail { color: var(--muted); font-size: 0.85rem; word-break: break-word; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge--create  { background: #ecfdf5; color: var(--ok); }
.badge--update  { background: #eff6ff; color: var(--accent); }
.badge--destroy { background: #fef2f2; color: var(--danger); }
.badge--read    { background: #fffbeb; color: #b45309; }

.pager { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.pager__status { color: var(--muted); font-size: 0.85rem; }

/* --- Per-record audit trail --- */
.trail { list-style: none; margin: 0.5rem 0 1.25rem; padding: 0; }
.trail__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.trail__item:last-child { border-bottom: none; }
.trail__time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trail__who { font-weight: 600; }
.trail__detail { color: var(--muted); }
