*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0D1117;
  --surface: #161B22;
  --border: #21262D;
  --blue: #2563EB;
  --blue-light: #3B82F6;
  --orange: #F97316;
  --text: #FFFFFF;
  --text-secondary: #A0AEC0;
  --green: #22C55E;
  --red: #EF4444;
  --radius: 12px;
  --nav-h: 72px;          /* mobile bottom nav height */
  --sidebar-w: 240px;     /* desktop sidebar width */
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════
   MOBILE LAYOUT  (default, <768px)
   ═══════════════════════════════ */

.page {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + 8px);
  position: relative;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
}
.page-header h1 { font-size: 18px; font-weight: 700; flex: 1; }

.back-btn {
  background: none; border: none;
  color: var(--blue); cursor: pointer;
  padding: 4px; display: flex; align-items: center;
}

.page-content { padding: 0 20px 20px; }

/* ── Bottom nav (mobile) ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 430px;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 9px; font-weight: 500;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.15s;
  letter-spacing: 0.2px;
  flex: 1; justify-content: center;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--blue); }

/* Sidebar hidden on mobile */
.sidebar { display: none; }

/* ═══════════════════════════════
   TABLET  (≥768px)
   ═══════════════════════════════ */
@media (min-width: 768px) {
  body { display: flex; }

  /* Sidebar */
  .sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    min-height: 100dvh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 100;
    padding: 24px 0 32px;
    flex-shrink: 0;
  }

  .sidebar-logo {
    padding: 0 20px 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
  }
  .sidebar-logo .logo-text {
    font-size: 22px; font-weight: 900; line-height: 1;
  }
  .sidebar-logo .logo-sport { color: #fff; }
  .sidebar-logo .logo-stuff { color: var(--blue); font-style: italic; }

  .sidebar .nav-item {
    flex-direction: row;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 0;
    letter-spacing: 0;
    width: 100%;
    justify-content: flex-start;
    border-left: 3px solid transparent;
  }
  .sidebar .nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
  .sidebar .nav-item.active {
    color: var(--blue);
    border-left-color: var(--blue);
    background: rgba(37,99,235,0.08);
  }

  .sidebar-bottom {
    margin-top: auto;
    padding: 0 20px;
  }
  .sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
  }
  .sidebar-user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    flex-shrink: 0;
  }
  .sidebar-user-name { font-size: 13px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user-email { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Content shifts right of sidebar */
  .page {
    margin-left: var(--sidebar-w);
    max-width: none;
    width: calc(100% - var(--sidebar-w));
    padding-bottom: 40px;
  }

  /* Hide bottom nav on tablet+ */
  .bottom-nav { display: none; }

  /* Wider page header */
  .page-header { padding: 28px 32px 16px; }
  .page-header h1 { font-size: 22px; }
  .page-content { padding: 0 32px 32px; }
}

/* ═══════════════════════════════
   DESKTOP  (≥1200px)
   ═══════════════════════════════ */
@media (min-width: 1200px) {
  :root { --sidebar-w: 260px; }

  .page {
    max-width: 900px;
    margin-left: var(--sidebar-w);
    /* center content in remaining space */
    margin-right: auto;
    padding: 0 0 60px;
  }

  .page-header { padding: 36px 40px 20px; }
  .page-content { padding: 0 40px 40px; }

  /* 2-column grid for cards on desktop */
  .desktop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .desktop-grid-full { grid-column: 1 / -1; }
}

/* ═══════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════ */

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; height: 52px;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 700;
  cursor: pointer; letter-spacing: 0.5px;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

@media (min-width: 768px) {
  .btn { max-width: 400px; }
  .btn-full { max-width: none; }
}

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; display: block; }

.input-wrap { position: relative; display: flex; align-items: center; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
.input-field {
  width: 100%; height: 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  padding: 0 16px;
  outline: none;
  -webkit-appearance: none; appearance: none;
  color-scheme: dark;
}
input:focus, select:focus { border-color: var(--blue); }
select { cursor: pointer; }
select option { background: var(--surface); }

.input-icon {
  position: absolute; left: 14px;
  color: var(--text-secondary);
  pointer-events: none; font-size: 16px;
}
.input-icon ~ input { padding-left: 42px; }

.input-suffix {
  position: absolute; right: 14px;
  color: var(--text-secondary);
  cursor: pointer; background: none; border: none;
  display: flex;
}

/* Avatar */
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--border); }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--border); }

/* Section title */
.section-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 12px;
}

/* Toast */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1F2937; color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200; max-width: 320px;
  text-align: center; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 768px) {
  #toast { bottom: 24px; }
}

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Utility */
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.text-blue { color: var(--blue); }
.text-secondary { color: var(--text-secondary); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
