/* ==========================================
   ArbiMax Layout Shell - Header & Sidebar
   Build: 20260201_SOFT_BLUE_THEME
   ==========================================
   
   VISUAL REDESIGN ONLY - All route links, IDs,
   and click handlers are preserved.
   ========================================== */

/* ==========================================
   HEADER - Sticky Glass Top Bar
   ========================================== */
header.top,
.header,
.navbar,
.top-bar,
[data-header] {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 70px;
  background: var(--am-panel-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--am-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--am-space-6, 24px);
  gap: var(--am-space-5, 20px);
  transition: all 0.3s ease;
}

/* Header on scroll - add shadow */
header.top.scrolled,
.header.scrolled {
  box-shadow: var(--am-shadow-md);
  background: var(--am-panel);
}

/* ==========================================
   BRAND SECTION (Left)
   ========================================== */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-anim {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--am-accent), var(--am-accent-strong));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--am-accent-glow);
  padding: 0;
  line-height: 0;
  text-align: center;
  transition: all 0.3s ease;
}

.brand-logo-anim:hover {
  transform: scale(1.05);
  box-shadow: 0 0 28px var(--am-accent-glow);
}

.brand-logo-anim img,
.brand-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

header.top h1 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, #fff, var(--am-text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

/* ==========================================
   HEADER RIGHT SECTION
   ========================================== */
.header-right,
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Status indicator dot in header */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--am-accent);
  box-shadow: 0 0 8px var(--am-accent-glow);
}

.status-dot.live,
.status-dot.online {
  background: var(--am-profit);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-dot.offline,
.status-dot.error {
  background: var(--am-loss);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* ==========================================
   LOGOUT BUTTON (Soft Blue)
   ========================================== */
.btn-logout,
#logoutBtn,
[data-logout] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--am-accent-bg);
  color: var(--am-accent);
  border: 1px solid var(--am-accent-border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}

.btn-logout:hover,
#logoutBtn:hover {
  background: var(--am-accent-dim);
  border-color: var(--am-accent);
  box-shadow: var(--am-glow-accent);
  transform: translateY(-1px);
}

.btn-logout:active,
#logoutBtn:active {
  transform: translateY(0) scale(0.98);
}

/* ==========================================
   SIDEBAR - Glass Vertical Navigation
   ========================================== */
#arbimax-sidebar,
.sidebar,
.left-sidebar,
[data-sidebar] {
  width: var(--am-sidebar-width-expanded, 256px);
  background: var(--am-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--am-border);
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: width 0.3s ease, padding 0.3s ease;
  transform-origin: right;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar scrollable nav container */
.sidebar__nav,
#arbimax-sidebar ul,
.sidebar-nav-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--am-space-lg, 24px) var(--am-space-md, 16px);
  margin: 0;
  list-style: none;
}

/* Sidebar scrollbar */
#arbimax-sidebar ul::-webkit-scrollbar,
.sidebar__nav::-webkit-scrollbar {
  width: 4px;
}

#arbimax-sidebar ul::-webkit-scrollbar-track,
.sidebar__nav::-webkit-scrollbar-track {
  background: transparent;
}

#arbimax-sidebar ul::-webkit-scrollbar-thumb,
.sidebar__nav::-webkit-scrollbar-thumb {
  background: var(--am-border-strong);
  border-radius: 4px;
}

#arbimax-sidebar ul::-webkit-scrollbar-thumb:hover,
.sidebar__nav::-webkit-scrollbar-thumb:hover {
  background: var(--am-accent);
}

/* ==========================================
   SIDEBAR NAVIGATION ITEMS
   ========================================== */
.sidebar-link,
.nav-item,
.sidebar-item,
[data-nav-item] {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 6px;
  border-radius: 12px;
  color: var(--am-text-muted);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

/* Navigation Item Text */
.sidebar-link .nav-text,
.nav-item .nav-text {
  margin-inline-start: 12px;
  flex: 1;
  transition: color 0.25s ease;
}

/* Soft Blue Dot Indicator */
.sidebar-link .am-nav-dot,
.nav-item .am-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--am-accent);
  box-shadow: 0 0 8px var(--am-accent-glow);
  opacity: 0.35;
  transition: all 0.25s ease;
  position: relative;
  flex-shrink: 0;
}

