/* ═══════════════════════════════════════════
   CSS VARIABLES — The "control panel" for the 
   whole app's look. Change a color here and it 
   changes everywhere that uses it.

   💡 LEARNING NOTE: These variables are the 
   club colours applied throughout. If the club 
   ever rebrands, you only change values here.
═══════════════════════════════════════════ */
:root {
  /* ─── Core backgrounds ─── */
  --bg: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFBFC;
  --bg-sidebar: #0C1A3A;
  --bg-sidebar-hover: #142856;
  --bg-sidebar-active: #1C3570;

  /* ─── Text colours ─── */
  --text-primary: #0F1A2E;
  --text-secondary: #4A5568;
  --text-muted: #8494A7;
  --text-sidebar: #8FA4C8;
  --text-sidebar-active: #FFFFFF;

  /* ─── Accent — the club's yellow ─── */
  --accent: #D4A012;
  --accent-hover: #B8890F;
  --accent-light: #FDF6E3;
  --accent-text: #0C1A3A;

  /* ─── Club blue (used for primary buttons etc.) ─── */
  --primary: #0C1A3A;
  --primary-hover: #162D5A;
  --primary-light: #E8EDF5;
  --primary-text: #FFFFFF;

  /* ─── Borders ─── */
  --border: #D6DCE5;
  --border-light: #E8ECF1;

  /* ─── Status colours ─── */
  --danger: #C0392B;
  --danger-light: #FDECEA;
  --danger-hover: #A93226;
  --warning: #D4830A;
  --warning-light: #FEF5E7;
  --success: #1E8449;
  --success-light: #E8F8F0;

  /* ─── Competition level badges ─── */
  --county-bg: #E8F5E9; --county-text: #2E7D32; --county-border: #A5D6A7;
  --munster-bg: #E3F2FD; --munster-text: #1565C0; --munster-border: #90CAF9;
  --national-bg: #FFF3E0; --national-text: #E65100; --national-border: #FFCC80;
  --club-bg: #EBE4F7; --club-text: #5B2C8A; --club-border: #C5A8E0;

  /* ─── Utilities ─── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --transition: 0.2s ease;
}

/* ═══════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ═══════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-sidebar-active);
  padding: 0 12px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 20px;
  line-height: 1.3;
}
.sidebar-brand span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all var(--transition);
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #C8D4E8; }
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
}
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 12px 8px;
}
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
}
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}
.sidebar-user-info { flex: 1; }
.sidebar-user-name {
  color: var(--text-sidebar-active);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
}
.sidebar-user-role {
  color: var(--text-sidebar);
  font-size: 0.72rem;
}
.sidebar-logout-btn {
  color: var(--text-sidebar);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.sidebar-logout-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ─── Main content area ─── */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px 40px;
  max-width: 1100px;
}

/* ─── Mobile menu toggle ─── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--bg-sidebar);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* ═══════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════ */
.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-header p {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 0.95rem;
}

/* ═══════════════════════════════════════════
   CARDS
═══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-accent {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost {
  color: var(--text-secondary);
  padding: 8px 14px;
}
.btn-ghost:hover { background: var(--border-light); color: var(--text-primary); }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-xs { padding: 5px 10px; font-size: 0.78rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ═══════════════════════════════════════════
   LEVEL BADGES
═══════════════════════════════════════════ */
.level-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.level-badge.county { background: var(--county-bg); color: var(--county-text); border-color: var(--county-border); }
.level-badge.munster { background: var(--munster-bg); color: var(--munster-text); border-color: var(--munster-border); }
.level-badge.national { background: var(--national-bg); color: var(--national-text); border-color: var(--national-border); }
.level-badge.club { background: var(--club-bg); color: var(--club-text); border-color: var(--club-border); }

