/* ==========================================
   ArbiMax Header v2 - Clean Rebuild
   Build: 20260201_HDRv2
   ==========================================
   
   STRUCTURE:
   .hdrv2 (header root)
     .hdrv2__top         → Meta info strip (inside header)
       .hdrv2__meta      → Meta items container
     .hdrv2__main        → Main header row (dir="rtl")
       .hdrv2__right     → Burger + logo + brand + status
       .hdrv2__left      → Permissions + logout
   
   ========================================== */

/* ==========================================
   TOKENS
   ========================================== */
:root {
  --hv2-accent: #2DA4FF;
  --hv2-accent-glow: rgba(45, 164, 255, 0.35);
  --hv2-accent-strong: rgba(45, 164, 255, 0.55);
  --hv2-bg: rgba(8, 12, 20, 0.88);
  --hv2-bg-blur: rgba(10, 14, 24, 0.92);
  --hv2-stroke: rgba(255, 255, 255, 0.09);
  --hv2-stroke-hover: rgba(255, 255, 255, 0.16);
  --hv2-text: rgba(255, 255, 255, 0.92);
  --hv2-muted: rgba(255, 255, 255, 0.55);
  --hv2-dim: rgba(255, 255, 255, 0.30);
  --hv2-green: #10B981;
  --hv2-meta-h: 28px;
  --hv2-main-h: 68px;
}

/* ==========================================
   DISABLE CONFLICTING OLD HEADER STYLES
   ========================================== */
/* Hide any old topstrips or duplicate headers */
.app-topstrip,
header.top:not(.hdrv2),
.hdr-meta:not(.hdrv2__meta *) {
  display: none !important;
  visibility: hidden !important;
}

/* ==========================================
   HEADER V2 ROOT
   ========================================== */
.hdrv2 {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--hv2-bg-blur);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid var(--hv2-stroke);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.28);
}

/* ==========================================
   META ROW (TOP - Inside Header)
   ========================================== */
.hdrv2__top {
  height: var(--hv2-meta-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid var(--hv2-stroke);
  overflow: hidden;
}

.hdrv2__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--hv2-muted);
}

.hdrv2__meta .metaItem {
  transition: color 0.15s ease;
}

.hdrv2__meta .metaItem.connected {
  color: var(--hv2-green);
  font-weight: 600;
}

/* API status dot indicator */
.hdrv2__meta .metaItem.connected::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hv2-green);
  margin-left: 4px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  animation: apiDotPulse 2s ease-in-out infinite;
}

@keyframes apiDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.hdrv2__meta .metaItem.offline {
  color: #ef4444;
}

.hdrv2__meta .sep {
  color: var(--hv2-dim);
  font-size: 7px;
}

/* ==========================================
   MAIN HEADER ROW
   ========================================== */
.hdrv2__main {
  height: var(--hv2-main-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  gap: 12px;
}

/* Right cluster: burger + logo + brand + status */
.hdrv2__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Left cluster: permissions + logout */
.hdrv2__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================
   BURGER BUTTON
   ========================================== */
.hdrv2 .burger-btn,
.hdrv2 #collapseBtn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--hv2-stroke);
  border-radius: 10px;
  color: var(--hv2-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.hdrv2 .burger-btn:hover,
.hdrv2 #collapseBtn:hover {
  background: rgba(45, 164, 255, 0.08);
  border-color: rgba(45, 164, 255, 0.3);
  color: var(--hv2-accent);
}

.hdrv2 .burger-btn:active,
.hdrv2 #collapseBtn:active {
  transform: scale(0.94);
}

.hdrv2 .burger-btn svg,
.hdrv2 #collapseBtn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================
   LOGO CONTAINER - Circular + Pulsing Ring
   ========================================== */
.hdrv2__logo {
  position: relative;
  width: 58px;
  height: 58px;
  flex-shrink: 0;
}

.hdrv2__logoInner {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(145deg, #0d1320 0%, #151d2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hv2-stroke);
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hdrv2__logoInner:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 20px rgba(45, 164, 255, 0.2);
}

.hdrv2__logoInner img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

/* Slow pulsing ring - reduced to 0.7x */
.hdrv2__logo::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: linear-gradient(135deg, rgba(45, 164, 255, 0.32), rgba(99, 211, 255, 0.18)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: hdrv2RingPulse 3.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes hdrv2RingPulse {
  0%, 100% {
    opacity: 0.25;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.028);
  }
}

/* ==========================================
   BRAND (Name + Status)
   ========================================== */
.hdrv2__brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}

.hdrv2__brandName {
  font-size: 19px;
  font-weight: 700;
  color: var(--hv2-text);
  letter-spacing: -0.3px;
  line-height: 1.1;
  white-space: nowrap;
}

.hdrv2__brandStatus {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: var(--hv2-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Status dot */
.hdrv2__brandStatus .statusDot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hv2-dim);
  flex-shrink: 0;
}

.hdrv2__brandStatus.admin .statusDot {
  background: var(--hv2-accent);
}

.hdrv2__brandStatus.trader .statusDot {
  background: var(--hv2-green);
}

.hdrv2__brandStatus.verifying .statusDot {
  background: #f59e0b;
}

/* ==========================================
   PERMISSIONS TEXT
   ========================================== */
.hdrv2__perm {
  font-size: 12px;
  color: var(--hv2-muted);
  white-space: nowrap;
}

.hdrv2__perm .permValue {
  color: var(--hv2-text);
  font-weight: 600;
  margin-right: 4px;
}

/* ==========================================
   LOGOUT BUTTON
   ========================================== */
.hdrv2 .logout-btn,
.hdrv2 #logoutBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--hv2-muted);
  background: transparent;
  border: 1px solid var(--hv2-stroke);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.hdrv2 .logout-btn:hover,
.hdrv2 #logoutBtn:hover {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.08);
}

.hdrv2 .logout-btn:active,
.hdrv2 #logoutBtn:active {
  transform: scale(0.96);
}

/* ==========================================
   HIDDEN LEGACY COMPAT
   ========================================== */
.hdrv2 .hidden,
.hdrv2 [style*="display:none"],
.hdrv2 [style*="display: none"] {
  display: none !important;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  .hdrv2__main {
    padding: 0 12px;
  }
  
  .hdrv2__logo {
    width: 44px;
    height: 44px;
  }
  
  .hdrv2__logoInner img {
    width: 26px;
    height: 26px;
  }
  
  .hdrv2__brandName {
    font-size: 15px;
  }
  
  .hdrv2__perm {
    display: none;
  }
  
  .hdrv2__right {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .hdrv2__brandStatus {
    display: none;
  }
  
  .hdrv2__meta {
    font-size: 9px;
  }
}
