/* ---------------------------------------------------------------
   What? — Rijnstate abbreviation directory
   Professional, clinical look: navy + warm amber, serif headings,
   mobile-first responsive layout.
----------------------------------------------------------------- */

:root {
  --navy: #1a2e4a;
  --navy-dark: #122036;
  --navy-soft: #eef2f7;
  --amber: #c8922a;
  --amber-soft: #fbf1de;
  --amber-dark: #9c7220;
  --ink: #1f2937;
  --ink-soft: #475569;
  --ink-muted: #64748b;
  --line: #dde3eb;
  --line-soft: #e7ecf2;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(26, 46, 74, 0.06), 0 8px 24px rgba(26, 46, 74, 0.05);
  --font-heading: ui-serif, Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--amber-dark); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--navy);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 0 0 0.5rem; }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); margin: 0 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }

p { margin: 0 0 0.75rem; }

.container { width: min(1100px, 100%); margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }

/* ---------------- Navigation ---------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--amber);
}
.site-nav nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.site-nav nav a {
  color: #cfd8e3;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.site-nav nav a.active { background: rgba(255,255,255,0.14); color: #fff; }
.site-nav nav a.nav-icon { display: inline-flex; align-items: center; padding: 0.45rem 0.6rem; }
.site-nav nav a.nav-icon svg { width: 20px; height: 20px; display: block; }

/* ---------------- Hero ---------------- */
.hero { padding: 1.75rem 0 1.25rem; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.hero p { color: var(--ink-soft); font-size: 1.05rem; max-width: 56ch; }

/* ---------------- Cards & panels ---------------- */
.search-panel,
.table-card,
.card,
.auth-page .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  margin-bottom: 1.25rem;
}
.search-panel form { display: grid; grid-template-columns: 2fr 1fr; gap: 0.75rem; align-items: end; }
.search-panel label { display: grid; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); margin: 0; }
.search-input-wrap { position: relative; display: block; }
.search-input-wrap input { padding-right: 2.75rem; }
.search-submit {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
}
.search-submit:hover { background: var(--navy-soft); color: var(--navy); }
.search-submit svg { width: 18px; height: 18px; }
.form-card { max-width: 640px; }
.form-card form { display: grid; gap: 1rem; }

