:root {
  --bg: #f4f5f8;          /* page background (light gray) */
  --surface: #ffffff;     /* cards */
  --surface-2: #f7f9fc;   /* subtle inset */
  --text: #11223f;        /* dark navy headings/text */
  --text-secondary: #71809a;
  --accent: #1f83ff;      /* Poki-style bright blue */
  --accent-dark: #0a6ae0;
  --accent-soft: #e8f2ff;
  --gold: #ffb400;
  --silver: #aab4c2;
  --bronze: #d08a4f;
  --teal: #15c5c0;
  --purple: #9b6cff;
  --line: #eceef3;
  --shadow: 0 6px 24px rgba(17, 34, 63, 0.06);
  --shadow-hover: 0 12px 30px rgba(17, 34, 63, 0.10);
}

* { font-family: "Nunito", system-ui, -apple-system, sans-serif; }

/* Arabic uses the Cairo font and right-to-left layout.
   Exclude Font Awesome icons (any element with a fa- class) so the icon
   font isn't overridden. */
[dir="rtl"] *:not([class*="fa-"]):not(.fa) {
  font-family: "Cairo", "Nunito", system-ui, sans-serif;
}
.lang-toggle { cursor: pointer; }
.dropdown-item.active { background-color: var(--accent); }

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .fw-bold { color: var(--text); letter-spacing: -0.01em; }