/* ==========================================
   NAV ITEM HOVER STATE
   ========================================== */
.sidebar-link:hover,
.nav-item:hover,
.sidebar-item:hover {
  background: var(--am-hover-bg);
  color: var(--am-text);
  transform: translateX(-4px);
  border-color: var(--am-border);
}

.sidebar-link:hover .am-nav-dot,
.nav-item:hover .am-nav-dot {
  opacity: 0.7;
  transform: scale(1.15);
  box-shadow: 0 0 12px var(--am-accent-glow);
}

/* RTL hover adjustment */
[dir="rtl"] .sidebar-link:hover,
[dir="rtl"] .nav-item:hover {
  transform: translateX(4px);
}

/* ==========================================
   NAV ITEM ACTIVE STATE (Soft Blue Gradient)
   ========================================== */
.sidebar-link.active,
.nav-item.active,
.sidebar-item.active,
.nav-item[data-route].active {
  background: linear-gradient(135deg, 
    rgba(106, 174, 255, 0.15) 0%, 
    rgba(47, 125, 255, 0.08) 100%
  );
  color: var(--am-accent-2);
  font-weight: 600;
  border: 1px solid var(--am-accent-border);
  box-shadow: 
    0 0 20px rgba(106, 174, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Active indicator bar (left side accent strip) */
.sidebar-link.active::before,
.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; /* RTL: right side */
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, var(--am-accent), var(--am-accent-strong));
  border-radius: 3px 0 0 3px;
  box-shadow: 0 0 8px var(--am-accent-glow);
}

/* LTR: left side */
[dir="ltr"] .sidebar-link.active::before,
[dir="ltr"] .nav-item.active::before {
  left: 0;
  right: auto;
  border-radius: 0 3px 3px 0;
}

.sidebar-link.active .am-nav-dot,
.nav-item.active .am-nav-dot {
  opacity: 1;
  background: var(--am-accent);
  box-shadow: 
    0 0 12px rgba(106, 174, 255, 0.6),
    0 0 24px rgba(106, 174, 255, 0.3);
  transform: scale(1.2);
}

/* ==========================================
   NAV ITEM PRESS/CLICK STATE
   ========================================== */
.sidebar-link:active,
.nav-item:active {
  transform: translateX(-2px) scale(0.98);
  transition: transform 0.1s ease;
}

[dir="rtl"] .sidebar-link:active,
[dir="rtl"] .nav-item:active {
  transform: translateX(2px) scale(0.98);
}

/* Activation pulse animation */
.sidebar-link.is-activating .am-nav-dot,
.nav-item.is-activating .am-nav-dot {
  animation: navDotPulseBlue 0.4s ease-out;
}

@keyframes navDotPulseBlue {
  0% {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(106, 174, 255, 0.6);
  }
  50% {
    transform: scale(1.6);
    box-shadow: 
      0 0 20px rgba(106, 174, 255, 0.8),
      0 0 40px rgba(106, 174, 255, 0.4);
  }
  100% {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(106, 174, 255, 0.6);
  }
}

/* ==========================================
   SIDEBAR COLLAPSED STATE
   ========================================== */
body.sidebar-collapsed #arbimax-sidebar,
body.sidebar-collapsed .sidebar {
  width: var(--am-sidebar-width-collapsed, 64px);
  padding: 0;
}

body.sidebar-collapsed #arbimax-sidebar ul,
body.sidebar-collapsed .sidebar__nav {
  padding: var(--am-space-lg, 24px) var(--am-space-sm, 8px);
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 14px 8px;
  min-height: 44px;
  position: relative;
}

