/* ================================================================
   aiSnooker.app — Shared Design System
   All pages import this file.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Exo+2:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ───────────────────────────────────────────────── */
:root {
  --green:      #1db954;
  --green-d:    #0e8c3a;
  --green-l:    #4eff8c;
  --green-lo:   rgba(29,185,84,0.10);
  --green-glow: 0 0 28px rgba(29,185,84,0.30);
  --gold:       #f5c518;
  --gold-lo:    rgba(245,197,24,0.12);
  --red:        #e53935;
  --red-lo:     rgba(229,57,53,0.12);
  --blue:       #60a5fa;
  --white:      #f0f4f0;
  --off:        #8a9e8a;
  --bg:         #060d06;
  --bg2:        #0a140a;
  --bg3:        #0f1c0f;
  --panel:      #111a11;
  --panel2:     #162016;
  --border:     rgba(29,185,84,0.16);
  --border2:    rgba(255,255,255,0.08);
  --radius:     10px;
  --radius-sm:  6px;
  --nav-h: 80px;
  --font:       'Exo 2', sans-serif;
  --font-head:  'Rajdhani', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── SHARED NAV ───────────────────────────────────────────── */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(6,13,6,0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.nav-brand-logo {
  height: 72px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;   /* makes black bg transparent on dark nav */
}
.nav-brand-text { display: none; }  /* logo already contains the name */
.nav-brand-sub {
  font-size: 0.68rem; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--off); margin-top: 2px;
}

.nav-links {
  display: flex; align-items: center; gap: 6px; list-style: none;
}
.nav-links a {
  padding: 6px 14px; border-radius: var(--radius-sm);
  color: var(--off); text-decoration: none;
  font-size: 0.88rem; font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--white); background: var(--green-lo);
}

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none;
  transition: all 0.18s; white-space: nowrap;
}
.btn-primary {
  background: var(--green); color: #000;
  box-shadow: 0 3px 16px rgba(29,185,84,0.28);
}
.btn-primary:hover { background: var(--green-l); transform: translateY(-1px); }

.btn-outline {
  background: transparent; color: var(--white);
  border: 1px solid var(--border2);
}
.btn-outline:hover { border-color: var(--green); color: var(--green); background: var(--green-lo); }

.btn-ghost {
  background: var(--panel2); color: var(--white);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--green); background: var(--green-lo); }

.btn-danger {
  background: var(--red-lo); color: #fca5a5;
  border: 1px solid rgba(229,57,53,0.35);
}
.btn-danger:hover { background: rgba(229,57,53,0.22); }

.btn-sm { padding: 6px 13px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }

/* ── PAGE WRAPPER ─────────────────────────────────────────── */
.page-body {
  padding-top: var(--nav-h);
  min-height: 100vh;
}
.container {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
}
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.container-xs { max-width: 480px; margin: 0 auto; padding: 0 24px; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card:hover { border-color: rgba(29,185,84,0.28); }
.card-flat { background: var(--panel2); border-radius: var(--radius); padding: 20px 22px; }

/* ── SECTION LABELS ───────────────────────────────────────── */
.section-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 3px;
  color: var(--green); text-transform: uppercase;
  margin-bottom: 10px;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.1; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
.text-green  { color: var(--green); }
.text-gold   { color: var(--gold); }
.text-off    { color: var(--off); }
.text-mono   { font-family: var(--font-mono); }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--off); letter-spacing: 0.4px; margin-bottom: 7px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--panel2); border: 1px solid var(--border);
  color: var(--white); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.93rem;
  outline: none; transition: border-color 0.2s;
  appearance: none;
}
.form-control:focus { border-color: var(--green); }
.form-control::placeholder { color: rgba(255,255,255,0.22); }
.form-control option { background: var(--panel2); }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.badge-green { background: var(--green-lo); color: var(--green); border: 1px solid var(--border); }
.badge-gold  { background: var(--gold-lo);  color: var(--gold);  border: 1px solid rgba(245,197,24,0.25); }
.badge-red   { background: var(--red-lo);   color: #fca5a5;      border: 1px solid rgba(229,57,53,0.3); }
.badge-live  { background: var(--green-lo); color: var(--green); border: 1px solid var(--border); }
.badge-live::before {
  content: ''; width: 6px; height: 6px; background: var(--green);
  border-radius: 50%; animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.4; transform:scale(0.7); }
}

