/*
 * aChoir base stylesheet — shared across every page rendered through
 * layouts/main.php. Page-specific templates may add scoped styles on top.
 *
 * Phase 7 steg 1: extract typography, container, userbar, flash, and form
 * input baselines out of the per-template <style> blocks so they're
 * defined once and respect 44px tap targets on touch devices.
 */

:root {
  --color-bg: #fff;
  --color-text: #1f1f24;
  --color-muted: #555c66;
  --color-border: #d8d8de;
  --color-border-strong: #888c93;
  --color-accent: #1f3b8a;
  --color-bg-soft: #fafafa;
  --color-bg-button: #f3f4f6;
  --color-bg-button-hover: #e7e9ee;
  --container-max: 70rem;
  --tap-min: 2.75rem; /* 44 px at default root font size */
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.5rem; margin: .25rem 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1rem 0 .5rem; }

a { color: var(--color-accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 1rem;
}

/*
 * Userbar — the navigation strip at the top of every authenticated page.
 * Two sides separated by space-between, each side allowed to wrap onto its
 * own line when the viewport gets too narrow.
 */
nav.userbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin-bottom: 1rem;
  font-size: .95rem;
}
nav.userbar > * { min-width: 0; }
nav.userbar form { display: inline; }

/* Flash / warning / error banners */
.flash, .flash.success { background: #d4edda; color: #155724; }
.warn                  { background: #fff3cd; color: #856404; }
.flash.error, .error   { background: #f8d7da; color: #721c24; }
.flash, .warn, .error  {
  padding: .6rem 1rem;
  border-radius: 4px;
  margin: 0 0 1rem;
}

.empty { color: var(--color-muted); font-style: italic; padding: .5rem 0; }

/* Wrap any wide table so it scrolls horizontally on narrow screens
 * instead of stretching the viewport. Add markup: <div class="responsive-table">…</div>.
 */
.responsive-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/*
 * Form inputs — uniform baseline. The 44 px min-height applies on touch
 * devices too because the rule is unconditional; per-page styles may
 * override for visually-compact tables (e.g. the admin "Rediger" links).
 */
input[type=text],
input[type=email],
input[type=password],
input[type=date],
input[type=number],
input[type=tel],
input[type=url],
input[type=search],
textarea,
select {
  font: inherit;
  padding: .55rem .7rem;
  min-height: var(--tap-min);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  max-width: 100%;
}
textarea { min-height: 6rem; resize: vertical; }
input:disabled, textarea:disabled, select:disabled { background: var(--color-bg-soft); color: var(--color-muted); }

/*
 * Buttons — keep current sizing for compact admin actions but ensure the
 * default `button` element meets the tap-target minimum. Pages that need
 * smaller chips (inline "Slett" forms) can override via more-specific
 * selectors as they already do.
 */
button {
  font: inherit;
  padding: .5rem 1rem;
  min-height: var(--tap-min);
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  background: var(--color-bg-button);
  color: inherit;
  cursor: pointer;
}
button:hover { background: var(--color-bg-button-hover); }
button:disabled { color: #999; background: var(--color-bg-soft); cursor: default; }

@media (max-width: 640px) {
  .container { padding: .75rem; }
  nav.userbar { gap: .25rem .75rem; font-size: .9rem; }
  h1 { font-size: 1.35rem; }
}

@media (max-width: 480px) {
  html { font-size: 15px; }
}
