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

/* --- Reset & tokens --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #0d2b4e;
  --primary-h:     #1a4a82;
  --accent:        #c1121f;
  --bg:            #f4f6f9;
  --surface:       #ffffff;
  --border:        #dde3ea;
  --text:          #1a1f2e;
  --text-muted:    #5a6473;
  --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);
  --container:     1100px;
  --nav-h:         3.75rem;
}

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary-h); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Container --- */
.container {
  width: min(var(--container), 100%);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.site-header .container {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  gap: 0.75rem;
}

.site-logo {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: .02em;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.site-logo:hover { color: #cce0ff; text-decoration: none; }

/* Nav */
.main-nav { flex: 1; min-width: 0; }
.main-nav ul { list-style: none; display: flex; gap: 0.125rem; }
.main-nav a {
  display: block;
  padding: 0.375rem 0.7rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.82);
  font-size: 0.9375rem;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: rgba(255,255,255,.16);
  color: #fff;
  text-decoration: none;
}

/* Lang switch */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  flex-shrink: 0;
}
.lang-switch a { color: rgba(255,255,255,.65); font-weight: 700; letter-spacing: .06em; }
.lang-switch a[aria-current="true"],
.lang-switch a:hover { color: #fff; text-decoration: none; }
.lang-switch span { color: rgba(255,255,255,.3); }

/* Hamburger toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* Mobile */
@media (max-width: 760px) {
  .nav-toggle { display: flex; order: 3; margin-left: auto; }
  .lang-switch { order: 2; }
  .main-nav {
    order: 4;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--primary);
    padding: 0.75rem 1rem 1.25rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    display: none;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0.125rem; }
  .main-nav a { padding: 0.6rem 1rem; }
  .site-header .container { flex-wrap: wrap; height: auto; min-height: var(--nav-h); }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(140deg, var(--primary) 0%, var(--primary-h) 100%);
  color: #fff;
  padding: 4.5rem 0;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -.025em;
  margin-bottom: 0.75rem;
}
.hero-subtitle {
  font-size: 1.2rem;
  color: rgba(255,255,255,.78);
  max-width: 580px;
  margin-inline: auto;
}

/* ============================================================
   HOME GRID
   ============================================================ */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
  padding-block: 3rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.card h2 a { color: var(--primary); }
.card h2 a:hover { color: var(--primary-h); text-decoration: none; }
.card p { color: var(--text-muted); font-size: 0.9375rem; }

/* ============================================================
   SECTION PAGES (standings, schedule, etc.)
   ============================================================ */
.page-header {
  background: var(--primary);
  color: #fff;
  padding: 2.5rem 0;
}
.page-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
}
.page-content { padding-block: 2rem; }

.coming-soon {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ============================================================
   DATA TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9375rem;
}
.data-table th,
.data-table td {
  padding: 0.7rem 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; }

/* ============================================================
   ERROR PAGE
   ============================================================ */
.error-page {
  text-align: center;
  padding: 5rem 1rem;
}
.error-page h1 {
  font-size: 7rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}
.error-page p {
  margin: 1rem 0 2rem;
  color: var(--text-muted);
  font-size: 1.125rem;
}
.error-page a {
  display: inline-block;
  padding: 0.625rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background .15s;
}
.error-page a:hover { background: var(--primary-h); text-decoration: none; }

/* ============================================================
   SHARED SECTION ELEMENTS
   ============================================================ */
.section-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.no-data {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--primary-h);
}

