:root {
  --bg: #0b0d12;
  --panel: #111623;
  --panel-2: #0f1320;
  --text: #e9edf6;
  --muted: #9aa4b2;
  --border: rgba(255, 255, 255, .08);
  --accent: #8b5cf6; /* purple */
  --accent-2: #22c55e; /* green */
  --shadow: 0 12px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
}

:root.light {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(17, 24, 39, .12);
  --shadow: 0 12px 30px rgba(17, 24, 39, .12);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  color: var(--text);
}

/* NAVBAR */
.navbar {
  position: sticky;
  top: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 75%, black 25%);
  backdrop-filter: blur(10px);
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  line-height: 1;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  width: auto;
}

.brand-logo {
  height: 100%;
  width: auto;
  display: block;
  object-fit: contain;
}

.brand-text {
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 10px;
}

.nav-links a {
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav-links a:hover {
  color: var(--text);
  border-color: var(--border);
  background: color-mix(in oklab, var(--panel) 70%, transparent);
}

.nav-links a.active {
  color: var(--text);
  border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
  background: color-mix(in oklab, var(--accent) 14%, var(--panel));
}

/* SEARCH */
.search-wrap input {
  width: 280px;
  max-width: 44vw;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 75%, transparent);
  color: var(--text);
  outline: none;
}

.search-wrap input:focus {
  border-color: color-mix(in oklab, var(--accent) 65%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}

/* BUTTONS */
.btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--accent) 18%, var(--panel));
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  border-color: color-mix(in oklab, var(--accent) 65%, var(--border));
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
}

.btn.full {
  width: 100%;
}

/* LAYOUT */
.page {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1280px;
  margin: 0 auto;
  z-index: 0;
}

.sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 92px);
  overflow: auto;
  padding-right: 4px;
}

.content {
  min-height: calc(100vh - 92px);
  z-index: 0;
}

/* Specific styling for Distance Badges (Blue/Cyan theme) */
.badge.distance-badge {
  color: #06b6d4;
  border-color: color-mix(in oklab, #06b6d4 30%, var(--border));
  background: color-mix(in oklab, #06b6d4 10%, transparent);
}

/* Specific styling for Role Badges (Purple theme) */
.badge.role-badge {
  color: #a78bfa;
  border-color: color-mix(in oklab, #a78bfa 30%, var(--border));
  background: color-mix(in oklab, #a78bfa 10%, transparent);
}

/* --- MOBILE STYLES --- */
@media (max-width: 980px) {
  .brand-text {
    display: none;
  }
  .page {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
    top: auto;
  }
  .search-wrap input {
    width: 160px;
  }
  .nav-links {
    display: none;
  }
}

/* PANELS */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- CARD LINK & FAVORITE STYLES --- */
.card-container {
  position: relative;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.fav-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  z-index: 10;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.fav-btn:hover {
  transform: scale(1.1);
  border-color: var(--accent);
  color: var(--accent);
}

.fav-btn.active {
  color: #fbbf24; /* Gold */
  border-color: #fbbf24;
  background: color-mix(in oklab, #fbbf24 10%, var(--panel));
}

.btn-fake {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--accent) 5%, transparent);
  transition: all 0.2s ease;
}

.card-link:hover .btn-fake {
  background: var(--accent);
  color: white;
}

/* GRID & CARDS */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  transition: transform .12s ease, border-color .12s ease;
  height: 100%; /* Ensures cards in a row are same height */
}

.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--accent) 60%, var(--border));
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  display: grid;
  place-items: center;
  font-weight: 900;
  flex-shrink: 0;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.badges {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.good {
  color: var(--accent-2);
  border-color: color-mix(in oklab, var(--accent-2) 30%, var(--border));
}

.card-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card-actions {
  margin-top: 12px;
}

/* MODALS, OVERLAYS, ETC */
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  padding: 16px;
  z-index: 80;
}

.hidden { display: none; }

.modal {
  width: min(520px, 96vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 70;
}


body:not(.filters-open) .page { grid-template-columns: 1fr; }
body:not(.filters-open) .sidebar { display: none; }

@media (max-width: 980px) {
  body.filters-open .sidebar {
    display: block;
    position: fixed;
    top: 72px;
    left: 16px;
    bottom: 16px;
    width: min(340px, 92vw);
    z-index: 80;
  }
  body.filters-open .overlay { display: block; }
}

/* --- HAMBURGER & MOBILE DRAWER --- */
.hamburger-btn {
  display: none; /* Hidden by default */
  flex-direction: column;
  justify-content: space-around;
  width: 24px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1000;
}

.hamburger-btn span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 10px;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: -100%; /* Start off-screen */
  width: 280px;
  height: 1000px;
  background: var(--panel);
  z-index: 999;
  transition: left 0.3s ease;
  padding: 80px 20px;
  box-shadow: var(--shadow);
  border-right: 1px solid var(--border);
}

body.menu-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

.mobile-drawer.open {
  left: 0;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.mobile-nav-links a {
  text-decoration: none;
  color: var(--text);
  font-size: 18px;
  padding: 10px;
  border-radius: 8px;
}

.mobile-nav-links a.active {
  background: color-mix(in oklab, var(--accent) 15%, var(--panel));
  color: var(--accent);
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
  display: none;
}

.mobile-menu-overlay.show {
  display: block;
}

/* --- MOBILE OVERRIDES --- */
@media (max-width: 980px) {
  .hamburger-btn {
    display: flex; /* Show on mobile */
  }

  .nav-left {
    gap: 8px; /* Tighten gap for mobile */
  }
}