/* ── DIVIDER ──────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.78rem; color: var(--off); margin: 18px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 0.88rem; display: none;
}
.alert-error   { background: var(--red-lo); border: 1px solid rgba(229,57,53,0.3); color: #fca5a5; }
.alert-success { background: var(--green-lo); border: 1px solid var(--border); color: var(--green); }
.alert.show { display: block; }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
  padding: 36px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.page-header-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.page-title { margin-bottom: 4px; }
.page-subtitle { color: var(--off); font-size: 0.92rem; line-height: 1.5; }

/* ── FOOTER ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 28px;
  margin-top: 60px;
}
.site-footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  font-size: 0.82rem; color: var(--off);
}
.site-footer-brand {
  display: flex; align-items: center; gap: 9px;
}
.site-footer-brand img { height: 28px; opacity: 0.7; }

/* ── SCOREBOARD SUB-NAV ───────────────────────────────────── */
.sb-subnav {
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid var(--border2);
  padding: 0 24px;
}
.sb-subnav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; gap: 2px; align-items: center; height: 42px;
  overflow-x: auto; scrollbar-width: none;
}
.sb-subnav-inner::-webkit-scrollbar { display: none; }
.sb-nav-link {
  padding: 6px 13px; border-radius: 6px;
  font-size: 0.83rem; font-weight: 600; text-decoration: none;
  color: rgba(255,255,255,0.55); white-space: nowrap;
  transition: all 0.18s;
}
.sb-nav-link:hover { color: var(--white); background: rgba(255,255,255,0.07); }
.sb-nav-link.active { background: rgba(255,255,255,0.13); color: var(--white); }

/* ── MATCH CARD ───────────────────────────────────────────── */
.match-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.match-card:hover { border-color: rgba(29,185,84,0.3); }
.match-card-players {
  font-family: var(--font-head); font-size: 1.05rem; font-weight: 600;
  margin-bottom: 5px;
}
.match-card-players .pa { color: var(--blue); }
.match-card-players .pb { color: var(--gold); }
.match-card-meta { font-size: 0.8rem; color: var(--off); line-height: 1.6; }
.match-card-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.match-card-score {
  font-family: var(--font-mono); font-size: 1.1rem;
  color: var(--white); letter-spacing: 1px;
}

/* ── TABLE GROUP HEADER ───────────────────────────────────── */
.table-group-head {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--green);
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 8px;
}
.table-group-head::after {
  content: ''; flex: 1; height: 1px; background: rgba(29,185,84,0.15);
}

/* ── MODAL ────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 9000; display: none; }
.modal.open { display: block; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.65);
}
.modal-card {
  position: relative; z-index: 2;
  width: min(540px, calc(100vw - 24px));
  margin: 60px auto;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--off);
  font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 2px 6px;
  border-radius: 4px; transition: color 0.2s;
}
.modal-close:hover { color: var(--white); }
.modal-body { padding: 18px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 0 18px 18px;
}

/* ── UTILITIES ────────────────────────────────────────────── */
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.mb-2   { margin-bottom: 8px; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ── RESPONSIVE ───────────────────────────────────────────── */

/* ── Stat cards ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color .18s;
}
.stat-card:hover { border-color: rgba(29,185,84,.3); }
.stat-card .sv {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .sl {
  font-size: .72rem;
  color: var(--off);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat-card .sh {
  font-size: .68rem;
  color: var(--off);
  margin-top: 3px;
  line-height: 1.3;
}
.sv.green { color: var(--green); }
.sv.gold  { color: var(--gold); }
.sv.blue  { color: #60a5fa; }

@media (max-width: 700px) {
  .site-nav { padding: 0 16px; }
  .nav-links { display: none; }
  .container, .container-sm, .container-xs { padding: 0 14px; }
  .hide-mobile { display: none !important; }
  h1 { font-size: 2rem; }
}

/* ── Hamburger (mobile nav) ──────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--white); border-radius: 2px;
  transition: all .25s; transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-mob-only { display: none; }

@media (max-width: 700px) {
  .site-nav { flex-wrap: wrap; position: relative; }
  .nav-hamburger { display: flex; }
  .nav-actions { display: none !important; }
  .nav-mob-only { display: block; }

  /* Dropdown panel — floats over page content */
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    z-index: 300;
    background: #fff;
    border-bottom: 3px solid var(--green);
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    padding: 8px 0;
    order: 3;
  }
  .nav-links.nav-open { display: flex; }

  .nav-links li { width: 100%; list-style: none; }

  .nav-links a {
    display: block;
    padding: 14px 24px;
    color: #1a1a1a;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background .12s;
  }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links a:hover,
  .nav-links a.active {
    background: #f0fdf4;
    color: #16a34a;
  }

  /* Sign out / admin inside menu */
  .nav-mob-only a {
    color: #555;
    font-weight: 500;
  }
  .nav-mob-only a[href*="logout"] {
    color: #dc2626;
  }
  /* Username label in menu */
  .nav-mob-only span {
    padding: 10px 24px 2px;
    display: block;
    font-size: .78rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 1px solid #f0f0f0;
  }
}