.status-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.status-scheduled  { background: #e8f4fd; color: #1a6a9a; }
.status-completed  { background: #e7f6e8; color: #1a6e2a; }
.status-cancelled  { background: #fce8e8; color: #9a1a1a; }
.status-postponed  { background: #fff3e0; color: #8a5200; }
.status-forfeit    { background: #f3e8fc; color: #6a1a8a; }
.status-active     { background: #e7f6e8; color: #1a6e2a; }
.status-inactive   { background: #f0f0f0; color: #666; }

/* ============================================================
   STANDINGS
   ============================================================ */
.season-label {
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.division-section { margin-bottom: 2.5rem; }

.division-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

.standings-table .col-pos,
.standings-table .col-num {
  text-align: center;
  white-space: nowrap;
  width: 3rem;
}
.standings-table .col-team { min-width: 12rem; }
.standings-table .col-pts { background: rgba(13, 43, 78, .06); font-weight: 700; }
.standings-table .col-diff { color: var(--text-muted); }
.team-club {
  color: var(--text-muted);
  font-size: 0.85em;
  font-weight: 400;
  margin-left: 0.25rem;
}

/* ============================================================
   SCHEDULE
   ============================================================ */
.schedule-table .col-date    { white-space: nowrap; min-width: 10rem; }
.schedule-table .col-division { white-space: nowrap; }
.schedule-table .col-teams   { min-width: 18rem; }
.schedule-table .col-venue   { color: var(--text-muted); font-size: 0.875rem; }
.schedule-table .col-score   { text-align: center; white-space: nowrap; }

.vs-sep {
  color: var(--text-muted);
  margin-inline: 0.4rem;
  font-size: 0.85em;
}
.result-score {
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: .04em;
}

/* ============================================================
   PLAYERS
   ============================================================ */
.players-table td:first-child a {
  color: var(--primary-h);
  font-weight: 500;
}

.player-profile {
  max-width: 640px;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.profile-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.profile-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}
.profile-details dt {
  color: var(--text-muted);
  font-weight: 600;
}
.profile-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.seasons-list {
  list-style: disc;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.8;
}
.no-data-inline {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ============================================================
   NEWS
   ============================================================ */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.article-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.article-card-title a { color: var(--primary); }
.article-card-title a:hover { color: var(--primary-h); text-decoration: none; }
.article-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.read-more-link {
  font-size: 0.875rem;
  color: var(--primary-h);
  font-weight: 500;
}

/* Full article */
.article-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.article-full-header { margin-bottom: 1.5rem; }
.article-full-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

/* Rendered Markdown body */
.article-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  max-width: 720px;
}
.article-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1.75rem 0 0.5rem;
}
.article-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1.5rem 0 0.4rem;
}
.article-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.25rem 0 0.3rem;
}
.article-body p  { margin-bottom: 1rem; }
.article-body ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.article-body li { margin-bottom: 0.25rem; }
.article-body strong { font-weight: 700; }
.article-body em     { font-style: italic; }
.article-body a {
  color: var(--primary-h);
  text-decoration: underline;
}

/* ============================================================
   EVENTS
   ============================================================ */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 0.5rem;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.event-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.event-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.event-when {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.event-where {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.event-label { font-weight: 600; }
.event-desc {
  font-size: 0.875rem;
  color: var(--text);
  margin-top: 0.4rem;
}
.event-end { opacity: .8; }

.event-type-badge {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.event-match      { background: #e8f4fd; color: #1a6a9a; }
.event-tournament { background: #fff3e0; color: #8a5200; }
.event-training   { background: #e7f6e8; color: #1a6e2a; }
.event-meeting    { background: #f3e8fc; color: #6a1a8a; }
.event-general    { background: #f0f0f0; color: #555; }

/* ============================================================
   HOME — LIVE SECTIONS
   ============================================================ */
.home-live {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding-block: 2rem 3rem;
}

@media (max-width: 640px) {
  .home-live { grid-template-columns: 1fr; }
}

.live-col {}

.live-row {
  display: flex;
  flex-direction: column;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}
.live-row:last-of-type { border-bottom: none; }

.live-teams {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-weight: 500;
}
.live-score {
  color: var(--accent);
  font-weight: 700;
  margin-inline: 0.25rem;
}
.live-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 0.1rem;
}
.no-data-sm {
  color: var(--text-muted);
  font-size: 0.9375rem;
  padding: 1rem 0;
}
.see-all-link {
  display: inline-block;
  margin-top: 0.875rem;
  font-size: 0.875rem;
  color: var(--primary-h);
  font-weight: 500;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,.55);
  text-align: center;
  padding: 1.25rem 0;
  font-size: 0.875rem;
  margin-top: auto;
}

/* ============================================================
   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); }
.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;
}
