/* ============================================================
   M O T O S C O P E   —   R A C I N G   D A S H B O A R D   V 2
   Design Style: Sports-Tech Dashboard (B) + Brutalist Motorsport (D)
   Global stylesheet — shared across all pages
   ============================================================ */

/* ---------- ROOT THEME ---------- */
:root {
  --bg: #08090c;
  --bg-alt: #0e1116;
  --bg-card: #11141b;

  --text: #e7e9ee;
  --text-dim: #9aa3b2;

  --brand: #ff2d2d;
  --brand-soft: #e72323;
  --accent: #ffd166;

  --border: #1a1d24;

  --radius: 14px;
  --radius-soft: 10px;

  --shadow: 0 8px 24px rgba(0,0,0,.45);

  --speed-red: #fc2e2e;
  --speed-red-soft: #ff4b4b;

  --speed-grey: #1b1e24;
}

/* ---------- BASE RESET ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.45;
}

img { display: block; max-width: 100%; }

.ms-container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

/* ---------- GLOBAL LINKS ---------- */

a {
  color: var(--text);
  text-decoration: none;
}
a:hover {
  color: var(--brand);
}

/* ============================================================
   HEADER / NAVIGATION
   ============================================================ */

.ms-header {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8,9,12,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .8rem 0;
}

/* ---------- BRAND ---------- */

.ms-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .5px;
}

.ms-brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand);
}

/* ---------- NAV ---------- */

.ms-nav-list {
  display: flex;
  gap: 1.1rem;
  list-style: none;
}

.ms-nav-list a {
  padding: .45rem .7rem;
  border-radius: 8px;
  transition: background .18s;
}

.ms-nav-list a:hover {
  background: var(--bg-alt);
}

.ms-nav-list a.active {
  background: var(--brand-soft);
  color: #fff;
}

/* ---------- MOBILE NAV ---------- */

.ms-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  padding: .4rem .7rem;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 850px) {
  .ms-menu-btn {
    display: block;
  }
  .ms-nav-list {
    display: none;
    position: absolute;
    top: 62px;
    right: 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .7rem;
    flex-direction: column;
    gap: .3rem;
    min-width: 170px;
  }
  .ms-nav-list.show {
    display: flex;
  }
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  background:
    radial-gradient(950px 400px at 85% -10%, rgba(255, 45, 45, 0.22), transparent 65%),
    radial-gradient(900px 600px at -10% 10%, rgba(255,209,102,.08), transparent 60%);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0 2rem;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
}

.hero-sub {
  font-size: 1.05rem;
  margin: .75rem 0 1.1rem;
  color: var(--text-dim);
}

.hero-actions {
  display: flex;
  gap: .8rem;
}

/* ---------- BUTTONS ---------- */

.ms-btn {
  background: var(--brand);
  color: white;
  padding: .65rem 1.1rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border: none;
}

.ms-btn:hover {
  background: var(--brand-soft);
}

.ms-btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.ms-btn.ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* ============================================================
   FEATURE GRID (HOME PAGE)
   ============================================================ */

