/* =========================================================
   THEME + TYPOGRAPHY
   - Modern UI (Inter) + retro accents (Press Start 2P)
   - Soft app shell background
========================================================= */

:root{
  --bg:#f7fafc;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:rgba(15,23,42,.10);

  --accent:#2563eb;   /* blue */
  --accent2:#06b6d4;  /* cyan */
  --hover:rgba(37,99,235,.08);

  --radius:16px;
  --radius2:14px;
  --shadow: 0 10px 30px rgba(15,23,42,.06);
  --shadow2: 0 2px 10px rgba(15,23,42,.06);

  --font-ui: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-brand: "Press Start 2P", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* =========================================================
   BASE RESET
========================================================= */

*{ box-sizing:border-box; }

html, body{ height:100%; }

body{
  margin:0;
  font-family:var(--font-ui);
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(6,182,212,.10), transparent 60%),
    var(--bg);
}

a{ color:inherit; }

/* Smooth, “app-like” motion */
.nav-link, .btn{
  transition: transform .12s ease, background .12s ease, border-color .12s ease, filter .12s ease, box-shadow .12s ease;
}

/* =========================================================
   APP LAYOUT
========================================================= */

.app{
  min-height:100vh;
  display:grid;
  grid-template-columns:280px 1fr;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar{
  background:var(--panel);
  border-right:1px solid var(--border);
  padding:18px 14px;
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;

  display:flex;
  flex-direction:column;

  box-shadow: 6px 0 24px rgba(15,23,42,.03);
}

/* ---------- Sidebar Brand / Logo ---------- */

.sidebar-brand{
  display:flex;
  justify-content:center;
  align-items:center;
  padding:16px 8px 18px;
  margin-bottom:12px;
  border-bottom:1px solid var(--border);
}

.brand-logo{
  height:74px;               /* main size control */
  max-width:100%;
  width:auto;
  image-rendering:pixelated; /* keep pixel art crisp */
  filter: drop-shadow(0 6px 14px rgba(37,99,235,.15));
}

/* ---------- Sidebar Nav ---------- */

.sidebar-nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:1;
  padding-top:10px;
}

.nav-label{
  font-family:var(--font-ui);
  font-size:11px;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--muted);
}

.nav-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:var(--radius2);
  color:#1e293b;
  text-decoration:none;
  border:1px solid transparent;
  position:relative;
  font-family:var(--font-brand); /* Press Start 2P */
  font-size:11px;                /* retro fonts need smaller size */
  font-weight:400;
  letter-spacing:.06em;          /* critical for readability */
  line-height:1.4;
}

.nav-link:hover{
  background:var(--hover);
  border-color:rgba(37,99,235,.18);
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.nav-link.active::before{
  content:"";
  position:absolute;
  left:6px;
  top:8px;
  bottom:8px;
  width:3px;
  border-radius:2px;
  background:linear-gradient(180deg, var(--accent), var(--accent2));
}

.nav-link.active{
  background:linear-gradient(
    180deg,
    rgba(37,99,235,.22),
    rgba(6,182,212,.14)
  );
  border-color:rgba(37,99,235,.35);
  box-shadow: var(--shadow2);
}

.nav-link:not(.active){
  opacity:.85;
} 

/* ---------- Sidebar Footer (Discord / Steam) ---------- */

.sidebar-footer{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding-top:14px;
  margin-top:10px;
  border-top:1px solid var(--border);
}

.sidebar-footnote{
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
  padding:2px 6px 0;
}

/* Buttons */
.btn{
  font-family:var(--font-ui); /* Inter */
  font-size:14px;
  font-weight:700;
  letter-spacing:.01em;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:11px 12px;
  border-radius:var(--radius2);
  text-decoration:none;
  font-weight:750;
  border:1px solid transparent;
  cursor:pointer;
  user-select:none;
}

.btn-primary{
  background:linear-gradient(180deg, var(--accent), #1d4ed8);
  color:#fff;
  border-color:rgba(37,99,235,.35);
  box-shadow: 0 10px 20px rgba(37,99,235,.18);
}

.btn-primary:hover{
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.btn-secondary{
  background:#fff;
  color:var(--text);
  border-color:var(--border);
}

.btn-secondary:hover{
  background:rgba(2,6,23,.02);
  border-color:rgba(37,99,235,.20);
  transform: translateY(-1px);
}

/* =========================================================
   MAIN CONTENT
========================================================= */

.main{
  padding:26px 28px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:18px;
}

.topbar h2{
  margin:0;
  font-family:var(--font-brand);
  font-size:18px; /* keep this modest; retro font is “loud” */
  letter-spacing:.02em;
}

/* =========================================================
   CARDS / PANELS
========================================================= */

.card{
  background:rgba(255,255,255,.85);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

/* Optional heading inside cards */
.card h3{
  margin:0 0 10px;
  font-size:15px;
  font-weight:800;
}

/* =========================================================
   TABLES (for leaderboard / my-times)
========================================================= */

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:14px;
}

.table th{
  text-align:left;
  color:var(--muted);
  font-size:12px;
  letter-spacing:.08em;
  text-transform:uppercase;
  padding:10px 10px;
  border-bottom:1px solid var(--border);
}

.table td{
  padding:12px 10px;
  border-bottom:1px solid rgba(15,23,42,.06);
}

.table tr:hover td{
  background:rgba(37,99,235,.05);
}

/* Status chips */
.chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border:1px solid transparent;
}

.chip-verified{
  background:rgba(34,197,94,.12);
  border-color:rgba(34,197,94,.25);
}

.chip-pending{
  background:rgba(234,179,8,.12);
  border-color:rgba(234,179,8,.25);
}

.chip-rejected{
  background:rgba(239,68,68,.12);
  border-color:rgba(239,68,68,.25);
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width:980px){
  .app{ grid-template-columns:260px 1fr; }
}

@media (max-width:860px){
  .app{ grid-template-columns:1fr; }
  .sidebar{
    position:relative;
    height:auto;
  }
}

/* =========================================================
   SUBMIT PAGE UTILITIES (Bootstrap-like minimal)
   - makes submit.html consistent without pulling Bootstrap
========================================================= */

.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 0 8px;
}

.text-muted{ color: var(--muted); }

.mb-0{ margin-bottom:0; }
.mb-2{ margin-bottom:10px; }
.mb-3{ margin-bottom:16px; }
.mt-1{ margin-top:6px; }
.mt-2{ margin-top:10px; }
.mt-3{ margin-top:16px; }

.gap-2{ gap: 10px; }

.d-flex{ display:flex; }
.flex-wrap{ flex-wrap:wrap; }
.small{ font-size: 12px; }

code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(2,6,23,.05);
  border: 1px solid rgba(15,23,42,.08);
}

