/* ──────────────────────────────────────────────────────────────────────────
   CX Property Nav · CSS
   ────────────────────────────────────────────────────────────────────── */

/* ── Override old Exchange fixed-header layout when cx-topbar is present ─ */
body:has(#cx-topbar) {
  --header-height: 0px;
  --topline-height: 0px;
  --cx-topbar-h: 90px;
}
body:has(#cx-topbar)::before {
  display: none;
}
@media (max-width: 899px) {
  body:has(#cx-topbar) {
    --cx-topbar-h: 52px;
  }
}

/* ── Topbar shell ─────────────────────────────────────────────────────── */
.cx-topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

/* Brand-tinted accent bar */
.cx-topbar-accent {
  height: 2px;
  background: #5a9fd4;
}
.cx-topbar-accent[data-brand="vault"]    { background: #C9A84C; }
.cx-topbar-accent[data-brand="exchange"] { background: #5a9fd4; }
.cx-topbar-accent[data-brand="lgs"]      { background: #dc2626; }

/* ── Row 1: back + switcher + actions + hamburger ─────────────────────── */
.cx-topbar-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  min-height: 48px;
}

/* Back button */
.cx-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.cx-back-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}
.cx-back-hidden {
  display: none;
}

/* Brand switcher mount fills available space */
#cx-topbar #cx-brand-switcher {
  flex: 1;
  min-width: 0;
}

/* ── Actions strip (right side of row 1) ──────────────────────────────── */
.cx-prop-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cx-actions-loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: cx-spin 0.6s linear infinite;
}
@keyframes cx-spin { to { transform: rotate(360deg); } }

/* Icon buttons (watchlist, notifications) */
.cx-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.cx-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.cx-icon-btn svg {
  display: block;
}

/* Badge (notification count, orders count) */
.cx-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sign in button */
.cx-signin-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f2f2f2;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.cx-signin-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Collector+ button */
.cx-cplus-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(201, 168, 76, 0.12);
  color: #C9A84C;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.cx-cplus-btn:hover {
  background: rgba(201, 168, 76, 0.2);
}

/* Collector+ dropdown */
.cx-cplus-drop {
  position: relative;
}
.cx-cplus-drop .cx-cplus-btn {
  cursor: default;
  border: none;
  font-family: inherit;
}
.cx-cplus-drop-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #0d0d0d;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 10px;
  padding: 10px 0 6px;
  min-width: 220px;
  z-index: 950;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.cx-cplus-drop-menu::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 14px;
}
.cx-cplus-drop.open .cx-cplus-drop-menu {
  display: block;
}
.cx-cplus-drop-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s;
}
.cx-cplus-drop-menu a:hover {
  background: rgba(201, 168, 76, 0.08);
  color: #f2f2f2;
}
.cx-cplus-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

/* Sell Item button */
.cx-sell-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  background: #C9A84C;
  color: #000;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.cx-sell-btn:hover {
  background: #d4b35c;
}

/* Avatar */
.cx-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  flex-shrink: 0;
}
.cx-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Avatar dropdown */
.cx-avatar-drop {
  position: relative;
}
.cx-avatar-drop .cx-avatar {
  cursor: pointer;
  border: none;
  padding: 0;
  font-family: inherit;
}
.cx-avatar-drop-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #0d0d0d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px 0;
  min-width: 160px;
  z-index: 950;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.cx-avatar-drop.open .cx-avatar-drop-menu {
  display: block;
}
.cx-avatar-drop-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s;
}
.cx-avatar-drop-menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f2f2f2;
}

/* Hamburger sign-out */
.cx-ham-signout {
  color: rgba(255, 80, 80, 0.85) !important;
}
.cx-ham-signout:hover {
  color: #ff5050 !important;
}

/* Hamburger toggle */
.cx-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.cx-hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ── Row 2: property nav ──────────────────────────────────────────────── */
.cx-topbar-row2 {
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cx-prop-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  min-width: 0;
}

/* Row 2 social icons (right side) */
.cx-row2-socials {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  flex-shrink: 0;
}
.cx-row2-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
}
.cx-row2-social:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
}
.cx-prop-nav::-webkit-scrollbar { display: none; }

.cx-prop-nav a {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.cx-prop-nav a:hover {
  color: rgba(255, 255, 255, 0.9);
}
.cx-prop-nav a.active {
  color: #C9A84C;
  font-weight: 600;
  border-bottom-color: #C9A84C;
}

/* Orders badge (inline) */
.cx-orders-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 6px;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
}

/* ── Hamburger overlay ────────────────────────────────────────────────── */
.cx-ham {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 10, 0.98);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px 40px;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.25s, transform 0.25s ease;
}
.cx-ham.is-open {
  opacity: 1;
  transform: translateX(0);
}

.cx-ham-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
}

.cx-ham-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C9A84C, #a88a3a);
}
.cx-ham-logo-mark {
  font-size: 14px;
  font-weight: 800;
  color: #000;
}

.cx-ham-user {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #f2f2f2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-ham-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}
.cx-ham-close:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.cx-ham-link {
  display: block;
  padding: 12px 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}
.cx-ham-link:hover {
  color: #fff;
}
.cx-ham-active {
  color: #C9A84C !important;
  font-weight: 600;
}

.cx-ham-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

.cx-ham-section {
  padding: 12px 0 4px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cx-ham-signin {
  color: #C9A84C !important;
  font-weight: 600;
}

.cx-ham-cplus {
  color: #C9A84C !important;
}

.cx-ham-discord {
  color: #7289da !important;
}

/* Social icon row */
.cx-ham-socials {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}
.cx-ham-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.15s;
}
.cx-ham-social-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Avatar inside hamburger header */
.cx-ham-header .cx-avatar {
  width: 36px;
  height: 36px;
  font-size: 15px;
}

/* ── Mobile breakpoint (< 900px) ─────────────────────────────────────── */
@media (max-width: 899px) {
  .cx-topbar-row2 {
    display: none;
  }
  .cx-hamburger {
    display: inline-flex;
  }
  .cx-hide-mobile {
    display: none !important;
  }
  .cx-topbar-row1 {
    padding: 6px 12px;
  }
  .cx-signin-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
  .cx-cplus-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
}

/* ── Vault bottom nav (mobile only) ───────────────────────────────────── */
.cx-vault-bnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 900;
  justify-content: space-around;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
}
.cx-vbn-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  font-size: 0.5625rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 8px;
}
.cx-vbn-tab.cx-vbn-active {
  color: #C9A84C;
}
.cx-vbn-icon {
  font-size: 1.125rem;
  line-height: 1;
}

@media (max-width: 899px) {
  .cx-vault-bnav {
    display: flex;
  }
  body:has(.cx-vault-bnav) {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Small screens ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .cx-prop-actions {
    gap: 4px;
  }
  .cx-icon-btn {
    width: 34px;
    height: 34px;
    padding: 8px;
  }
  .cx-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}
