/* ============ کی برد؟ — SofaScore light theme ============ */
:root {
  --bg: #edf1f6;        /* light gray page (SofaScore light) */
  --card: #ffffff;      /* white surface */
  --card2: #f3f5f9;     /* raised/header surface */
  --accent: #12a34a;    /* SofaScore green (ratings / correct) */
  --accent-2: #0561c4;  /* SofaScore blue (header, links, active tab) */
  --violet: #7c5cff;
  --gold: #d99a06;
  --live: #e5484d;      /* live matches */
  --text: #1a2333;
  --muted: #6b7689;
  --border: #e2e7ef;
  --glow: 0 6px 18px -8px rgba(5, 97, 196, .45);
}
html, body { background: var(--bg); }
body { background: var(--bg) !important; color: var(--text); }

/* ---- top app bar: solid SofaScore blue ---- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--accent-2);
  border-bottom: none;
  box-shadow: 0 2px 10px -4px rgba(5, 97, 196, .5);
}
.ab-brand { display: flex; align-items: center; gap: 10px; }
.ab-logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 19px; background: rgba(255, 255, 255, .18);
}
.ab-title { font-size: 18px; font-weight: 800; letter-spacing: -.4px; line-height: 1; color: #fff; }
.ab-title b { color: #fff; }
.ab-sub { font-size: 10.5px; color: rgba(255, 255, 255, .75); margin-top: 4px; letter-spacing: .3px; }

.ab-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 6px 8px 6px 14px; font-size: 12.5px; color: #fff;
  min-width: 0; white-space: nowrap; text-decoration: none;
}
.user-chip b { color: #fff; }
.user-chip button { background: none; border: none; color: #ffd9d9; cursor: pointer; font-family: inherit; font-size: 12.5px; }

/* compact single-row appbar on phones */
@media (max-width: 600px) {
  .appbar { padding: 8px 12px; gap: 8px; }
  .ab-brand { gap: 8px; min-width: 0; }
  .ab-logo { width: 30px; height: 30px; border-radius: 9px; }
  .ab-logo .ni-svg { width: 17px; height: 17px; }
  .ab-title { font-size: 15.5px; white-space: nowrap; }
  .ab-sub { display: none; }
  .theme-btn { width: 30px; height: 30px; border-radius: 9px; margin-inline-start: 0; flex: 0 0 auto; }
  .theme-btn svg { width: 15px; height: 15px; }
  .user-chip { padding: 5px 7px 5px 11px; font-size: 11.5px; gap: 6px; }
  .user-chip > .ni-svg { display: none; }
  .user-chip b { overflow: hidden; text-overflow: ellipsis; max-width: 96px; }
  .user-chip button { font-size: 11px; padding: 0 0 0 2px; margin-inline-start: 2px; border-inline-start: 1px solid rgba(255,255,255,.28); padding-inline-start: 8px; }
}

/* ---- bottom navigation (white, blue active — SofaScore-like) ---- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: flex; padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px -6px rgba(20, 35, 60, .15);
}
.navitem[hidden] { display: none !important; }
.navitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; color: var(--muted); font-family: inherit; font-size: 11px;
  padding: 10px 4px calc(10px + env(safe-area-inset-bottom, 0px)); cursor: pointer; text-decoration: none;
  position: relative; transition: color .18s;
}
.navitem .ni-ic { font-size: 21px; filter: grayscale(1) opacity(.6); transition: filter .18s, transform .18s; }
.navitem.active { color: var(--accent-2); font-weight: 700; }
.navitem.active .ni-ic { filter: none; transform: translateY(-1px); }
.navitem.active::before {
  content: ''; position: absolute; top: 0; width: 40px; height: 3px; border-radius: 0 0 4px 4px;
  background: var(--accent-2);
}
/* hand-made SVG icons (no emoji) */
.ni-svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s; }
.navitem.active .ni-svg { transform: translateY(-1px); }
.ab-logo .ni-svg, .auth-logo .ni-svg { stroke: #fff; }

/* ---- desktop: floating centered dock (mobile keeps full-width bottom bar) ---- */
@media (min-width: 1024px) {
  .bottomnav {
    left: 50%; right: auto; transform: translateX(-50%); bottom: 18px;
    width: auto; border-radius: 999px; border: 1px solid var(--border);
    padding: 5px 6px; gap: 4px;
    box-shadow: 0 14px 38px -14px rgba(20, 35, 60, .4);
  }
  .navitem { flex: 0 0 auto; flex-direction: row; gap: 8px; padding: 10px 22px; border-radius: 999px; font-size: 13px; }
  .navitem.active { background: var(--accent-2); color: #fff; }
  .navitem.active::before { display: none; }
  .navitem.active .ni-svg { stroke: #fff; transform: none; }
}

/* ---- login overlay (light, blue primary) ---- */
.auth-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--bg); }
.auth-card { background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; max-width: 380px; width: 100%; padding: 30px 24px; text-align: center; box-shadow: 0 20px 50px -24px rgba(20, 35, 60, .35); }
.auth-logo { width: 58px; height: 58px; margin: 0 auto 6px; border-radius: 16px; display: grid; place-items: center; font-size: 30px;
  background: var(--accent-2); box-shadow: var(--glow); }
.auth-card h2 { font-size: 24px; font-weight: 800; margin: 10px 0 4px; }
.auth-card h2 span { color: var(--accent-2); }
.auth-field { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 14px; font-family: inherit; font-size: 16px; text-align: center; letter-spacing: 1px; }
.auth-field:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(74, 125, 255, .18); }
.auth-btn { width: 100%; margin-top: 12px; border: none; color: #fff; font-weight: 800; font-family: inherit; font-size: 15px;
  padding: 14px; border-radius: 12px; cursor: pointer; background: var(--accent-2); box-shadow: 0 10px 24px -12px var(--accent-2); }
