/* Core header styles */
.site-header{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #0b1220;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.header-inner{
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap; /* default: keep everything on one row */
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-logo{ width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.brand-text{ font-weight: 900; letter-spacing: .04em; }

.nav-links{ display: flex; gap: 12px; align-items: center; min-width: 0; }
.cat-nav{ display: flex; gap: 12px; flex-wrap: wrap; }
.cat-nav a{
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 10px;
}
.cat-nav a.active,
.cat-nav a:hover{ background: rgba(255,255,255,.08); color: #fff; }

/* Backward-compat: keep .nav styling too */
.nav{ all: unset; }
.nav{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.nav a{
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 10px;
}
.nav a.active,
.nav a:hover{ background: rgba(255,255,255,.08); color: #fff; }

.header-right{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.ad-slot{
  min-width: 260px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
}

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

.me{
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.me .avatar{ width: 26px; height: 26px; border-radius: 999px; object-fit: cover; }

.btn{
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  text-decoration: none;
  background: rgba(255,255,255,.05);
  white-space: nowrap;
}
.btn-primary{ background: rgba(0,200,255,.14); border-color: rgba(0,200,255,.30); }

/* Prevent horizontal scrolling */
html, body{ max-width: 100%; overflow-x: hidden; }

/* Hamburger (hidden on desktop) */
.hamburger{
  display: none;
  background: transparent;
  color: rgba(255,255,255,.95);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  flex: 0 0 auto;
}
.hamburger span{
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  margin: 4px 0;
  border-radius: 2px;
}

/* Mobile dropdown menu */
.mobile-menu{
  display: none;
  background: #0b1220;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px 16px;
}
.mobile-menu.open{ display: block; }
.mobile-menu a{
  display: block;
  padding: 10px 10px;
  border-radius: 12px;
  color: rgba(255,255,255,.9);
  text-decoration: none;
}
.mobile-menu a.active,
.mobile-menu a:hover{ background: rgba(255,255,255,.08); color: #fff; }

.mobile-sep{
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 10px 0;
}

/* Tablet+Mobile */
@media (max-width: 820px){
  .nav-links{ display: none; }          /* hide desktop nav */
  .hamburger{ display: inline-block; }  /* show hamburger */

  /* On mobile, keep header clean: use hamburger menu for actions */
  .header-right{ display: none; }
  #headerAdSlot{ display: none; }       /* hide large header ad */

  /* tighten spacing so Upload/Login don't wrap */
  .header-inner{ padding: 10px 12px; gap: 10px; }
  .header-right{ gap: 8px; flex: 0 0 auto; }
  .auth{ gap: 8px; }

  .btn{ padding: 7px 10px; border-radius: 10px; }
}

/* Very small phones */
@media (max-width: 380px){
  .brand-text{ font-size: 16px; }
  /* Keep top row clean: hide Register and rely on hamburger for it */
  .auth a[href="/register.php"]{ display: none; }
}
