/* =========================== RESET & BASE =========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: #ffffff;
  color: #111111;
  font-size: 14px;
}

a {
  text-decoration: none;
  color: inherit;
}

/* =========================== NAVIGATION =========================== */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid #ebebeb;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.3px;
  line-height: 1;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #111;
  font: inherit;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: #111;
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

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

.nav-links a {
  font-size: 13px;
  color: #555;
  transition: color 0.15s;
  text-decoration: none;
}

.nav-links a:hover { color: #111; }
.nav-links a.active { color: #111; font-weight: 600; }

.nav-signin {
  font-size: 13px;
  color: #555;
  text-decoration: none;
}

.nav-signin:hover { color: #111; }

/* =========================== USER CHIP =========================== */
.user-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.user-name {
  font-size: 12px;
  font-weight: 500;
  color: #111;
  white-space: nowrap;
}

.user-menu {
  position: absolute;
  top: 42px;
  right: 0;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 6px;
  min-width: 120px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  display: none;
  z-index: 200;
}

.user-chip.open .user-menu { display: block; }

.user-menu a {
  display: block;
  font-size: 12px;
  color: #d33;
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: none;
}

.user-menu a:hover { background: #f6f6f6; }

/* =========================== TOAST =========================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #111;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================== AUTH MODAL =========================== */
.auth-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.auth-modal-overlay.open { display: flex; }

.auth-modal {
  background: #fff;
  border-radius: 14px;
  width: 360px;
  max-width: 95vw;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  text-align: center;
}

.auth-modal-icon { font-size: 28px; margin-bottom: 12px; }

.auth-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #111;
  margin-bottom: 6px;
}

.auth-modal-sub {
  font-size: 13px;
  color: #999;
  line-height: 1.6;
  margin-bottom: 24px;
}

.auth-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 20px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: #111;
  margin-bottom: 10px;
}

.auth-modal-btn:hover {
  border-color: #aaa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.auth-modal-cancel {
  font-size: 12px;
  color: #bbb;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  margin-top: 4px;
}

.auth-modal-cancel:hover { color: #555; }

/* =========================== BREADCRUMB =========================== */
.breadcrumb {
  padding: 12px 24px;
  font-size: 12px;
  color: #bbb;
  border-bottom: 1px solid #ebebeb;
  display: flex;
  gap: 6px;
}

/* =========================== PAGE HEADER =========================== */
.page-header {
  padding: 40px 24px 32px;
  border-bottom: 1px solid #ebebeb;
  text-align: center;
}

.page-header-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #bbb;
  margin-bottom: 10px;
}

.page-header-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  color: #111;
  margin-bottom: 8px;
}

.page-header-tagline {
  font-size: 13px;
  color: #999;
}

/* =========================== FILTER BAR =========================== */
.filter-bar {
  padding: 14px 24px;
  border-bottom: 1px solid #ebebeb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results-count {
  font-size: 13px;
  color: #aaa;
  white-space: nowrap;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  color: #555;
  font-family: inherit;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: #111; color: #111; }
.filter-btn.active { background: #111; color: #fff; border-color: #111; }

.filter-right select {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #555;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  outline: none;
}

.filter-right select:hover { border-color: #111; }

.filter-bottom { display: flex; }

.search-bar {
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  color: #111;
  outline: none;
  width: 280px;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

.search-bar::placeholder { color: #bbb; }
.search-bar:focus { border-color: #111; background: #fff; }

/* =========================== BIKE GRID =========================== */
.bike-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  background: #fff;
}

/* =========================== BIKE CARD =========================== */
.bike-card {
  background: #fff;
  display: block;
  border: 1px solid #ebebeb;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
  cursor: pointer;
}

.bike-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.bike-img {
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  position: relative;
}

.bike-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bike-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #111;
  color: #fff;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.bike-info { padding: 12px 14px 14px; }
.bike-brand { font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 3px; }
.bike-name { font-size: 13px; font-weight: 600; color: #111; margin-bottom: 4px; line-height: 1.3; }
.bike-category { font-size: 12px; color: #aaa; margin-bottom: 8px; }

.bike-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bike-price { font-size: 13px; color: #111; font-weight: 500; }

.bike-icons { display: flex; gap: 10px; }

.bike-icons .icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #bbb;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.bike-icons .icon-btn:hover { color: #111; }
.bike-icons .icon-btn.active {
  color: #c40000;
  background: rgba(196, 0, 0, 0.08);
  border-radius: 6px;
}
/* =========================== BRAND PAGES =========================== */
.country-section { margin-bottom: 30px; }

.country-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 24px 10px;
}

.country-badge {
  background: #ffe5e5;
  color: #d10000;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.country-count { font-size: 12px; color: #aaa; }

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 0 24px;
}

.brand-back { padding: 16px 24px 0; }
.brand-back a { font-size: 13px; color: #aaa; }
.brand-back a:hover { color: #111; }

.brand-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  padding: 40px 24px;
}

.brand-logo { flex: 0 0 auto; }

.brand-logo img {
  width: 120px;
  height: auto;
  display: block;
}

.brand-main { flex: 1; min-width: 0; }

.brand-country-pill {
  display: inline-block;
  font-size: 11px;
  color: #d64545;
  font-weight: 600;
  margin-bottom: 6px;
}

.brand-main h1 { font-size: 34px; font-weight: 600; margin: 6px 0; }

.brand-main p {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.6;
  color: #555;
  max-width: none;
  width: 100%;
}

.brand-stats { flex: 0 0 auto; text-align: right; }
.brand-count { font-size: 48px; font-weight: 600; color: #c2c2c2; line-height: 1; }
.brand-count-label { font-size: 13px; color: #c2c2c2; }

#bike-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 20px 24px 60px;
}

#bike-grid .bike-img { aspect-ratio: 3 / 2; }
#bike-grid .bike-img img { width: 100%; height: 100%; object-fit: contain; }
#bike-grid .bike-info { padding: 10px; }
#bike-grid .bike-name { font-size: 12px; }
#bike-grid .bike-category { font-size: 11px; color: #aaa; }

/* =========================== PRODUCT / BIKE PAGE =========================== */
.product-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

.left-column, .right-column { width: 100%; }

@media (min-width: 1100px) {
  .product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    padding: 40px 24px 60px;
  }

  .left-column {
    position: sticky;
    top: 100px;
    align-self: start;
  }

  .right-column { max-width: 520px; }
}

.photo-section { display: flex; justify-content: center; padding: 20px 0; }

.product-img-main img {
  width: 100%;
  max-width: 560px;
  border-radius: 12px;
  border: 1px solid #ebebeb;
}

.description-section { margin-top: 18px; }

.description-box {
  background: #f7f7f7;
  border-radius: 12px;
  padding: 20px 24px;
}

.description-box p { font-size: 13px; line-height: 1.8; color: #bbb; }

.table-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 8px;
}

.product-identity { padding: 32px 0 24px; }

.identity-top { display: flex; gap: 8px; margin-bottom: 6px; }

.product-brand-label { font-size: 12px; color: #e00000; font-weight: 600; }

.product-tag {
  background: #ffe5e5;
  color: #e00000;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 6px;
}

.product-name { font-size: 34px; font-weight: 700; margin-bottom: 8px; }
.product-meta { font-size: 13px; color: #bbb; }
.product-price { font-size: 26px; color: #111; margin-bottom: 20px; }

.product-actions { display: flex; gap: 8px; }

.action-btn {
  border: 1px solid #e0e0e0;
  background: #fff;
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.action-btn.active { background: #111; color: #fff; border: 1px solid #111; }

.info-block { padding: 18px 0; }

.neat-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  overflow: hidden;
}

.neat-table thead td {
  background: #f5f5f5;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #999;
}

.neat-table tbody td { padding: 12px 12px; font-size: 13px; border-top: 1px solid #f0f0f0; }
.neat-table tbody td:first-child { width: 22%; color: #bbb; text-align: left; white-space: nowrap; padding-right: 8px; }
.neat-table tbody td:last-child { width: 78%; color: #111; text-align: left; padding-left: 0; }

.rating-row { display: flex; gap: 10px; align-items: center; }
.rating-bar-wrap { flex: 1; height: 4px; background: #f0f0f0; border-radius: 2px; }
.rating-bar { height: 100%; background: #111; }
.rating-num { font-size: 13px; min-width: 30px; }

/* =========================== COMMUNITY =========================== */
.community-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid #ebebeb;
}

.stat-pill {
  font-size: 12px;
  color: #555;
  background: #f5f5f5;
  border: 1px solid #ebebeb;
  border-radius: 20px;
  padding: 5px 13px;
}

.stat-pill span { font-weight: 600; color: #111; }

.signin-gate {
  display: flex;
  justify-content: center;
  padding: 48px 24px 0;
}

.gate-inner { max-width: 400px; text-align: center; }
.gate-title { font-size: 18px; font-weight: 700; color: #111; margin-bottom: 10px; }
.gate-sub { font-size: 13px; color: #999; line-height: 1.6; }

.community-tabs {
  display: flex;
  gap: 0;
  padding: 20px 24px 0;
  border-bottom: 1px solid #ebebeb;
}

.comm-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  font-size: 13px;
  font-family: inherit;
  color: #999;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  font-weight: 500;
}

.comm-tab:hover { color: #111; }
.comm-tab.active { color: #111; border-bottom-color: #111; font-weight: 600; }

.tab-panel { padding-bottom: 60px; }
.tab-panel.hidden { display: none; }
.comm-loading { padding: 60px 24px; text-align: center; color: #bbb; font-size: 13px; }

.leaderboard-wrap { padding: 20px 24px; overflow-x: auto; }

.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.leaderboard-table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #bbb;
  font-weight: 500;
  padding: 0 12px 14px;
  border-bottom: 1px solid #ebebeb;
}

.leaderboard-table tbody tr { border-bottom: 1px solid #f3f3f3; height: 54px; }
.leaderboard-table tbody tr:hover { background: #fafafa; }
.leaderboard-table tbody td { padding: 14px 12px; vertical-align: middle; line-height: 1.4; }
.lb-me { background: #fafafa; }

.lb-user { display: flex; align-items: center; gap: 10px; }

.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #333;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.you-badge {
  font-size: 10px;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

.bike-rank-list { padding: 8px 24px; }

.bike-rank-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f3f3;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  border-radius: 8px;
}

.bike-rank-row:hover { background: #fafafa; }
.bike-rank-row:hover .rank-name { color: #000; }

.rank-pos { font-size: 13px; font-weight: 600; color: #ccc; width: 28px; text-align: center; flex-shrink: 0; }
.bike-rank-row:nth-child(1) .rank-pos { color: #c9a227; font-size: 18px; }
.bike-rank-row:nth-child(2) .rank-pos { color: #a8a9ad; font-size: 16px; }
.bike-rank-row:nth-child(3) .rank-pos { color: #cd7f32; font-size: 15px; }

.rank-img { width: 80px; height: 54px; border-radius: 6px; overflow: hidden; background: #f5f5f5; flex-shrink: 0; }
.rank-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.rank-info { flex: 1; min-width: 0; }
.rank-brand { font-size: 10px; color: #bbb; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 3px; }
.rank-name { font-size: 13px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.15s; }

.rank-count { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; gap: 1px; }
.rank-num { font-size: 20px; font-weight: 700; color: #111; letter-spacing: -0.5px; line-height: 1; }
.rank-label { font-size: 10px; color: #bbb; text-transform: uppercase; letter-spacing: 0.5px; }

/* =========================== LOADING STATE =========================== */
.loading-state {
  grid-column: 1 / -1;
  padding: 60px 0;
  text-align: center;
  color: #bbb;
  font-size: 13px;
}

/* =========================== RESPONSIVE =========================== */
@media (max-width: 900px) {
  .brand-hero { flex-direction: column; gap: 20px; }
  .brand-stats { text-align: left; }
}

@media (max-width: 600px) {
  .community-tabs { overflow-x: auto; padding-bottom: 0; gap: 0; }
  .comm-tab { white-space: nowrap; padding: 10px 14px; font-size: 12px; }
  .bike-rank-list { padding: 8px 16px; }
  .rank-img { width: 60px; height: 40px; }
  .rank-num { font-size: 16px; }

  .product-layout { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 1100px) {
  .product-layout { padding-left: 20px; padding-right: 20px; }
}
/* =========================== MOBILE (max-width: 768px) =========================== */
/* All rules below are additive — desktop is completely unaffected */

@media (max-width: 768px) {

  /* --- NAV --- */
  /* Hide the link row and auth area; show hamburger instead */
  .nav-links { display: none; }
  .nav-right > #auth-area { display: none; }

  /* Hamburger button — invisible on desktop (see below) */
  .nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: 12px;
  }
  .nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #111;
    border-radius: 2px;
    transition: all 0.2s;
  }

  /* Mobile dropdown menu */
  .mobile-menu {
    display: none;
    position: fixed;
    top: 57px; /* just below nav */
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #ebebeb;
    z-index: 99;
    padding: 12px 0 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }
  .mobile-menu.open { display: block; }

  .mobile-menu a {
    display: block;
    padding: 12px 24px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
  }
  .mobile-menu a:last-child { border-bottom: none; }
  .mobile-menu a.active { font-weight: 600; color: #111; }
  .mobile-menu a:hover { background: #fafafa; }

  .mobile-menu-signin {
    display: block;
    padding: 12px 24px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
  }

  /* --- PAGE HEADER --- */
  .page-header { padding: 24px 16px 20px; }
  .page-header-title { font-size: 26px; }

  /* --- FILTER BAR --- */
  .filter-bar { padding: 12px 16px; }
  .filter-top { flex-wrap: wrap; gap: 8px; }
  .filter-left { flex-wrap: wrap; gap: 8px; }
  .filters { flex-wrap: wrap; gap: 6px; }
  .search-bar { width: 100%; }

  /* --- BIKE GRID --- */
  .bike-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px 12px;
  }

  /* --- BIKE CARD --- */
  .bike-info { padding: 8px 10px 10px; }
  .bike-name { font-size: 12px; }
  .bike-price { font-size: 12px; }
  .bike-category { font-size: 11px; margin-bottom: 6px; }

  /* --- BRAND GRID --- */
  .country-grid { grid-template-columns: repeat(2, 1fr); padding: 0 12px; }
  .country-header { margin: 14px 12px 8px; }

  /* --- BRAND HERO (solobrand page) --- */
  .brand-hero { padding: 20px 16px; gap: 16px; flex-direction: column; }
  .brand-main h1 { font-size: 24px; }
  .brand-stats { text-align: left; }
  .brand-count { font-size: 36px; }

  /* --- PRODUCT / BIKE PAGE --- */
  .product-layout { padding: 16px; }
  .product-name { font-size: 24px; }
  .product-price { font-size: 20px; }
  .product-actions { flex-wrap: wrap; }

  /* --- BREADCRUMB --- */
  .breadcrumb { padding: 10px 16px; }

  /* --- COMMUNITY LEADERBOARD --- */
  .leaderboard-wrap { padding: 12px 12px; }
  .leaderboard-table { font-size: 12px; }
  .community-stats { padding: 12px 16px; }

  /* --- PROFILE PAGE --- */
  .profile-layout { padding: 0 12px; }

}

/* Hide hamburger on desktop */
@media (min-width: 769px) {
  .nav-hamburger { display: none; }
  .mobile-menu { display: none !important; }
}