/* ============================================================
   Family Super 6 — Styles
   ============================================================ */

:root {
  --primary: #0084ff;
  --accent: #ff6b6b;
  --success: #51cf66;
  --warning: #ffd43b;
  --danger: #ff6b6b;
  --muted: #999;
  --border: #e0e0e0;
  --bg-light: #f8f9fa;
  --bg-dark: #1a1a1a;
  --text: #333;
  --text-light: #666;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: #fff;
  line-height: 1.6;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 600; margin-bottom: 0.5rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p  { margin-bottom: 1rem; }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
body { display: flex; flex-direction: column; min-height: 100vh; }

main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  min-height: 58px;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
  padding: 0.75rem 0;
}
.nav-logo span { color: var(--accent); }

/* ── Hamburger button ───────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;           /* hidden on desktop */
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  z-index: 200;
}

.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Animate to X when open */
.nav-hamburger.is-open span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.nav-hamburger.is-open span:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.is-open span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ── Nav menu (desktop) ─────────────────────────────────────────────────── */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 1;
  justify-content: flex-end;  /* push links + user to the right */
}

nav ul {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

nav ul a {
  color: var(--text-light);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  display: block;
}

nav ul a:hover,
nav ul a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  text-decoration: none;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-user-name { font-size: 0.9rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,0.1); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0066cc; color: #fff; text-decoration: none; }

.btn-secondary { background: var(--bg-light); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #ececec; text-decoration: none; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-full { width: 100%; text-align: center; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,132,255,0.1);
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-right: 0.4rem;
  cursor: pointer;
}

/* ── Form grid helpers ──────────────────────────────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}
.alert-error, .alert-danger { background: #ffe0e0; border-color: var(--danger); color: #c92a2a; }
.alert-success              { background: #e7f5e7; border-color: var(--success); color: #2d6a2f; }
.alert-info                 { background: #e3f2fd; border-color: var(--primary); color: #1565c0; }
.alert-warning              { background: #fff3e0; border-color: var(--warning); color: #e65100; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-light); }
th { padding: 0.8rem; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 0.8rem; border-bottom: 1px solid var(--border); }
tr:hover { background: var(--bg-light); }
.text-right  { text-align: right; }
.text-center { text-align: center; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: #c3fac3; color: #1b5e1f; }
.badge-yellow { background: #fff3bf; color: #995a00; }
.badge-red    { background: #ffcccb; color: #990000; }
.badge-blue   { background: #bde7ff; color: #0066cc; }

/* ── Page Header ────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.page-header h1 span { color: var(--accent); }
.page-header p { color: var(--muted); font-size: 1.1rem; margin: 0; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}
.login-box {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-size: 2.5rem; color: var(--primary); }
.login-logo h1 span { color: var(--accent); }
.login-logo p { color: var(--muted); font-size: 0.95rem; margin: 0.5rem 0 0; }

/* ── Stats Bar ──────────────────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-item {
  background: linear-gradient(135deg, var(--primary) 0%, rgba(0,132,255,0.8) 100%);
  color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.stat-label { font-size: 0.9rem; opacity: 0.9; }

/* ── Deadline Banner ────────────────────────────────────────────────────── */
.deadline-banner {
  background: linear-gradient(135deg, var(--bg-light) 0%, #f5f5f5 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.deadline-banner .label { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.deadline-banner .time  { font-size: 1.2rem; font-weight: 600; color: var(--text); }

/* ── Home Grid ──────────────────────────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.home-link-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s ease;
}
.home-link-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,132,255,0.1);
  text-decoration: none;
}
.home-link-card .icon { font-size: 2.5rem; margin-bottom: 1rem; display: block; }
.home-link-card h2 { color: var(--text); margin-bottom: 0.5rem; }
.home-link-card p  { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* ── Match Cards ────────────────────────────────────────────────────────── */
.match-card {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.match-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.match-card.correct { border-color: var(--success); background: rgba(81,207,102,0.05); }
.match-card.result  { border-color: var(--warning); background: rgba(255,212,59,0.05); }
.match-card.wrong   { border-color: var(--danger);  background: rgba(255,107,107,0.05); }

.team-home, .team-away { text-align: center; }
.team-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }

.match-score-display { text-align: center; }
.score-line   { font-size: 1.8rem; font-weight: 700; color: var(--text); margin-bottom: 0.3rem; }
.match-meta   { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.match-kickoff { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }

.score-input-group { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.score-input-group input { width: 60px; text-align: center; font-size: 1.2rem; font-weight: 600; }
.score-vs { font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; }

/* ── Notifications ──────────────────────────────────────────────────────── */
.notification-item {
  display: flex;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--primary);
  background: var(--bg-light);
  border-radius: 4px;
  margin-bottom: 0.75rem;
}
.notification-item.notification-goal      { border-left-color: var(--accent); }
.notification-item.notification-full_time { border-left-color: var(--success); }
.notif-icon { font-size: 1.4rem; flex-shrink: 0; }
.notif-body { flex: 1; }
.notif-msg  { margin: 0; font-weight: 500; color: var(--text); }
.notif-time { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0.25rem; margin-bottom: 2rem; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 0.85rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Leaderboard ────────────────────────────────────────────────────────── */
.rank-num  { font-weight: 700; font-size: 1.1rem; }
.rank-1    { color: #ffd700; }
.rank-2    { color: #c0c0c0; }
.rank-3    { color: #cd7f32; }
.points-display { font-weight: 700; font-size: 1.1rem; }

/* ── Admin nav ──────────────────────────────────────────────────────────── */
.admin-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

/* ── API Fixture search results ─────────────────────────────────────────── */
.api-search-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}

.api-fixture-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  background: #fff;
}
.api-fixture-row:hover {
  background: #edf5ff;
  border-color: var(--primary);
}
.api-team { font-weight: 600; font-size: 0.95rem; }
.api-team-home { text-align: right; }
.api-team-away { text-align: left; }
.api-score {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-light);
  min-width: 40px;
}
.api-meta {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
}

/* ── Flex / spacing utils ───────────────────────────────────────────────── */
.flex  { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 0.85rem; }
.text-center { text-align: center; }

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.pulse { animation: pulse 2s infinite; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet / small desktop ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Show hamburger, hide desktop menu by default */
  .nav-hamburger { display: flex; }

  .nav-menu {
    display: none;              /* hidden until toggled */
    position: absolute;
    top: 58px;                  /* flush below the nav bar */
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0 1rem;
    z-index: 100;
  }

  /* Shown when JS adds .nav-open */
  .nav-menu.nav-open { display: flex; }

  nav ul {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  nav ul li { width: 100%; }

  nav ul a {
    display: block;
    padding: 0.85rem 1.25rem;
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  nav ul a.active,
  nav ul a:hover {
    border-left-color: var(--primary);
    border-bottom-color: transparent;
    background: var(--bg-light);
  }

  .nav-user {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Page */
  main { padding: 1rem 0.75rem; }

  .page-header h1 { font-size: 1.8rem; }

  /* Stats */
  .stats-bar { grid-template-columns: repeat(2, 1fr); }

  /* Match cards */
  .match-card { grid-template-columns: 1fr; gap: 0.75rem; text-align: center; }

  /* Deadline banner */
  .deadline-banner { flex-direction: column; text-align: center; gap: 0.75rem; }

  /* Forms */
  .form-grid-2,
  .form-grid-3 { grid-template-columns: 1fr; }

  /* Tables */
  table { font-size: 0.85rem; }
  th, td { padding: 0.55rem 0.5rem; }

  /* API search */
  .api-search-bar { flex-direction: column; }
  .api-fixture-row {
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
  }
  .api-meta { grid-column: 1 / -1; text-align: left; }

  /* Login */
  .login-box { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .page-header h1 { font-size: 1.5rem; }
  .stats-bar { grid-template-columns: 1fr; }
  .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
  .score-input-group input { width: 48px; }
  .login-logo h1 { font-size: 2rem; }
}