.auth-btn:disabled { opacity: .55; cursor: progress; }
.auth-otp { letter-spacing: 10px; font-size: 24px; }

/* ================= DARK THEME ================= */
[data-theme="dark"] {
  --bg: #0e1117;
  --card: #161b26;
  --card2: #1f2634;
  --accent: #2fc76d;
  --accent-2: #4a8dff;
  --violet: #8b6cff;
  --gold: #e8b13f;
  --live: #ff5c5c;
  --text: #eaeef7;
  --muted: #8a93a8;
  --border: #28303f;
  --glow: 0 6px 18px -8px rgba(74, 141, 255, .5);
  --line: #333d50;
}
/* appbar keeps brand blue in both themes; slightly deeper in dark */
[data-theme="dark"] .appbar { background: #0b4e9d; }
/* component fixes where light hexes were hardcoded */
[data-theme="dark"] .pbadge.ok { background: rgba(47,199,109,.14); color: #5fdd94; border-color: rgba(47,199,109,.35); }
[data-theme="dark"] .pbadge.no { background: rgba(255,92,92,.12); color: #ff9a9a; border-color: rgba(255,92,92,.3); }
[data-theme="dark"] .plan-cta.free, [data-theme="dark"] .ac-ok { background: rgba(47,199,109,.12); color: #6fe0a0; border-color: rgba(47,199,109,.3); }
[data-theme="dark"] .plan-badge.xpay, [data-theme="dark"] .b-xpay { background: rgba(47,199,109,.14); color: #5fdd94; border-color: rgba(47,199,109,.35); }
[data-theme="dark"] .plan-badge.pro, [data-theme="dark"] .b-pro { background: rgba(74,141,255,.15); color: #8ab2ff; border-color: rgba(74,141,255,.35); }
[data-theme="dark"] .plan-badge.none, [data-theme="dark"] .b-none { background: var(--card2); color: var(--muted); border-color: var(--border); }
[data-theme="dark"] .b-admin { background: rgba(232,177,63,.14); color: #ecc36a; border-color: rgba(232,177,63,.35); }
[data-theme="dark"] .actual-banner.grade-exact, [data-theme="dark"] .actual-banner.grade-ok { background: rgba(47,199,109,.1); border-color: rgba(47,199,109,.3); }
[data-theme="dark"] .actual-banner.grade-miss { background: rgba(255,92,92,.09); border-color: rgba(255,92,92,.28); }
[data-theme="dark"] .cmp-r .no { color: #ff9a9a; }
[data-theme="dark"] .acard p { color: #b9c2d4; }
[data-theme="dark"] #auth-testbox { background: rgba(232,177,63,.12) !important; border-color: rgba(232,177,63,.35) !important; color: #ecc36a !important; }
[data-theme="dark"] .ncard::before { opacity: .8; }
[data-theme="dark"] .badge-tag { background: var(--card2); }
[data-theme="dark"] .badge-tag.risk { background: rgba(255,92,92,.1); border-color: rgba(255,92,92,.3); }
[data-theme="dark"] .nsrc { background: rgba(47,199,109,.14); color: #5fdd94; border-color: rgba(47,199,109,.35); }

/* ---- theme toggle button (hand-drawn sun/moon) ---- */
.theme-btn { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }
.theme-btn svg { width: 17px; height: 17px; stroke: #fff; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .ic-moon { display: none; }
[data-theme="dark"] .theme-btn .ic-sun { display: none; }
[data-theme="dark"] .theme-btn .ic-moon { display: block; }