/* ---------------- Forms ---------------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
.search-panel input,
.search-panel select,
label input,
label select,
label textarea,
select {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.98rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 46, 74, 0.12);
}
label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
label > span { color: var(--ink-soft); }
textarea { min-height: 110px; resize: vertical; font-family: var(--font-body); }

/* ---------------- Buttons ---------------- */
button,
input[type="submit"],
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: #fff;
  border: 0;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.05s ease;
}
button:hover, input[type="submit"]:hover, .button:hover { background: var(--navy-dark); color: #fff; text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
.button-secondary {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
.button-secondary:hover { background: var(--navy-soft); color: var(--navy); }

/* Destructive actions (delete/reject) styled subtly so they don't dominate */
.inline-form button {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 7px;
}
.inline-form button:hover { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.inline-form { display: inline-block; margin: 0 0.25rem 0.25rem 0; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.85rem 0.75rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 700;
  border-bottom: 2px solid var(--line);
}
tbody tr:hover { background: var(--navy-soft); }
td .description { display: block; color: var(--ink-muted); font-size: 0.85rem; margin-top: 0.2rem; }
.cell-abbr { font-weight: 700; color: var(--navy); font-family: var(--font-heading); font-size: 1.05rem; }

/* ---------------- Status badges ---------------- */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-approved { background: #ecfdf5; color: #166534; border: 1px solid #a7f3d0; }
.badge-pending { background: var(--amber-soft); color: var(--amber-dark); border: 1px solid #f0d9af; }
.badge-rejected { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-category { background: var(--navy-soft); color: var(--navy); border: 1px solid #d6e0ec; font-weight: 600; text-transform: none; letter-spacing: normal; padding: 0.1rem 0.3rem; border-radius: 4px; align-self: flex-start; }

/* ---------------- Flash messages ---------------- */
.flash {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.flash-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-success { background: #ecfdf5; color: #166534; border: 1px solid #a7f3d0; }

/* ---------------- Misc layout helpers ---------------- */
.actions-row { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.bulk-bar { align-items: center; gap: 0.75rem; background: var(--navy-soft); border: 1px solid #d6e0ec; border-radius: var(--radius-sm); padding: 0.6rem 1rem; margin-bottom: 0.75rem; }
.bulk-bar-label { font-size: 0.85rem; font-weight: 600; color: var(--navy); white-space: nowrap; }
.bulk-bar select { flex: 1; min-width: 0; }
table input[type="checkbox"] { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--navy); }
.inline-cat { font-size: 0.78rem; font-weight: 600; color: var(--navy); background: var(--navy-soft); border: 1px solid #d6e0ec; border-radius: 4px; padding: 0.1rem 0.25rem; cursor: pointer; transition: background 0.25s, border-color 0.25s; }
.inline-cat.cat-saving { opacity: 0.5; }
.inline-cat.cat-saved { background: #ecfdf5; border-color: #a7f3d0; }
.inline-cat.cat-error { background: #fef2f2; border-color: #fecaca; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stats-grid article {
  background: var(--surface);
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.stats-grid article h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); font-family: var(--font-body); font-weight: 700; }
.stats-grid article p { font-family: var(--font-heading); font-size: 2.1rem; font-weight: 700; color: var(--navy); margin: 0; }

.auth-page { max-width: 440px; margin: 2.5rem auto; }
.auth-page h1 { text-align: center; }
.auth-page .card p { color: var(--ink-muted); font-size: 0.9rem; text-align: center; margin: 0.75rem 0 0; }
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.auth-brand img { width: 44px; height: 44px; border-radius: 10px; }
.auth-brand span { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700; color: var(--navy); }

.empty-state { text-align: center; color: var(--ink-muted); padding: 1.5rem 0; }

/* ---------------- Footer ---------------- */
.site-footer {
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.85rem;
  padding: 1.5rem 1.25rem 2.5rem;
}
.site-footer a { color: var(--ink-soft); }

/* =================================================================
   Responsive: tablet & phone
================================================================= */
@media (max-width: 760px) {
  .container { padding: 1rem 1rem 2.5rem; }
  .site-nav { flex-direction: column; align-items: stretch; padding: 0.75rem 1rem; }
  .site-nav nav { justify-content: center; }
  .search-panel form { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Collapse data tables into stacked cards on small screens */
@media (max-width: 640px) {
  .table-card table,
  .table-card thead,
  .table-card tbody,
  .table-card th,
  .table-card td,
  .table-card tr,
  .card table,
  .card thead,
  .card tbody,
  .card th,
  .card td,
  .card tr {
    display: block;
  }
  .table-card thead tr,
  .card thead tr {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .table-card tbody tr,
  .card tbody tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 0.85rem;
    padding: 0.4rem 0.9rem;
  }
  .table-card tbody tr:hover,
  .card tbody tr:hover { background: var(--surface); }
  .table-card td,
  .card td {
    border-bottom: 1px solid var(--line-soft);
    padding: 0.6rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }
  .table-card td:last-child,
  .card td:last-child { border-bottom: 0; }
  .table-card td[data-label]::before,
  .card td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--ink-muted);
  }
  .table-card td:empty,
  .card td:empty { display: none; }
  .table-card td:first-child,
  .card td:first-child {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
  }
  /* Pin the flag to the top-right of the stacked card, by the abbreviation. */
  .table-card tbody tr { position: relative; }
  .table-card .flag-cell {
    position: absolute;
    top: 0.5rem;
    right: 0.7rem;
    width: auto;
    padding: 0;
    border-bottom: 0;
  }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ---------------- Flag button & report modal ---------------- */
.flag-cell { width: 1%; white-space: nowrap; text-align: right; }
.flag-btn {
  padding: 0.15rem;
  background: none;
  border: none;
  color: var(--ink-muted);
  opacity: 0.45;
  cursor: pointer;
  line-height: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.flag-btn:hover,
.flag-btn:focus-visible {
  opacity: 1;
  color: var(--amber-dark);
}
.flag-btn.flagged {
  opacity: 1;
  color: #c0392b;
}
.flag-btn.flagged:hover,
.flag-btn.flagged:focus-visible {
  color: #a12f23;
}
.flag-btn svg { width: 18px; height: 18px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 32, 54, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  width: 100%;
  max-width: 30rem;
}
.modal h3 { margin: 0 0 0.25rem; }
.modal .modal-sub {
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 0.5rem;
}
.modal p { color: var(--ink-soft); margin: 0 0 0.75rem; }
.modal textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font: inherit;
  resize: vertical;
}
.modal .modal-error { color: #b91c1c; font-size: 0.9rem; margin: 0.5rem 0 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
