/* ============================================================
   Ligue Québec Table Tennis — Admin Stylesheet
   ============================================================ */

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

:root {
  --primary:    #0d2b4e;
  --primary-h:  #1a4a82;
  --accent:     #c1121f;
  --bg:         #f0f2f5;
  --surface:    #ffffff;
  --border:     #dde3ea;
  --text:       #1a1f2e;
  --text-muted: #5a6473;
  --green:      #1a5c2a;
  --green-bg:   #e6f4ea;
  --green-border:#b7dfbf;
  --warn:       #92400e;
  --warn-bg:    #fef3c7;
  --radius-sm:  0.375rem;
  --radius:     0.625rem;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow:     0 4px 16px rgba(0,0,0,.10);
  --nav-h:      3.5rem;
}

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--primary-h); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ============================================================
   ADMIN HEADER
   ============================================================ */
.admin-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.admin-header .container {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  gap: 1rem;
}
.admin-logo {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.admin-nav {
  flex: 1;
  display: flex;
  gap: 0.125rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a {
  display: block;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.8);
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.admin-nav a:hover,
.admin-nav a[aria-current="page"] {
  background: rgba(255,255,255,.18);
  color: #fff;
  text-decoration: none;
}
.logout-form { flex-shrink: 0; }
.btn-logout {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.85);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.22); color: #fff; }

/* ============================================================
   ADMIN MAIN
   ============================================================ */
.admin-main { padding-block: 2rem; }
.admin-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Section header: title + action button side-by-side */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.section-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
}
.section-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}
.subsection-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

/* ============================================================
   DASHBOARD STAT GRID
   ============================================================ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  display: block;
  color: var(--text);
}
.admin-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--primary-h);
  text-decoration: none;
}
.admin-card h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  text-decoration: none;
  color: var(--text);
}
.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--primary-h);
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ============================================================
   FORMS (shared admin forms)
   ============================================================ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
  max-width: 700px;
}
.admin-form { display: flex; flex-direction: column; }

.form-group { margin-bottom: 1.125rem; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-h);
  box-shadow: 0 0 0 3px rgba(26,74,130,.15);
}
.form-group textarea { resize: vertical; min-height: 8rem; }

/* Two-column row */
.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 180px; }

/* Inline row (select + button) */
.form-row-inline {
  align-items: flex-start;
  gap: 0.75rem;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
.form-hint-inline {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.form-actions {
  margin-top: 0.75rem;
}

/* Checkbox label */
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:active { transform: scale(.98); }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover   { background: var(--primary-h); color: #fff; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--primary-h); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.btn-danger    { background: var(--accent); color: #fff; }
.btn-danger:hover    { background: #a00e18; }

/* Inline link-style action buttons (no visible button chrome) */
.btn-link {
  background: none;
  border: none;
  color: var(--primary-h);
  font-size: 0.9375rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { color: var(--primary); }
.btn-danger-link { color: var(--accent); }
.btn-danger-link:hover { color: #a00e18; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 0.9375rem;
}
.data-table th,
.data-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--primary);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #eef3fa; }
.col-num { text-align: center; width: 4rem; }

/* Actions column: multiple inline forms/links side-by-side */
.table-actions {
  white-space: nowrap;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Inline form (used inside table cells for single-button actions) */
.inline-form { display: inline; }
.inline-add-form { margin-top: 1rem; }

.no-data {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem 1rem !important;
}
.text-muted { color: var(--text-muted); }
.text-warn  { color: var(--warn); font-weight: 600; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-active   { background: var(--green-bg);  color: var(--green);       border: 1px solid var(--green-border); }
.badge-inactive { background: #f3f4f6;           color: var(--text-muted);  border: 1px solid var(--border); }
.badge-scheduled{ background: #dbeafe;           color: #1d4ed8;            border: 1px solid #93c5fd; }
.badge-completed{ background: var(--green-bg);   color: var(--green);       border: 1px solid var(--green-border); }
.badge-forfeit  { background: var(--warn-bg);    color: var(--warn);        border: 1px solid #fcd34d; }
.badge-cancelled{ background: #fde8e8;           color: #8b0000;            border: 1px solid #f5c2c2; }
.badge-postponed{ background: #f3e8ff;           color: #6b21a8;            border: 1px solid #d8b4fe; }

/* ============================================================
   DETAIL VIEWS
   ============================================================ */
.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  max-width: 700px;
}
.detail-list dt {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.detail-list dd { color: var(--text); }

/* Encounter header (team names + vs) */
.encounter-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.vs-sep {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
}
.enc-teams { white-space: nowrap; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--primary);
}
.login-main { width: 100%; padding: 1rem; }
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  max-width: 380px;
  margin-inline: auto;
}
.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--primary);
  text-align: center;
}
.login-card label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.login-card input[type="password"] {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-bottom: 1.25rem;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-h);
  box-shadow: 0 0 0 3px rgba(26,74,130,.15);
}
.login-card button[type="submit"] {
  width: 100%;
  padding: 0.625rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.login-card button[type="submit"]:hover { background: var(--primary-h); }

/* ============================================================
   ALERTS & MESSAGES
   ============================================================ */
.error-msg {
  background: #fde8e8;
  color: #8b0000;
  border: 1px solid #f5c2c2;
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.error-list { padding-left: 1.25rem; }
.success-msg {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