.feature-grid {
  margin-top: 2rem;
  display: grid;
  gap: 1.3rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.feature-card {
  background: var(--bg-card);
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.feature-card h3 {
  margin-bottom: .4rem;
  font-size: 1.2rem;
}

/* ============================================================
   GENERIC SECTION WRAPPER
   ============================================================ */

.section {
  padding: 2.5rem 0;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: .75rem;
}

/* ============================================================
   CONTROLS (selects, sliders, inputs)
   ============================================================ */

.ms-select,
.ms-input {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .55rem .7rem;
  border-radius: 10px;
}

.ms-input:focus,
.ms-select:focus {
  outline: 1px solid var(--brand);
}

/* ============================================================
   BRUTALIST CLASS SLIDER (MotoGP / Moto2 / Moto3)
   ============================================================ */

.ms-class-slider {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--speed-grey);
  border-radius: 999px;
  padding: 4px;
  overflow: hidden;
  margin: 1rem 0 1.8rem;
}

.ms-class-highlight {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  background: #1f2937;
  border-radius: 999px;
  width: calc(100%/3);
  transition: transform 0.22s ease;
}

.ms-class-btn {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  padding: .4rem .8rem;
  font-size: .9rem;
  color: #9ca3af;
  cursor: pointer;
}

.ms-class-btn.active {
  color: #fff;
  font-weight: 700;
}

/* ============================================================
   DATA TABLE (Standings / Riders / Teams etc.)
   ============================================================ */

.ms-table-wrapper {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.ms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
  min-width: 680px;
}

.ms-table thead {
  background: #0f172a;
  color: var(--text-dim);
}

.ms-table th,
.ms-table td {
  padding: .55rem .65rem;
  border-bottom: 1px solid #131722;
}

.ms-table tbody tr:hover {
  background: #151a24;
}

/* ---------- Rider Cell ---------- */

.ms-rider-cell {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.ms-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

/* ============================================================
   ERROR / STATUS
   ============================================================ */

.ms-status {
  text-align: center;
  color: var(--text-dim);
  margin: 1rem 0;
}

.ms-error {
  text-align: center;
  color: var(--brand);
  font-weight: 600;
  margin-top: 1rem;
}

.ms-error img {
  width: 180px;
  opacity: .85;
  margin: 0 auto;
}

/* ============================================================
   LOADER
   ============================================================ */
.ms-loader {
  margin: 1rem auto;
  width: 44px;
  height: 44px;
  border: 4px solid #333;
  border-top: 4px solid var(--brand);
  border-radius: 50%;
  animation: ms-spin 1s linear infinite;
}

@keyframes ms-spin {
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}

.hidden { display: none; }

/* ============================================================
   CARDS (Riders / Teams / Circuits)
   ============================================================ */

.ms-card-grid {
  display: grid;
  gap: 1.3rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.ms-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.ms-card-title {
  margin: .4rem 0 .2rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.ms-card-sub {
  color: var(--text-dim);
  font-size: .9rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

.ms-footer {
  border-top: 1px solid var(--border);
  padding: 1.3rem 0;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
}


/* Season / Class filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid #2b2b2b;
  background: #0b0b0b;
}

.filter-group {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #bbbbbb;
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #3a3a3a;
  background: #111111;
  color: #f5f5f5;
  font-size: 0.95rem;
  line-height: 1.3;
  outline: none;
}

.filter-select:focus {
  border-color: #f97316; /* accent */
  box-shadow: 0 0 0 1px #f97316;
}

.filter-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Make them stack nicely on small screens */
@media (max-width: 640px) {
  .filter-bar {
    padding: 0.75rem;
  }

  .filter-group {
    flex: 1 1 100%;
  }
}

.circuit-img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  padding: .5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

/* FULLSCREEN PROFESSIONAL LOADING OVERLAY */
.loading-overlay {
  position: fixed;
  inset: 0;                         /* full screen: top, right, bottom, left = 0 */
  z-index: 9999;

  display: flex;
  justify-content: center;          /* center horizontally */
  align-items: center;              /* center vertically */

  background: rgba(0, 0, 0, 0.75);   /* dark transparent layer */
  backdrop-filter: blur(4px);        /* blur background */
}

.loading-video {
  width: 800px !important;                     /* perfect size */
  max-width: 90vw !important;
  opacity: 0.95;
  border-radius: 14px;
}

.hidden {
  display: none !important;
}

.team-logo {
  width: 100%;
  height: 140px;
  object-fit: contain;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.ms-card-img img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: .6rem;
}

/* ============================================================
   STANDINGS TABLE — SPECIAL FORMATTING
   ============================================================ */

#standingsWrapper {
  margin-top: 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  padding: 0;
  margin: 0 46px;
}

#standingsTable {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

#standingsTable thead {
  background: #111318;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

#standingsTable th,
#standingsTable td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #1d2027;
  text-align: left;
}

#standingsTable tbody tr:hover {
  background: #191d24;
  transition: 150ms ease;
}

/* Rider Column Cell Layout */
.ms-rider-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Position Number Style */
#standingsTable td:first-child {
  font-weight: 700;
  color: var(--accent);
  width: 48px;
}

/* Points highlight */
#standingsTable td:nth-child(4) {
  font-weight: 700;
  color: #f5f5f5;
}

/* Status & Error */
.ms-error img {
  width: 160px;
  opacity: 0.9;
}

.ms-error {
  padding: 1rem;
  font-size: 1.1rem;
}

/* Loader */
#standingsLoader {
  margin: 1.2rem auto;
}

/* Centering fallback row */
#standingsBody .ms-status {
  text-align: center;
  padding: 1rem;
  color: var(--text-dim);
}

.ms-error {
  text-align: center;
}

.ms-error img {
  display: block;
  margin: 0 auto 10px auto; /* centers the image + add spacing */
}