body.sidebar-collapsed .sidebar-link .nav-text,
body.sidebar-collapsed .nav-item .nav-text {
  display: none;
}

body.sidebar-collapsed .sidebar-link .am-nav-dot,
body.sidebar-collapsed .nav-item .am-nav-dot {
  margin: 0;
}

/* Tooltip on collapsed hover */
body.sidebar-collapsed .sidebar-link:hover::after,
body.sidebar-collapsed .nav-item:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 12px;
  padding: 8px 14px;
  background: var(--am-panel-2);
  color: var(--am-text);
  font-size: 13px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  border: 1px solid var(--am-border);
  backdrop-filter: blur(12px);
  box-shadow: var(--am-shadow-md);
}

/* Tooltip arrow */
body.sidebar-collapsed .sidebar-link:hover::before,
body.sidebar-collapsed .nav-item:hover::before {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 6px;
  border: 6px solid transparent;
  border-right-color: var(--am-panel-2);
  z-index: 1000;
  pointer-events: none;
}

/* Hide active bar in collapsed mode */
body.sidebar-collapsed .sidebar-link.active::before,
body.sidebar-collapsed .nav-item.active::before {
  display: none;
}

/* ==========================================
   ADMIN SECTION STYLING
   ========================================== */
#adminNav > div,
.admin-control-label {
  padding: 10px 18px;
  font-size: 10px;
  color: var(--am-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#adminNav hr {
  border: none;
  border-top: 1px solid var(--am-border);
  margin: 12px 0;
}

body.sidebar-collapsed #adminNav > div {
  display: none;
}

body.sidebar-collapsed #adminNav hr {
  margin: 8px 4px;
}

/* ==========================================
   SIDEBAR TOGGLE BUTTON
   ========================================== */
.collapse-btn,
.sidebar-toggle {
  background: transparent !important;
  border: none;
  color: var(--am-text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.25s ease;
}

.collapse-btn:hover,
.sidebar-toggle:hover {
  background: var(--am-hover-bg) !important;
  color: var(--am-text);
}

/* ==========================================
   LAYOUT ROOT
   ========================================== */
#layout-root {
  display: flex;
  flex: 1;
  height: calc(100vh - 70px);
  overflow: hidden;
}

/* Main content area */
#main-content,
.main-content,
.main-panel,
.content-area,
[data-main] {
  flex: 1;
  overflow-y: auto;
  background: transparent;
  z-index: 10;
  position: relative;
  padding: var(--am-page-pad, 32px) var(--am-space-8, 40px);
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  header.top,
  .header {
    height: 60px;
    padding: 0 16px;
    gap: 12px;
  }

  .brand-logo-anim,
  .brand-logo-anim img {
    width: 36px;
    height: 36px;
  }

  header.top h1 {
    font-size: 16px;
  }

  #arbimax-sidebar,
  .sidebar {
    width: 260px;
    position: fixed;
    left: -260px;
    z-index: 100;
    height: 100vh;
    top: 0;
    transition: left 0.3s ease;
  }

  body.sidebar-open #arbimax-sidebar,
  body.sidebar-open .sidebar {
    left: 0;
  }

  /* Mobile overlay */
  body.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    backdrop-filter: blur(4px);
  }

  #main-content,
  .main-content {
    padding: 20px 16px;
  }

  .btn-logout,
  #logoutBtn {
    font-size: 11px;
    padding: 6px 12px;
  }

  .pill {
    font-size: 10px;
    padding: 3px 8px;
  }
}

/* ==========================================
   HIDE ON AUTH PAGES
   ========================================== */
body.auth-public #arbimax-sidebar,
body.auth-public .sidebar,
body.auth-public header.top,
body.auth-public .header,
body.auth-public #body-wrapper,
body.auth-public #layout-root {
  display: none !important;
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
.sidebar-link:focus-visible,
.nav-item:focus-visible {
  outline: none;
  box-shadow: var(--am-focus-ring);
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--am-accent);
  color: white;
  padding: 8px 16px;
  z-index: 1000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}
