/* ============================================================
   Vui Cùng World Cup — Internal Prediction App
   Dark sport dashboard · red accent · Saira Condensed + Be Vietnam Pro
   ============================================================ */

:root {
  /* surfaces */
  --bg:        #0b0c10;
  --bg-2:      #101218;
  --surface:   #16191f;
  --surface-2: #1c2027;
  --card:      #181b22;
  --raise:     #20242c;
  --line:      rgba(255,255,255,0.075);
  --line-2:    rgba(255,255,255,0.13);

  /* text */
  --txt:    #f3f4f7;
  --txt-2:  #aab1bd;
  --txt-3:  #6b7280;

  /* brand + status */
  --red:      #e0383b;
  --red-hi:   #ff4d50;
  --red-deep: #b32629;
  --green:    #19c37d;
  --green-dim:#0e7a4f;
  --neg:      #ff5d5d;
  --gold:     #f2b339;
  --gold-dim: #8a6418;
  --blue:     #4a8cff;

  /* glows */
  --glow-red: 0 0 0 1px rgba(224,56,59,.4), 0 8px 30px -8px rgba(224,56,59,.55);

  --shadow-card: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 30px -16px rgba(0,0,0,.8);
  --shadow-pop:  0 24px 60px -20px rgba(0,0,0,.85);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --ease: cubic-bezier(.22,.61,.36,1);

  --font-body: 'Be Vietnam Pro', system-ui, sans-serif;
  --font-disp: 'Saira Condensed', 'Be Vietnam Pro', sans-serif;
  --font-num:  'Saira', 'Be Vietnam Pro', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; max-width: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

#root { height: 100vh; }

::selection { background: var(--red); color: #fff; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #2a2f38; border-radius: 20px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #3a4150; }

/* ---------- display / number helpers ---------- */
.disp { font-family: var(--font-disp); font-weight: 700; letter-spacing: .01em; line-height: .96; }
.num  { font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.up   { text-transform: uppercase; letter-spacing: .06em; }
.mono { font-family: 'Saira', monospace; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  min-width: 0;
  background:
    radial-gradient(1100px 520px at 80% -10%, rgba(224,56,59,.10), transparent 60%),
    var(--bg);
}

/* ---------- sidebar ---------- */
.side {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  gap: 6px;
  z-index: 20;
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(145deg, var(--red-hi), var(--red-deep));
  display: grid; place-items: center;
  box-shadow: var(--glow-red);
  flex: none;
}
.brand-mark svg { width: 22px; height: 22px; }
.scrim { display: none; }
.brand-name { font-family: var(--font-disp); font-weight: 700; font-size: 20px; line-height: .9; }
.brand-name span { color: var(--red-hi); }
.brand-sub { font-size: 10.5px; color: var(--txt-3); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }

.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--txt-3); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 11px;
  color: var(--txt-2); cursor: pointer;
  font-size: 14.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .18s, color .18s;
  position: relative;
  min-height: 44px;
  min-width: 0;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item span:not(.nav-badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface); color: var(--txt); }
.nav-item.active { background: var(--surface-2); color: #fff; border-color: var(--line); }
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--red-hi);
}
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--red); color: #fff; padding: 1px 7px; border-radius: 20px; }