.ms-error div {
  text-align: center;
  margin-top: 8px;
  font-weight: 600;
}

/* FORCE PERFECT COLUMN ALIGNMENT FOR SCHEDULE */
.schedule-table {
  table-layout: fixed;
  width: 100%;
}

.schedule-table th,
.schedule-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  white-space: nowrap;
}

.schedule-table th:nth-child(1),
.schedule-table td:nth-child(1) {
  width: 90px;      /* Round column */
}

.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) {
  width: 160px;     /* GP or Class name */
}

.schedule-table th:nth-child(3),
.schedule-table td:nth-child(3) {
  width: 140px;     /* Friday */
}

.schedule-table th:nth-child(4),
.schedule-table td:nth-child(4) {
  width: 140px;     /* Saturday */
}

.schedule-table th:nth-child(5),
.schedule-table td:nth-child(5) {
  width: 140px;     /* Sunday */
}

/* SINGLE EVENT TABLE SIZING */
.schedule-table.single-event th:nth-child(1),
.schedule-table.single-event td:nth-child(1) {
  width: 130px;     /* Class column */
}

.schedule-table.single-event th:nth-child(2),
.schedule-table.single-event td:nth-child(2) {
  width: 180px;     /* Session name */
}

.schedule-table.single-event th:nth-child(3),
.schedule-table.single-event td:nth-child(3) {
  width: 130px;     /* Start time */
}

.schedule-table.single-event th:nth-child(4),
.schedule-table.single-event td:nth-child(4) {
  width: 130px;     /* End time */
}

.schedule-table.single-event th:nth-child(5),
.schedule-table.single-event td:nth-child(5) {
  width: 130px;     /* Day */
}

/* BIKES SEARCH BAR */
.bike-search-wrapper {
  display: flex;
  gap: .75rem;
  margin-top: .5rem;
}

.bike-search-wrapper input {
  flex: 1;
}

/* PREDICTIONS WALLET */
.wallet-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #0f1115;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* PREDICTION PANEL */
.predict-panel {
  margin-bottom: 2rem;
}

.predict-form {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap: 1rem;
  padding: 1rem;
  background: #0f1118;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.predict-group label {
  font-size: .85rem;
  color: var(--text-dim);
  margin-bottom: .35rem;
}

.bet-result {
  margin-top: 1.4rem;
  padding: 1rem;
  background: #1a1d24;
  border-radius: 14px;
  border: 1px solid #272c35;
}

.fail-text {
  color: #ff4b4b;
}

/* NPC FEED */
.npc-box {
  margin-top: 3rem;
}

.npc-feed {
  margin-top: .8rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.npc-item {
  padding: .6rem .8rem;
  background: #0f1117;
  border: 1px solid #1f232c;
  border-radius: 8px;
  color: var(--text-dim);
}

/* PREDICTIONS MODULE */
.prediction-coins-box {
  background:#111;
  padding:1rem;
  border:1px solid var(--border);
  border-radius: var(--radius);
  font-size:1.2rem;
  margin-bottom:1.4rem;
}

.prediction-form {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:1rem;
  background:#0d0d0d;
  padding:1rem 1.3rem;
  border-radius:10px;
  border:1px solid #222;
}

.form-group {
  display:flex;
  flex-direction:column;
  gap:.3rem;
}

.prediction-history .history-item {
  display:flex;
  justify-content:space-between;
  padding:.7rem;
  border-bottom:1px solid #222;
}

.win { color:#63ff63; font-weight:bold; }
.loss { color:#ff3b3b; font-weight:bold; }

.prediction-leaderboard .leaderboard-item {
  display:flex;
  justify-content:space-between;
  padding:.6rem;
  border-bottom:1px solid #222;
}

.predict-btn {
  padding: 0.45rem 0.75rem !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px;
  border-radius: 8px;
  margin-top: 0.5rem;
  background: var(--brand);
}

.predict-btn:hover {
  background: var(--brand-soft);
}

/* ====== LIVE TICKER ====== */
#tickerWrap {
  position: sticky;
  bottom: 0;
  width: 100%;
  overflow: hidden;
  height: 40px;
  background: #0d0d0d;
  border-top: 1px solid var(--border);
  z-index: 999;
}

#tickerInner {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: tickerScroll 18s linear infinite;
  font-size: 1rem;
  line-height: 40px;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.ticker-item {
  display: inline-block;
  margin-right: 3rem;
  color: var(--accent);
  font-weight: 600;
}
