/* ============================================================
   ADONIS — Unified site header (all public pages)
   Load after home.css / marketplace.css
   ============================================================ */

:root {
  --header-h: 64px;
  --header-h-mobile: 60px;
  --ticker-h: 38px;
  --ticker-h-mobile: 34px;
  --header-gold: #ffbd59;
  --header-bg: rgba(8, 9, 12, 0.88);
  --nav-chip-size: 38px;
}

body {
  padding-top: calc(var(--header-h) + var(--ticker-h));
  overflow-x: clip;
}

html {
  overflow-x: clip;
}

/* ─── Navbar shell (grid — stable in RTL) ─────────────────── */
.custom-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  width: 100%;
  max-width: 100%;
  height: var(--header-h);
  direction: ltr;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "nav-start nav-center nav-end";
  align-items: center;
  gap: 8px;
  padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  overflow: hidden;
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border-bottom: 1px solid rgba(255, 189, 89, 0.14);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.custom-navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(280px, 55%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 189, 89, 0.45), transparent);
  pointer-events: none;
}

.custom-navbar > .hamburger-btn,
.custom-navbar > .navbar-logo,
.custom-navbar > .desktop-nav,
.custom-navbar > .mobile-header-lang,
.custom-navbar > .desktop-auth {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
}

/* ─── Logo ───────────────────────────────────────────────── */
.navbar-logo {
  grid-area: nav-center;
  justify-self: center;
  display: flex;
  align-items: center;
  text-decoration: none;
  z-index: 10;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.navbar-logo:hover {
  opacity: 0.92;
  transform: scale(1.02);
}

.navbar-logo img {
  height: 38px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}

/* ─── Desktop nav ────────────────────────────────────────── */
.desktop-nav {
  grid-area: nav-start;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

html[lang="ar"] .desktop-nav .nav-link {
  direction: rtl;
}

.desktop-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.desktop-nav .nav-link:hover {
  color: var(--header-gold);
  background: rgba(255, 189, 89, 0.08);
}

.desktop-nav .nav-link.active {
  color: var(--header-gold);
  font-weight: 700;
  background: rgba(255, 189, 89, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 189, 89, 0.22);
}

.desktop-nav .nav-link i {
  font-size: 0.82rem;
  opacity: 0.9;
}

/* ─── Auth area ──────────────────────────────────────────── */
.desktop-auth {
  grid-area: nav-end;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  flex-shrink: 0;
}

/* ─── Unified nav chips (lang, avatar, logout) ─────────────── */
.nav-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--nav-chip-size);
  height: var(--nav-chip-size);
  min-width: var(--nav-chip-size);
  min-height: var(--nav-chip-size);
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 189, 89, 0.55);
  background: rgba(255, 189, 89, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  overflow: hidden;
  box-sizing: border-box;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.nav-chip:hover {
  transform: scale(1.06);
  border-color: var(--header-gold);
  box-shadow: 0 0 0 3px rgba(255, 189, 89, 0.18), 0 4px 14px rgba(0, 0, 0, 0.3);
  background: rgba(255, 189, 89, 0.12);
}

.nav-chip.is-open {
  border-color: var(--header-gold);
  background: rgba(255, 189, 89, 0.16);
  box-shadow: 0 0 0 3px rgba(255, 189, 89, 0.2);
}

.nav-chip--avatar img,
#nav-avatar,
#nav-avatar-mobile {
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  border: none;
  border-radius: 0;
  object-fit: cover;
  object-position: center center;
  display: block;
  pointer-events: none;
}

.nav-chip--lang {
  color: var(--header-gold);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-chip--lang .lang-label {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: 1;
  color: inherit;
}

.nav-chip--logout {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
}

.nav-chip--logout i {
  line-height: 1;
  pointer-events: none;
}

#user-nav-profile {
  display: none;
  align-items: center;
  gap: 8px;
}

.sidebar-profile-chip {
  display: none;
  margin: 0 auto 8px;
}

.sidebar-profile-chip.is-visible {
  display: inline-flex !important;
}

.desktop-auth .lang-dropdown-btn.nav-chip,
.mobile-header-lang .lang-dropdown-btn.nav-chip {
  width: var(--nav-chip-size);
  height: var(--nav-chip-size);
  min-width: var(--nav-chip-size);
  min-height: var(--nav-chip-size);
  padding: 0;
  border-radius: 50%;
}

#login-btn-nav {
  font-weight: 700;
  background: var(--header-gold);
  color: #111 !important;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(255, 189, 89, 0.3);
  transition: transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

#login-btn-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(255, 189, 89, 0.4);
}