/* ═══════════════════════════════════════════
   STATUS BADGES
═══════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-badge.unpaid { background: var(--warning-light); color: var(--warning); }
.status-badge.paid { background: var(--success-light); color: var(--success); }
.status-badge.submitted { background: var(--primary-light); color: var(--primary); }
.status-badge.closed { background: #ECEEF2; color: var(--text-muted); }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ═══════════════════════════════════════════
   TABLES
═══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════
   FORMS
═══════════════════════════════════════════ */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,160,18,0.15);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ═══════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--accent);
}
.stat-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.2;
  color: var(--primary);
}
.stat-card-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   COMPETITION LIST CARDS
═══════════════════════════════════════════ */
.comp-list { display: flex; flex-direction: column; gap: 12px; }
.comp-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.comp-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.comp-date-box {
  width: 56px;
  min-width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.comp-date-day {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
}
.comp-date-month {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #FFFFFF;
  letter-spacing: 0.5px;
}
.comp-info { flex: 1; min-width: 0; }
.comp-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 3px;
}
.comp-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.comp-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.comp-fee {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.comp-entries-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   MODAL OVERLAY
═══════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12,26,58,0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border-light); color: var(--text-primary); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}

/* ═══════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-sidebar);
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(212,160,18,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(28,53,112,0.2) 0%, transparent 50%);
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  border-top: 4px solid var(--accent);
}
.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.login-card .subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.92rem;
}
.login-card .form-group { text-align: left; }
.login-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.login-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════
   ALERT / NOTICE BANNER
═══════════════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-bottom: 20px;
}
.alert-warning {
  background: var(--warning-light);
  color: #8B5E1A;
  border: 1px solid #F5D9A8;
}
.alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #F5C6C0;
}
.alert-success {
  background: var(--success-light);
  color: #1E8449;
  border: 1px solid #A9DFBF;
}
.alert-icon { margin-top: 1px; flex-shrink: 0; }

/* ═══════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state p { font-size: 0.92rem; }

/* ═══════════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════════ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.filter-chip {
  padding: 7px 16px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ═══════════════════════════════════════════
   BACK LINK
═══════════════════════════════════════════ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.88rem;
  margin-bottom: 16px;
  transition: color var(--transition);
}
.back-link:hover { color: var(--primary); }

/* ═══════════════════════════════════════════
   TOAST NOTIFICATION
═══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 14px 20px;
  background: var(--bg-sidebar);
  color: white;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 360px;
}
.toast.success { background: #1A6B3F; }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ═══════════════════════════════════════════
   CONFIRM DIALOG
═══════════════════════════════════════════ */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12,26,58,0.6);
  z-index: 700;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.confirm-box h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 8px;
}
.confirm-box p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }
  .mobile-overlay.open { display: block; }
  .main-content { margin-left: 0; padding: 16px 12px; padding-top: 64px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card-value { font-size: 1.4rem; }
  .stat-card-label { font-size: 0.72rem; }
  .card { padding: 16px; margin-bottom: 14px; }
  .card-header { margin-bottom: 12px; }
  .card-title { font-size: 1rem; }
  .comp-card { flex-direction: row; align-items: center; padding: 12px 14px; gap: 12px; }
  .comp-date-box { width: 46px; min-width: 46px; height: 46px; }
  .comp-date-day { font-size: 1.1rem; }
  .comp-date-month { font-size: 0.62rem; }
  .comp-name { font-size: 0.9rem; }
  .comp-meta { font-size: 0.75rem; gap: 8px; }
  .comp-fee { font-size: 0.95rem; }
  .comp-entries-count { font-size: 0.72rem; }
  .comp-right { flex-direction: column; align-items: flex-end; gap: 4px; }
  .page-header { margin-bottom: 18px; }
  .page-header h1 { font-size: 1.4rem; }
  .page-header p { font-size: 0.85rem; }
  .level-badge { font-size: 0.68rem; padding: 2px 8px; }
  .status-badge { font-size: 0.68rem; padding: 3px 8px; }
  .btn { padding: 9px 16px; font-size: 0.84rem; }
  .btn-sm { padding: 6px 12px; font-size: 0.78rem; }
  .modal { padding: 20px; margin: 10px; }
  .filter-chip { padding: 6px 12px; font-size: 0.78rem; }
}

/* ═══════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════ */
.hidden { display: none !important; }
.screen { display: none; }
.screen.active { display: block; }
