/* =====================================================================
   FootballApp — design tokens
   A working tool for club staff, not a marketing site: dense, legible,
   pitch-inspired but restrained. One accent (gold) for primary actions;
   green carries brand + "confirmed" status; status colors are semantic,
   not decorative.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --pitch-900: #142B1C;   /* deep pitch green — headers, sidebar */
  --pitch-700: #1F4A2C;
  --pitch-500: #2F6B3C;   /* brand green */
  --pitch-100: #E7EFE6;   /* pale wash */
  --chalk:     #F7F6F2;   /* page background */
  --ink-900:   #1B2320;   /* body text */
  --ink-600:   #4C5951;
  --line:      #D9DED4;   /* hairlines */
  --gold-600:  #C8871E;   /* primary action */
  --gold-100:  #FBEFDA;
  --red-600:   #B5433A;   /* absent / declined / cancelled */
  --red-100:   #F7E6E3;
  --amber-600: #A6791E;   /* pending / waiting list */
  --amber-100: #FAF0DA;
  --white:     #FFFFFF;

  --font-display: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  --radius: 4px;
  --shell-width: 1180px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--chalk);
  line-height: 1.5;
  font-size: 15px;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; color: var(--pitch-900); margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--pitch-700); }
small, .muted { color: var(--ink-600); }

/* ---------- App shell: fixed sidebar + content ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 226px;
  flex-shrink: 0;
  background: var(--pitch-900);
  color: var(--chalk);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--white); margin-bottom: 1.5rem; display: flex; align-items: center; gap: .5rem; }
.sidebar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold-600); display: inline-block; }
.sidebar nav a {
  display: block; color: #CFE0D2; text-decoration: none; font-size: .92rem;
  padding: .55rem .6rem; border-radius: var(--radius); margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: var(--white); }
.sidebar nav a.active { background: var(--pitch-500); color: var(--white); font-weight: 600; }
.sidebar .role-tag {
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.12);
  font-size: .8rem; color: #A9C2AE;
}
.sidebar .role-tag strong { display: block; color: var(--white); font-size: .9rem; }

.content { flex: 1; min-width: 0; padding: 1.75rem 2rem 3rem; max-width: var(--shell-width); }

.topbar { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.topbar .flash { background: var(--pitch-100); border: 1px solid var(--pitch-500); color: var(--pitch-700); padding: .5rem .8rem; border-radius: var(--radius); font-size: .88rem; }

/* ---------- Panels (flat, one hairline — not the rounded-shadow-card kit) ---------- */

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; gap: 1rem; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Stat strip on the dashboard ---------- */

.stat { border-left: 3px solid var(--pitch-500); padding: .1rem 0 .1rem .8rem; }
.stat .value { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--pitch-900); line-height: 1; }
.stat .label { font-size: .82rem; color: var(--ink-600); margin-top: .3rem; }

/* ---------- Tables (roster, event lists) ---------- */

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-family: var(--font-body); font-weight: 600; color: var(--ink-600); font-size: .8rem; border-bottom: 1px solid var(--line); padding: .5rem .6rem; }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--pitch-100); }

/* ---------- Badges — semantic, not decorative ---------- */

.badge { display: inline-block; padding: .2em .6em; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-present, .badge-accepted, .badge-active   { background: var(--pitch-100); color: var(--pitch-700); }
.badge-absent, .badge-declined, .badge-cancelled { background: var(--red-100); color: var(--red-600); }
.badge-pending, .badge-waiting_list, .badge-trialing { background: var(--amber-100); color: var(--amber-600); }
.badge-training { background: var(--pitch-100); color: var(--pitch-700); }
.badge-match { background: var(--gold-100); color: var(--gold-600); }
.badge-tournament { background: #E7E3F5; color: #5C4C9E; }
.badge-social { background: #E3EEF5; color: #33637E; }

/* ---------- Forms ---------- */

label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-900); margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field small.hint { display: block; color: var(--ink-600); margin-top: .3rem; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .92rem; font-family: var(--font-body); color: var(--ink-900); background: var(--white);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, a:focus, button:focus {
  outline: 2px solid var(--gold-600); outline-offset: 1px;
}
.checkbox-row { display: flex; align-items: center; gap: .5rem; }
.checkbox-row input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; font-family: var(--font-display); padding: 0 .4rem; color: var(--pitch-900); }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: .4rem .8rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block; padding: .55rem 1.1rem; border-radius: var(--radius); font-weight: 600; font-size: .9rem;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; font-family: var(--font-body);
}
.btn-primary { background: var(--gold-600); color: var(--white); }
.btn-primary:hover { background: #B37A19; }
.btn-secondary { background: var(--white); border-color: var(--line); color: var(--ink-900); }
.btn-secondary:hover { background: var(--chalk); }
.btn-danger { background: var(--white); border-color: var(--red-600); color: var(--red-600); }
.btn-danger:hover { background: var(--red-100); }
.btn-sm { padding: .32rem .7rem; font-size: .8rem; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Empty states ---------- */

.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--ink-600); }

/* ---------- Login screen (no sidebar) ---------- */

.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--pitch-900);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 64px);
}
.auth-card { width: 100%; max-width: 380px; background: var(--white); border-radius: var(--radius); padding: 2rem 1.9rem; }
.auth-card .brand { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--pitch-900); margin-bottom: .2rem; }
.auth-card .tagline { color: var(--ink-600); font-size: .88rem; margin-bottom: 1.5rem; }
.auth-error { background: var(--red-100); color: var(--red-600); padding: .6rem .8rem; border-radius: var(--radius); font-size: .86rem; margin-bottom: 1rem; }

/* ---------- Responsive ---------- */

@media (max-width: 780px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; padding: 1rem; }
  .content { padding: 1.25rem 1.1rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Avatars (photo, or initials fallback) ---------- */

.avatar { display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; flex-shrink: 0; background: var(--pitch-100); }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; color: var(--pitch-700); }
.avatar-row { display: flex; align-items: center; gap: .6rem; }