.text-accent { color: var(--accent) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-gold { color: var(--gold); }
.text-silver { color: var(--silver); }
.text-bronze { color: var(--bronze); }

/* ---- Navbar ---- */
.wc-navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(17, 34, 63, 0.04);
}
.wc-navbar .navbar-brand { font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; padding-top: 0; padding-bottom: 0; }
.brand-logo { height: 46px; width: auto; display: block; }
.login-logo-img { width: 200px; max-width: 70%; height: auto; }
.wc-navbar .nav-link { color: #41506b; font-weight: 700; border-radius: 10px; padding: 0.45rem 0.85rem; }
.wc-navbar .nav-link:hover { color: var(--accent); background: var(--accent-soft); }
.wc-navbar .nav-link.text-danger:hover { background: #ffeef0; }
.wc-userchip {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #d4e6ff;
  font-weight: 800;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
}

/* ---- Buttons ---- */
.btn-accent {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 800;
  border-radius: 12px;
  transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 6px 16px rgba(31, 131, 255, 0.28);
}
.btn-accent:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(31, 131, 255, 0.36); }
.btn-accent:active { transform: translateY(0); }
.btn-outline-secondary, .btn-outline-danger { border-radius: 12px; font-weight: 700; }

/* ---- Cards / panels ---- */
.wc-card {
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card-body { color: var(--text); }

/* ---- Login hero ---- */
.login-hero {
  flex: 1; min-height: calc(100vh - 80px); padding: 2rem 0;
  background:
    radial-gradient(700px 380px at 85% -5%, rgba(31, 131, 255, 0.10), transparent 60%),
    radial-gradient(620px 360px at -5% 8%, rgba(21, 197, 192, 0.10), transparent 55%);
}
.login-logo {
  width: 78px; height: 78px; border-radius: 22px;
  display: grid; place-items: center;
  font-size: 2rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #54a8ff);
  box-shadow: 0 12px 26px rgba(31, 131, 255, 0.35);
}

/* ---- Forms ---- */
.form-control, .input-group-text {
  background: var(--surface);
  border: 1px solid #dfe4ec;
  color: var(--text);
  border-radius: 12px;
}
.input-group .input-group-text { border-radius: 12px 0 0 12px; }
.input-group .form-control { border-radius: 0 12px 12px 0; }
.form-control::placeholder { color: #aab3c2; }
.form-control:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem var(--accent-soft);
  color: var(--text);
}
.input-group-text { color: var(--text-secondary); }
.score-input { width: 58px; font-size: 1.15rem; font-weight: 800; border-radius: 12px !important; text-align: center; }
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input { -moz-appearance: textfield; }

/* ---- Landing / home page ---- */
.home-hero {
  background:
    radial-gradient(700px 380px at 80% -10%, rgba(31, 131, 255, 0.12), transparent 60%),
    radial-gradient(620px 360px at -5% 10%, rgba(21, 197, 192, 0.12), transparent 55%);
  border-bottom: 1px solid var(--line);
}
.home-logo { width: 240px; max-width: 80%; height: auto; }
.step-num {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.2rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #54a8ff);
}
.feature-icon {
  flex: 0 0 auto;
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.15rem; color: var(--accent);
  background: var(--accent-soft);
}

/* ---- How it works card ---- */
.how-card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.how-card .row > div { display: flex; align-items: flex-start; }
.how-card .row > div i { margin-top: 2px; }

/* ---- Day filter ---- */
.day-filter {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.2rem 0.1rem;
  scroll-padding: 0 50%;            /* helps centering snap */
  -ms-overflow-style: none;         /* hide scrollbar (IE/Edge) */
  scrollbar-width: none;            /* hide scrollbar (Firefox) */
}
.day-filter::-webkit-scrollbar { display: none; } /* hide scrollbar (Chrome/Safari) */
.day-chip {
  flex: 0 0 auto;
  min-width: 92px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 0.5rem 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.day-chip:hover { border-color: #cfe0f5; transform: translateY(-1px); }
.day-chip .day-chip-main { display: block; font-weight: 800; color: var(--text); font-size: 0.95rem; }
.day-chip .day-chip-sub { display: block; font-size: 0.72rem; color: var(--text-secondary); font-weight: 700; }
.day-chip.active {
  background: var(--accent);
  border-color: var(--accent);
}
.day-chip.active .day-chip-main,
.day-chip.active .day-chip-sub { color: #fff; }

/* ---- Match cards ---- */
.match-card { transition: transform 0.12s ease, box-shadow 0.2s ease; }
.match-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.match-open { border-color: #cfe5ff !important; }
.match-completed { border-color: #ffe6ad !important; }

.team-flag {
  width: 48px; height: 48px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--accent);
  font-size: 1.1rem;
  overflow: hidden;
}
.flag-img { width: 44px; height: 30px; object-fit: cover; border-radius: 6px; }
.flag-mini { width: 22px; height: 15px; object-fit: cover; border-radius: 3px; vertical-align: -2px; margin-right: 3px; }
.vs { min-width: 72px; }
.final-score { font-size: 1.45rem; font-weight: 900; color: var(--text); white-space: nowrap; }

/* ---- Badges (pills) ---- */
.wc-badge { font-weight: 800; padding: 0.4rem 0.7rem; border-radius: 999px; font-size: 0.78rem; }
.badge-open { background: var(--accent-soft); color: var(--accent-dark); }
.badge-locked { background: #eef1f5; color: var(--text-secondary); }
.badge-done { background: #fff3d6; color: #b07d00; }
.badge-live { background: #ffe7e7; color: #e03131; }

/* live score + pulsing dot */
.live-score { font-size: 1.45rem; font-weight: 900; color: #e03131; white-space: nowrap; }
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #e03131;
  margin-right: 5px;
  vertical-align: 1px;
  animation: live-pulse 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 49, 49, 0.5); opacity: 1; }
  50% { box-shadow: 0 0 0 5px rgba(224, 49, 49, 0); opacity: 0.6; }
}

/* ---- Legend dots ---- */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.dot-open { background: var(--accent); }
.dot-locked { background: var(--silver); }
.dot-done { background: var(--gold); }

/* ---- Tables (leaderboard / admin / profile) ---- */
.table { --bs-table-bg: transparent; color: var(--text); }
.table thead th {
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}
.table td, .table th { border-color: var(--line); }
.table-hover > tbody > tr:hover > * { background: var(--surface-2); }
.row-me { background: var(--accent-soft) !important; }
.row-me td { color: var(--accent-dark); }
.search-box { max-width: 280px; }

/* ---- Standings / groups ---- */
.standings-table th {
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}
.standings-table td, .standings-table th { border-color: var(--line); padding: 0.5rem 0.3rem; }
/* Long country names (2nd column) wrap instead of overflowing the box */
.standings-table th:nth-child(2), .standings-table td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.2;
  min-width: 90px;
}
.standings-table th:not(:nth-child(2)), .standings-table td:not(:nth-child(2)) {
  white-space: nowrap;
}
.standings-table .flag-mini {
  vertical-align: middle;
  margin-inline-end: 4px;   /* correct side in both LTR and RTL */
  margin-right: 0;
}
.standings-table tr.qualify { background: rgba(0, 200, 120, 0.10); }
.standings-table tr.qualify td:first-child { box-shadow: inset 3px 0 0 #19c37d; }
.standings-table tr.playoff { background: rgba(255, 180, 0, 0.10); }
.standings-table tr.playoff td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.legend-box { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -1px; }
.legend-box.qualify { background: #19c37d; }
.legend-box.playoff { background: var(--gold); }

/* ---- Profile / stats ---- */
.profile-avatar {
  width: 66px; height: 66px; border-radius: 20px;
  display: grid; place-items: center;
  font-size: 1.6rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #54a8ff);
  box-shadow: 0 10px 22px rgba(31, 131, 255, 0.3);
  overflow: hidden;
  flex: 0 0 auto;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.stat-card { transition: transform 0.12s ease, box-shadow 0.2s ease; }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 0.75rem; font-size: 1.05rem;
}
/* vary the stat icon colors like the reference */
.stat-card:nth-child(1) .stat-icon { background: #fff3d6; color: var(--gold); }
.stat-card:nth-child(2) .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-card:nth-child(3) .stat-icon { background: #e4faf9; color: var(--teal); }
.stat-card:nth-child(4) .stat-icon { background: #f0e9ff; color: var(--purple); }
.stat-value { font-size: 2rem; font-weight: 900; line-height: 1; }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; font-weight: 700; }

/* ---- Champion banner ---- */
.champion-banner {
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(255, 201, 77, 0.14), transparent 60%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
}
.form-select {
  background-color: var(--surface);
  border: 1px solid #dfe4ec;
  color: var(--text);
  border-radius: 12px;
  font-weight: 600;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem var(--accent-soft);
}

/* ---- Champion picker ---- */
.champion-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0.9rem 0.5rem;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  text-align: center;
}
.champion-option:hover { border-color: #cfe0f5; transform: translateY(-2px); }
.champion-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 6px 16px rgba(31, 131, 255, 0.18);
}
.champion-option.disabled { cursor: default; opacity: 0.7; }
.champion-option.disabled:hover { transform: none; border-color: var(--line); }
.champion-flag {
  width: 54px; height: 38px;
  display: grid; place-items: center;
  overflow: hidden; border-radius: 7px;
  color: var(--accent); font-size: 1.2rem;
}
.champion-flag img { width: 54px; height: 38px; object-fit: cover; }
.champion-name { font-weight: 800; font-size: 0.9rem; color: var(--text); }
.champion-tick {
  position: absolute; top: 8px; right: 8px;
  color: var(--accent); opacity: 0;
  transition: opacity 0.15s ease;
}
.champion-option.selected .champion-tick { opacity: 1; }

/* ---- Bottom app nav (mobile) ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(17, 34, 63, 0.08);
  padding: 0.35rem 0.25rem;
  padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  z-index: 1040;
}
.bottom-nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 0.6rem;
  padding: 0.35rem 0.1rem;
  border-radius: 12px;
  transition: color 0.15s ease, background 0.15s ease;
}
.bottom-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-nav-item i { font-size: 1.15rem; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:active { background: var(--accent-soft); }

/* keep page content clear of the fixed bottom bar on small screens */
@media (max-width: 991.98px) {
  body { padding-bottom: 70px; }
}

/* ---- Footer ---- */
.wc-footer { border-top: 1px solid var(--line); background: var(--surface); }
.wc-footer .text-secondary { color: var(--text-secondary) !important; }

/* ---- Alerts ---- */
.alert-success { background: #e9f9ee; border: 1px solid #c7eed4; color: #1c7a3e; border-radius: 12px; }
.alert-danger { background: #fdecee; border: 1px solid #f8ccd2; color: #c0344a; border-radius: 12px; }
