/* =============================================================================
   BRICKLAND-TENGAH BADMINTON PLATFORM — Shared Stylesheet
   style.css
   ============================================================================= */

/* ── Variables ───────────────────────────────────────────────────────────────── */
:root {
  --primary:        #1a5c2e;
  --primary-dark:   #0f3d1e;
  --primary-light:  #2d7a3e;
  --accent:         #4caf50;
  --bg:             #f4f7f5;
  --white:          #ffffff;
  --text:           #1a1a1a;
  --text-muted:     #666666;
  --border:         #dde5df;
  --shadow:         0 2px 8px rgba(0,0,0,0.08);
  --radius:         10px;
  --radius-sm:      6px;
  --nav-height:     60px;

  /* Status colours */
  --open:       #1a7a3c;
  --open-bg:    #e8f5e9;
  --locked:     #757575;
  --locked-bg:  #f5f5f5;
  --full:       #c0392b;
  --full-bg:    #fdecea;
  --cancelled:  #b71c1c;
  --cancelled-bg: #ffebee;
  --completed:  #555;
  --completed-bg: #eeeeee;
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Navigation ──────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--primary);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.nav-brand {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
}
.nav-toggle { display: none; background: none; border: none; cursor: pointer; color: #fff; font-size: 22px; }

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 700; color: var(--primary); }
.page-header p  { color: var(--text-muted); margin-top: 4px; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--primary); }

/* ── Session Grid ────────────────────────────────────────────────────────────── */
.week-block { margin-bottom: 32px; }
.week-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.session-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.session-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.session-card.is-cancelled { opacity: 0.55; }
.session-date-row { display: flex; justify-content: space-between; align-items: flex-start; }
.session-date { font-weight: 700; font-size: 16px; color: var(--text); }
.session-day  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.session-time { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.session-venue { font-size: 12px; color: var(--text-muted); }
.session-level { display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; background: #e8f5e9; color: var(--primary); }

/* ── Status Badge ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-open      { background: var(--open-bg);      color: var(--open);      }
.badge-locked    { background: var(--locked-bg);    color: var(--locked);    }
.badge-full      { background: var(--full-bg);      color: var(--full);      }
.badge-cancelled { background: var(--cancelled-bg); color: var(--cancelled); }
.badge-completed { background: var(--completed-bg); color: var(--completed); }
.badge-closed    { background: var(--locked-bg);    color: var(--locked);    }

/* ── Slot Progress Bar ───────────────────────────────────────────────────────── */
.slot-info { font-size: 13px; color: var(--text-muted); }
.slot-count { font-weight: 600; color: var(--text); }
.progress-bar { background: #e8ede9; border-radius: 4px; height: 6px; margin-top: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.3s; }
.progress-fill.is-full { background: var(--full); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-align: center;
  width: 100%;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger    { background: #c0392b; color: #fff; }
.btn-danger:hover  { background: #a93226; }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: #e8f5e9; }
.btn-muted     { background: #eee; color: var(--text-muted); }
.btn-muted:hover   { background: #e0e0e0; }
.btn-sm        { padding: 6px 12px; font-size: 13px; width: auto; }
.btn:disabled  { opacity: 0.45; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
  appearance: none;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert-error   { background: #fdecea; color: #c0392b; border-left: 4px solid #c0392b; }
.alert-success { background: #e8f5e9; color: #1a7a3c; border-left: 4px solid #1a7a3c; }
.alert-info    { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1565c0; }
.alert-warning { background: #fff8e1; color: #f57f17; border-left: 4px solid #f57f17; }

/* ── Tier Badge ──────────────────────────────────────────────────────────────── */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── Leaderboard Table ───────────────────────────────────────────────────────── */
.lb-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.lb-tab {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  transition: all 0.15s;
}
.lb-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { background: var(--primary); color: #fff; padding: 10px 12px;
  font-size: 13px; text-align: left; }
.lb-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.lb-table tr:hover td { background: #f9fdf9; }
.lb-rank { font-weight: 700; color: var(--text-muted); width: 36px; text-align: center; }
.lb-rank.top-3 { color: var(--primary); font-size: 16px; }
.lb-name { font-weight: 600; }
.stat-muted { color: var(--text-muted); font-size: 13px; }

/* ── Admin ───────────────────────────────────────────────────────────────────── */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--border); }
.admin-tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.session-admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.session-admin-info { flex: 1; }
.session-admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.match-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.match-teams { font-weight: 600; margin-bottom: 4px; }
.match-meta  { font-size: 13px; color: var(--text-muted); }

/* ── Member Info Block ───────────────────────────────────────────────────────── */
.member-card {
  background: #f4f7f5;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
}
.member-name { font-weight: 700; font-size: 17px; }
.member-meta { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Loading Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}
.spinner::before {
  content: '';
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PIN Gate ────────────────────────────────────────────────────────────────── */
.pin-gate {
  max-width: 360px;
  margin: 80px auto;
  text-align: center;
}
.pin-gate h2 { font-size: 22px; margin-bottom: 8px; color: var(--primary); }
.pin-gate p  { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 20px;
  font-size: 13px;
  margin-top: 60px;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links { display: none; flex-direction: column; position: absolute;
    top: var(--nav-height); left: 0; right: 0; background: var(--primary-dark); padding: 12px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .sessions-grid { grid-template-columns: 1fr; }
  .lb-tabs { flex-wrap: wrap; }
  .admin-tabs { flex-wrap: wrap; }
  .session-admin-row { flex-direction: column; align-items: flex-start; }
  .container { padding: 16px 14px 48px; }
}