.side-foot { margin-top: auto; }
.user-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 10px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
  min-width: 0;
}
.user-chip:hover { border-color: var(--line-2); }
.avatar {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-family: var(--font-disp); font-weight: 700; font-size: 17px; color: #fff;
  background: linear-gradient(145deg, #2b3340, #1b212b); border: 1px solid var(--line-2);
}
.user-chip .nm { font-size: 13.5px; font-weight: 600; line-height: 1.1; }
.user-chip .dp { font-size: 11px; color: var(--txt-3); margin-top: 2px; }

/* ---------- main column ---------- */
.main { overflow-y: auto; overflow-x: hidden; height: 100vh; scroll-behavior: smooth; min-width: 0; }
.main-inner { max-width: 1180px; margin: 0 auto; padding: 26px 34px 120px; min-width: 0; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 34px;
  background: linear-gradient(180deg, rgba(11,12,16,.95), rgba(11,12,16,.72));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.topbar h1 { font-family: var(--font-disp); font-weight: 700; font-size: 27px; letter-spacing: .01em; white-space: nowrap; min-width: 0; max-width: 100%; }
.topbar .sub { font-size: 12.5px; color: var(--txt-3); margin-top: 1px; }
.topbar-spacer { flex: 1; }

.pill-stat {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 11px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--line);
  min-width: 0;
  flex: none;
}
.pill-stat .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.pill-stat .k { font-size: 10.5px; color: var(--txt-3); text-transform: uppercase; letter-spacing: .07em; line-height: 1; }
.pill-stat .v { font-family: var(--font-num); font-weight: 700; font-size: 18px; line-height: 1.1; margin-top: 2px; }

/* ============================================================
   GENERIC: cards, badges, buttons
   ============================================================ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.card-pad { padding: 20px 22px; }

.section-head { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; }
.section-head h2 { font-family: var(--font-disp); font-weight: 700; font-size: 22px; letter-spacing: .015em; white-space: nowrap; }
.section-head .ln { flex: 1; height: 1px; background: var(--line); }
.section-head a, .link {
  font-size: 13px; color: var(--txt-2); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.section-head a:hover, .link:hover { color: var(--red-hi); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--line-2);
}
.badge-live { color: #fff; background: var(--red); border-color: transparent; }
.badge-live .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.3s infinite; }
.badge-open { color: var(--green); background: rgba(25,195,125,.12); border-color: rgba(25,195,125,.3); }
.badge-lock { color: var(--txt-3); background: rgba(255,255,255,.04); }
.badge-soon { color: var(--gold); background: rgba(242,179,57,.1); border-color: rgba(242,179,57,.28); }
.badge-done { color: var(--txt-2); background: rgba(255,255,255,.05); }
.badge-star { color: var(--gold); background: rgba(242,179,57,.13); border-color: rgba(242,179,57,.35); }
.badge-ghost { color: var(--txt-2); background: transparent; }

@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .35; transform: scale(.8);} }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px;
  padding: 12px 20px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s var(--ease), background .18s, box-shadow .18s, border-color .18s;
  white-space: nowrap; user-select: none;
  min-height: 44px;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 8px 24px -10px rgba(224,56,59,.8); }
.btn-primary:hover { background: var(--red-hi); }
.btn-primary:disabled { background: #2a2d34; color: var(--txt-3); box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--txt); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--txt-3); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 16px; }

/* ============================================================
   FLAGS / TEAM BITS
   ============================================================ */
.flag {
  border-radius: 6px; object-fit: cover; flex: none;
  border: 1px solid var(--line-2); background: var(--surface-2);
  box-shadow: 0 2px 8px -3px rgba(0,0,0,.6);
}
.flag-round { border-radius: 50%; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; max-width: 100%; }
.tab {
  flex: 1; text-align: center; padding: 9px 14px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--txt-2); cursor: pointer;
  white-space: nowrap; transition: background .15s, color .15s;
}
.tab:hover { color: var(--txt); }
.tab.active { background: var(--raise); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }

/* segmented (rounds) */
.seg { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.seg::-webkit-scrollbar { height: 0; }
.seg-item {
  padding: 8px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--txt-2); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface);
}
.seg-item:hover { color: var(--txt); border-color: var(--line-2); }
.seg-item.active { background: #fff; color: #111; border-color: #fff; }

/* points text */
.pts-pos { color: var(--green); }
.pts-neg { color: var(--neg); }
.pts-zero { color: var(--txt-3); }

/* misc utility */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap6{gap:6px}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap16{gap:16px}.gap20{gap:20px}.gap24{gap:24px}
.grow { flex: 1; }
.muted { color: var(--txt-2); }
.muted3 { color: var(--txt-3); }
.center { display: grid; place-items: center; }

.fade-in { animation: fadeUp .4s var(--ease); }
@keyframes fadeUp { from { transform: translateY(8px);} to { transform: none;} }
.stagger > * { animation: fadeUp .42s var(--ease); }

/* ============================================================
   MOBILE
   ============================================================ */
.mobile-bar { display: none; }
.menu-btn { display: none; }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(270px, calc(100vw - 24px));
    transform: translateX(-100%); transition: transform .28s var(--ease);
    box-shadow: var(--shadow-pop);
    overflow-y: auto;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
  .app.menu-open .side { transform: none; }
  .scrim { display: none; }
  .app.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 18; }
  .menu-btn { display: grid; }
  .main-inner { padding: 18px 16px 110px; }
  .topbar { padding: 13px 16px; gap: 10px; }
  .topbar h1 { font-size: 21px; overflow: hidden; text-overflow: ellipsis; }
  .topbar .sub { display: none; }
  .adm-tag { display: none; }
  .app.admin .topbar .pill-stat > div:last-child { display: none; }
  .app.admin .topbar .pill-stat { padding: 7px; }

  .mobile-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: rgba(13,14,19,.92); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line); padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }
  .mb-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 6px 2px; color: var(--txt-3); cursor: pointer; font-size: 10.5px; font-weight: 600;
    min-width: 0;
  }
  .mb-item svg { width: 22px; height: 22px; }
  .mb-item.active { color: var(--red-hi); }
}

@media (max-width: 680px) {
  .section-head { align-items: flex-start; flex-wrap: wrap; row-gap: 8px; }
  .section-head h2 { white-space: normal; }
  .section-head .ln { min-width: 40px; }
  .section-head a, .link { min-height: 32px; }
}

@media (max-width: 600px) {
  .topbar { gap: 8px; }
  .pill-stat { padding: 7px 11px 7px 9px; gap: 7px; }
  .pill-stat .k { display: none; }
  .pill-stat .ic { width: 26px; height: 26px; }
  .tabs { overflow-x: auto; }
  .tabs::-webkit-scrollbar { height: 0; }
  .tab { flex: 0 0 auto; min-width: max-content; }
}

@media (max-width: 380px) {
  .topbar h1 { font-size: 19px; }
}