.form-label{
  display:block;
  margin-bottom:8px;
  font-weight:800;
}

.form-control{
  width:100%;
  border:1px solid var(--border);
  border-radius: var(--radius2);
  padding: 12px 12px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(15,23,42,.02);
}

.form-control:focus{
  outline: none;
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

/* Alerts */
.alert{
  border:1px solid var(--border);
  border-radius: var(--radius2);
  padding: 12px 12px;
  background: rgba(2,6,23,.02);
}

.alert-success{
  border-color: rgba(34,197,94,.25);
  background: rgba(34,197,94,.10);
}

.alert-danger{
  border-color: rgba(239,68,68,.25);
  background: rgba(239,68,68,.10);
}

/* Details block */
details summary{
  cursor:pointer;
  user-select:none;
}

/* Fix the "outline" button class used in submit.html */
.btn-outline-secondary{
  background:#fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 11px 12px;
  font-weight: 750;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn-outline-secondary:hover{
  background: rgba(2,6,23,.02);
  border-color: rgba(37,99,235,.20);
  transform: translateY(-1px);
}

/* Small outline primary button used in success state */
.btn-outline-primary{
  background:#fff;
  color: var(--accent);
  border: 1px solid rgba(37,99,235,.30);
  border-radius: var(--radius2);
  padding: 9px 10px;
  font-weight: 800;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn-outline-primary:hover{
  background: rgba(37,99,235,.06);
  transform: translateY(-1px);
}

.btn-sm{
  padding: 8px 10px;
  font-size: 13px;
}


.driver { display:flex; align-items:center; gap:10px; min-width:220px; }
.avatar { width:28px; height:28px; border-radius:6px; object-fit:cover; box-shadow:0 1px 2px rgba(0,0,0,.15); }
.avatar.fallback { background:#e8e8e8; }
.meta .name { display:flex; align-items:center; gap:8px; font-weight:600; line-height:1.1; }
.cc { font-size:11px; padding:2px 6px; border-radius:999px; background:rgba(0,0,0,.06); }
.driverLink { color: inherit; text-decoration: none; }
.driverLink:hover .name { text-decoration: underline; }

.avatar.flag {
  border-radius: 4px;   /* flags look better squared */
  object-fit: cover;
}

/* =========================================================
   MOBILE POLISH (add at end of app.css)
========================================================= */

/* Make media + form controls behave on small screens */
img { max-width: 100%; height: auto; }
input, select, button { max-width: 100%; }

/* DataTables tends to overflow on small screens: allow horizontal scroll */
.dataTables_wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Slightly reduce base padding and typography on small screens */
@media (max-width: 860px) {
  .main { padding: 16px 14px; }

  .topbar {
    align-items: flex-start;
    margin-bottom: 12px;
  }
  .topbar h2 {
    font-size: 14px;
    line-height: 1.2;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  /* Sidebar becomes a "top panel" on mobile; tighten it */
  .sidebar {
    padding: 12px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(15,23,42,.04);
  }

  .sidebar-brand {
    padding: 10px 8px 12px;
    margin-bottom: 10px;
  }
  .brand-logo { height: 54px; }

  /* Nav links: bigger tap targets, less width usage */
  .nav-link {
    padding: 12px 12px;
    font-size: 10px;
    border-radius: 12px;
  }

  /* Buttons: full-width stack feels better on mobile */
  .sidebar-footer .btn {
    width: 100%;
  }

  /* Driver block used in tables */
  .driver { min-width: 0; }
  .meta .name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Extra-small phones */
@media (max-width: 520px) {
  .main { padding: 12px 10px; }

  .topbar h2 { font-size: 13px; }

  .card { padding: 12px; }

  /* Slightly smaller avatars for tight rows */
  .avatar { width: 24px; height: 24px; border-radius: 6px; }

  /* DataTables controls: stack cleanly */
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none !important;
    text-align: left !important;
    margin: 6px 0;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .dataTables_wrapper .dataTables_length select {
    width: auto;
  }

  /* Pagination: keep it from squishing */
  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: left !important;
    margin-top: 10px;
  }

  /* Make table headers a bit smaller */
  table.dataTable thead th {
    font-size: 11px;
    padding: 10px 8px;
  }
  table.dataTable tbody td {
    padding: 12px 8px;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .nav-link, .btn { transition: none; }
}

/* Mobile sidebar drawer */
.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  line-height: 1;
  cursor: pointer;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

@media (max-width: 860px) {
  .app { position: relative; }

  .nav-toggle { display: inline-flex; }

  /* sidebar becomes an off-canvas drawer */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    z-index: 50;
    border-right: 1px solid var(--border);
    background: var(--card);
  }

  /* dark overlay behind drawer */
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 40;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  /* main should fill screen (sidebar no longer takes layout space) */
  .main { width: 100%; }

  /* avoid page scroll behind open drawer */
  body.nav-open { overflow: hidden; }
}

@media (max-width: 860px) {
  /* ensure drawer is fully opaque and readable */
  .sidebar {
    background: #fff;           /* solid */
    opacity: 1;
    color: #111;
    filter: none;
    backdrop-filter: none;
  }

  /* if you have "frosted glass" anywhere, force it off for mobile drawer */
  .sidebar * {
    opacity: 1;
  }

  /* make overlay sit behind drawer but above content */
  body.nav-open::before {
    z-index: 40;
  }
  .sidebar {
    z-index: 50;
  }
}

/* DataTables: mobile usability */
.dataTables_wrapper {
  width: 100%;
}

.dataTables_wrapper .dataTables_scroll,
.dataTables_wrapper .dataTables_scrollBody {
  -webkit-overflow-scrolling: touch;
}

table.dataTable {
  width: 100% !important;
}

@media (max-width: 860px) {
  /* allow table to scroll horizontally */
  .dataTables_wrapper {
    overflow-x: auto;
  }

  table.dataTable {
    min-width: 620px; /* adjust: forces horizontal scroll instead of squish */
  }

  table.dataTable thead th,
  table.dataTable tbody td {
    white-space: nowrap;
  }

  /* your custom driver cells should allow truncation */
  .driver, .trackCell {
    min-width: 0;
  }
  .meta .name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* smaller padding so rows don't feel huge */
  table.dataTable thead th { padding: 10px 8px; }
  table.dataTable tbody td { padding: 12px 8px; }
}

@media (max-width: 520px) {
  table.dataTable {
    min-width: 700px; /* slightly larger min keeps columns readable */
  }
}

/* Track cell polish (map looked washed out) */
.track-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.track-map {
  width: 42px;
  height: 42px;
  object-fit: contain;

  /* visual clarity */
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  padding: 6px;

  /* make thin outlines pop */
  filter:
    contrast(1.35)
    brightness(0.95)
    drop-shadow(0 1px 0 rgba(0, 0, 0, 0.18));
}

.track-name {
  font-weight: 600;
  line-height: 1.2;
  white-space: normal;
}

/* Slightly smaller map on very small screens */
@media (max-width: 520px) {
  .track-map {
    width: 36px;
    height: 36px;
    padding: 5px;
  }
}

.login-link {
  color: #3b82f6;
  text-decoration: underline;
  font-weight: 600;
}

.login-link:hover {
  opacity: 0.85;
}

.login-link:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}