/* ─── News announcements (rotate, center hold) ─────────────── */
.site-news-bar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 8999;
  width: 100%;
  max-width: 100%;
  height: var(--ticker-h);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  box-sizing: border-box;
  background: #544a7d;
  background: -webkit-linear-gradient(to right, #ffd452, #544a7d);
  background: linear-gradient(to right, #ffd452, #544a7d);
  box-shadow: 0 4px 20px rgba(84, 74, 125, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.site-news-bar__viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.site-news-bar__rotator {
  position: absolute;
  inset: 0;
}

html[lang="en"] .site-news-bar__rotator--en,
html[lang="ar"] .site-news-bar__rotator--ar {
  display: block;
}

.site-news-bar__stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  box-sizing: border-box;
}

.site-news-bar__line {
  margin: 0;
  max-width: min(920px, 92vw);
  color: #fff;
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition:
    opacity 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.site-news-bar__line.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.site-news-bar__line.is-leaving {
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
}

.site-news-bar__line.is-entering {
  opacity: 0;
  transform: translateY(14px) scale(0.97);
}

html[lang="ar"] .site-news-bar__line.is-leaving {
  transform: translateY(-12px) scale(0.98);
}

html[lang="ar"] .site-news-bar__line.is-entering {
  transform: translateY(14px) scale(0.97);
}

/* Admin preview — dot separator between messages (not part of message text) */
.ticker-sep {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 12px;
  border-radius: 50%;
  background: #ffbd59;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(255, 189, 89, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .site-news-bar__line {
    transition-duration: 0.12s;
  }
}

/* ─── Hamburger ──────────────────────────────────────────── */
.hamburger-btn {
  display: none;
  grid-area: nav-start;
  justify-self: start;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 14px;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  z-index: 10;
}

.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─── Mobile sidebar ─────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: -100%;
  width: 280px;
  max-width: 80vw;
  height: 100%;
  background: #111;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

html[lang="ar"] .mobile-sidebar {
  left: auto;
  right: -100%;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

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

html[lang="ar"] .mobile-sidebar.open {
  left: auto;
  right: 0;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 18px 22px;
  background: linear-gradient(160deg, #1a1a1a 0%, #000 100%);
  border-bottom: 1px solid rgba(255, 189, 89, 0.2);
  position: relative;
  text-align: center;
  gap: 6px;
}

.sidebar-header-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.sidebar-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #aaa;
  font-size: 1.1rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

html[lang="ar"] .sidebar-close-btn {
  right: auto;
  left: 12px;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.sidebar-nav-links {
  padding: 12px 0;
  flex: 1;
}

.sidebar-nav-links a {
  display: block;
  color: #e0e0e0;
  text-decoration: none;
  font-size: 1rem;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}

html[lang="ar"] .sidebar-nav-links a {
  text-align: right;
  direction: rtl;
}

.sidebar-nav-links a:hover {
  background: rgba(255, 189, 89, 0.1);
  color: var(--header-gold);
}

.sidebar-nav-links a.active {
  color: var(--header-gold);
  background: rgba(255, 189, 89, 0.1);
  font-weight: 700;
}

.sidebar-actions {
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-btn {
  display: block;
  text-align: center;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.1s;
  border: none;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-btn:active {
  transform: scale(0.97);
}

.sidebar-btn-login {
  background: var(--header-gold);
  color: #000;
  box-shadow: 0 2px 8px rgba(255, 189, 89, 0.35);
}

.sidebar-btn-logout {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #fff;
}

/* ─── Language switcher ──────────────────────────────────── */
.lang-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-dropdown-btn {
  appearance: none;
  -webkit-appearance: none;
}

.lang-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 72px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 189, 89, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 99100;
  animation: langDropIn 0.18s ease;
  padding: 4px;
}

html[lang="ar"] .lang-dropdown-menu {
  right: auto;
  left: 0;
}

.lang-dropdown-menu.open {
  display: block;
}

@keyframes langDropIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #ccc;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}

.lang-option:hover {
  background: rgba(255, 189, 89, 0.1);
  color: var(--header-gold);
}

.lang-option.active {
  background: rgba(255, 189, 89, 0.14);
  color: var(--header-gold);
}

.mobile-header-lang {
  display: none;
  grid-area: nav-end;
  justify-self: end;
  align-items: center;
  z-index: 10;
  flex-shrink: 0;
}

/* ─── Sidebar active (legacy alias) ──────────────────────── */
.sidebar-nav-links a.sidebar-link--active {
  color: var(--header-gold);
  background: rgba(255, 189, 89, 0.1);
  font-weight: 700;
}

/* ─── Lang switcher (all page variants) ──────────────────── */
html[lang="ar"] .login-en,
html[lang="ar"] .t-en,
html[lang="ar"] .mp-en { display: none !important; }

html[lang="en"] .login-ar,
html[lang="en"] .t-ar,
html[lang="en"] .mp-ar { display: none !important; }

@media (max-width: 1280px) {
  .desktop-nav .nav-link {
    padding: 7px 9px;
    font-size: 0.82rem;
  }

  #login-btn-nav {
    padding: 7px 11px;
    font-size: 0.78rem;
  }
}

@media (max-width: 991px) {
  body {
    padding-top: calc(var(--header-h-mobile) + var(--ticker-h-mobile));
  }

  .custom-navbar {
    height: var(--header-h-mobile);
  }

  .site-news-bar {
    top: var(--header-h-mobile);
    height: var(--ticker-h-mobile);
  }

  .site-news-bar__line {
    font-size: 0.84rem;
  }

  .hamburger-btn {
    display: flex;
  }

  .navbar-logo img {
    height: 34px;
  }

  .mobile-header-lang {
    display: flex;
  }

  .desktop-nav,
  .desktop-auth {
    display: none !important;
  }
}
