/* ==========================================================================
   Prom Planner — global.css
   Design language: "committee noticeboard meets formal invitation."
   Warm paper background, ink-plum text, gold accent for primary actions,
   and a fixed set of department badge colours used everywhere a
   department is referenced (nav, cards, audit log, etc).
   ========================================================================== */

:root {
  /* Core palette */
  --ink: #1D1B2E;
  --ink-soft: #4A4661;
  --paper: #FBF7F0;
  --paper-raised: #FFFFFF;
  --line: #E4DCC9;
  --gold: #E8B94A;
  --gold-deep: #C79633;
  --danger: #C24545;
  --success: #3FA66B;

  /* Department badge colours — used consistently across nav, cards, badges */
  --dept-venue: #5B7FDE;
  --dept-fundraising: #3FA66B;
  --dept-catering: #E0714B;
  --dept-music: #B15FC7;
  --dept-decorations: #E85D8A;
  --dept-photographer: #2A9D8F;
  --dept-audit: #4A4661;

  /* Type */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* Layout */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(29, 27, 46, 0.06), 0 4px 16px rgba(29, 27, 46, 0.07);
  --max-width: 1080px;
}

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(29,27,46,0.05) 1px, transparent 0);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; color: var(--ink-soft); }

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

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

/* Visible keyboard focus everywhere — accessibility floor */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------
   Top bar — appears on every protected page
   -------------------------------------------------------------------- */
.topbar {
  background: var(--ink);
  color: var(--paper);
  padding: 14px 0;
  border-bottom: 3px solid var(--gold);
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--paper);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-brand::before {
  content: "✦";
  color: var(--gold);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: #C9C5DC;
}

.topbar-user strong { color: var(--paper); font-weight: 600; }

/* --------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------- */
.btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--gold);
  color: var(--ink);
}
.btn-primary:hover { background: var(--gold-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink-soft); }

.btn-ghost-light {
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(251, 247, 240, 0.3);
}
.btn-ghost-light:hover { border-color: var(--paper); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* --------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------- */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* --------------------------------------------------------------------
   Department badges — the recurring signature element.
   Every department reference in the app (nav tiles, table rows, audit
   log entries) uses this same ribbon-tag shape and colour.
   -------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px 4px 8px;
  border-radius: 100px;
  color: white;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
}

.badge-venue { background: var(--dept-venue); }
.badge-fundraising { background: var(--dept-fundraising); }
.badge-catering { background: var(--dept-catering); }
.badge-music { background: var(--dept-music); }
.badge-decorations { background: var(--dept-decorations); }
.badge-photographer { background: var(--dept-photographer); }
.badge-audit { background: var(--dept-audit); }

/* Status pills (distinct from department badges — softer, outline style) */
.pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.pill-success { color: var(--success); border-color: var(--success); background: rgba(63,166,107,0.08); }
.pill-warn { color: var(--gold-deep); border-color: var(--gold-deep); background: rgba(199,150,51,0.08); }
.pill-danger { color: var(--danger); border-color: var(--danger); background: rgba(194,69,69,0.08); }

/* --------------------------------------------------------------------
   Dashboard nav grid
   -------------------------------------------------------------------- */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.dept-tile {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 4px solid var(--tile-color, var(--ink));
  transition: transform 0.12s ease;
}

.dept-tile:hover { transform: translateY(-2px); }

.dept-tile h3 { margin: 0; }
.dept-tile p { margin: 0; font-size: 0.85rem; }

/* --------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------- */
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold-deep);
}

.field { margin-bottom: 14px; }

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

/* --------------------------------------------------------------------
   Tables (used for department records and the audit log)
   -------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover { background: rgba(232, 185, 74, 0.06); }

.table-wrap {
  overflow-x: auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.money { font-family: var(--font-mono); font-weight: 500; }

/* --------------------------------------------------------------------
   Login screen — the "keypad" signature
   -------------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.login-card .stars { color: var(--gold); font-size: 1.4rem; margin-bottom: 6px; }

.pin-display {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 18px 0;
  min-height: 1.4em;
  color: var(--ink);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.keypad button {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.08s ease;
}

.keypad button:hover { background: #F0E9D8; }
.keypad button:active { background: var(--gold); }

.keypad .key-clear { color: var(--danger); font-size: 0.95rem; }
.keypad .key-back { color: var(--ink-soft); font-size: 0.95rem; }

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------
   Toast / save feedback
   -------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1000;
}

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

.toast.toast-error { background: var(--danger); }

/* --------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.text-soft { color: var(--ink-soft); }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-soft);
}
.empty-state h3 { color: var(--ink-soft); }

@media (max-width: 640px) {
  .topbar .container { flex-direction: column; align-items: flex-start; gap: 10px; }
  h1 { font-size: 1.6rem; }
}
