/* ============================================
   BOMAtlas Header System
   Matches BOMForge.com: clean, flat, dark
   ============================================ */

/* Header Container: dark grey bar, slightly lighter than dropdown */
.bomatlas-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #141414;
  border-bottom: 1px solid #262626;
  transition: background 200ms ease;
}

.bomatlas-header.scrolled {
  background: rgba(20, 20, 20, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Remove the gold gradient line */
.bomatlas-header::after {
  display: none;
}

.bomatlas-header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

/* Logo */
.bomatlas-logo {
  color: #f8fafc;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: opacity 150ms ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bomatlas-logo:hover {
  opacity: 0.85;
}

/* Product switcher styling */
.bomatlas-product-switcher {
  margin-right: auto;
}

.bomatlas-product-switcher .bomatlas-logo {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: none;
  font-family: inherit;
}

.bomatlas-product-switcher .bomatlas-logo:hover {
  background: rgba(255, 255, 255, 0.05);
}

.bomatlas-logo-chevron {
  font-size: 10px;
  margin-left: 4px;
  color: #64748b;
  transition: transform 180ms ease;
}

.bomatlas-product-switcher
  .bomatlas-nav-dropdown-trigger[aria-expanded='true']
  .bomatlas-logo-chevron {
  transform: rotate(180deg);
}

.bomatlas-product-switcher .bomatlas-nav-dropdown-menu {
  min-width: 280px;
}

/* Hide duplicate CSS triangle on product switcher (already has HTML chevron) */
.bomatlas-product-switcher .bomatlas-nav-dropdown-trigger::after {
  display: none;
}

/* Product dropdown items */
.bomatlas-nav-dropdown-item strong {
  display: block;
  color: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.bomatlas-nav-dropdown-item-text {
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.bomatlas-nav-dropdown-item-desc {
  font-size: 12px;
  color: #71717a;
  font-weight: 400;
}

/* Product Logo in dropdown: icon with subtle border */
.bomatlas-product-logo {
  width: 28px;
  height: 28px;
  margin-right: 12px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: contain;
}

/* Coming Soon badge: solid green, white text */
.bomatlas-coming-soon-badge {
  font-size: 10px;
  background: #22c55e;
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Coming soon item styling */
.bomatlas-nav-dropdown-item.coming-soon {
  opacity: 0.7;
  cursor: default;
}

.bomatlas-nav-dropdown-item.coming-soon:hover {
  background: transparent;
  transform: none;
  border-left-color: transparent;
}

.coming-soon-badge {
  color: #52525b;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bomatlas-nav-section-header {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bomatlas-logo-accent {
  color: #3b82f6;
  -webkit-text-fill-color: #3b82f6;
}

/* Navigation Container */
.bomatlas-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Navigation Links */
.bomatlas-nav-link,
.bomatlas-nav-link:link,
.bomatlas-nav-link:visited {
  position: relative;
  color: #a1a1aa;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0;
  padding: 6px 12px;
  border-radius: 6px;
  transition:
    color 150ms ease,
    background 150ms ease;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove the sweep animation */
.bomatlas-nav-link::before {
  display: none;
}

.bomatlas-nav-link:hover {
  color: #f4f4f5;
  background: rgba(255, 255, 255, 0.06);
}

.bomatlas-nav-link.active {
  color: #f4f4f5;
  background: rgba(255, 255, 255, 0.08);
}

.bomatlas-nav-link:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* External Link Icon */
.bomatlas-external-icon {
  width: 12px;
  height: 12px;
  opacity: 0.6;
  transition: opacity 180ms ease;
}

.bomatlas-nav-link:hover .bomatlas-external-icon {
  opacity: 1;
}

/* Auth link styling: primary CTA button */
.bomatlas-nav-link-auth {
  color: #fff !important;
  font-weight: 600;
  background: #3b82f6 !important;
  border-radius: 6px;
  padding: 6px 14px !important;
}

.bomatlas-nav-link-auth:hover {
  color: #fff !important;
  background: #2563eb !important;
}

/* Dropdown */
.bomatlas-nav-dropdown {
  position: relative;
}

.bomatlas-nav-dropdown-trigger {
  position: relative;
  color: #a1a1aa;
  background: none;
  border: none;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    color 150ms ease,
    background 150ms ease;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bomatlas-nav-dropdown-trigger::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 200ms ease;
}

.bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-trigger,
.bomatlas-nav-dropdown:focus-within .bomatlas-nav-dropdown-trigger {
  background: rgba(255, 255, 255, 0.06);
  color: #f4f4f5;
}

.bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-trigger::after,
.bomatlas-nav-dropdown:focus-within .bomatlas-nav-dropdown-trigger::after {
  transform: rotate(180deg);
}

/* Dropdown Menu: dark black, rounded */
.bomatlas-nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  background: #0c0c0c;
  border: 1px solid #262626;
  border-radius: 10px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  z-index: 1001;
}

.bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-menu,
.bomatlas-nav-dropdown:focus-within .bomatlas-nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dropdown Items */
.bomatlas-nav-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px;
  color: #a1a1aa;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  transition:
    color 150ms ease,
    background 150ms ease;
  border-left: none;
}

.bomatlas-nav-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f4f4f5;
}

.bomatlas-nav-dropdown-item.active {
  color: #f4f4f5;
  background: rgba(255, 255, 255, 0.04);
}

/* Entity Count Badge */
.bomatlas-nav-entity-count {
  color: #71717a;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.bomatlas-nav-dropdown-item:hover .bomatlas-nav-entity-count {
  background: rgba(255, 255, 255, 0.08);
  color: #a1a1aa;
}

/* Dropdown Divider */
.bomatlas-nav-dropdown-divider {
  height: 1px;
  background: #242424;
  margin: 4px 8px;
}

/* Account dropdown header (shows full email) */
.bomatlas-nav-dropdown-header {
  padding: 8px 14px;
  font-size: 12px;
  color: #52525b;
  font-weight: 500;
  border-bottom: 1px solid #242424;
  margin-bottom: 4px;
}

/* Dropdown section headers (Maps, Admin, etc.) */
.bomatlas-nav-dropdown-section {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #52525b;
}

/* Mobile Menu Toggle */
.bomatlas-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms ease;
  position: relative;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.bomatlas-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.bomatlas-menu-toggle-icon {
  width: 20px;
  height: 2px;
  background: #a1a1aa;
  position: relative;
  transition: background 150ms ease;
}

.bomatlas-menu-toggle-icon::before,
.bomatlas-menu-toggle-icon::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background: #a1a1aa;
  left: 0;
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bomatlas-menu-toggle-icon::before {
  top: -6px;
}

.bomatlas-menu-toggle-icon::after {
  top: 6px;
}

.bomatlas-menu-toggle.active .bomatlas-menu-toggle-icon {
  background: transparent;
}

.bomatlas-menu-toggle.active .bomatlas-menu-toggle-icon::before {
  transform: rotate(45deg) translateY(6px);
}

.bomatlas-menu-toggle.active .bomatlas-menu-toggle-icon::after {
  transform: rotate(-45deg) translateY(-6px);
}

/* Responsive: Tablet & Mobile */
@media (max-width: 768px) {
  .bomatlas-header-container {
    padding: 10px 16px;
  }

  .bomatlas-logo {
    font-size: 18px;
  }

  /* Product switcher on mobile - keep compact */
  .bomatlas-product-switcher {
    flex-shrink: 0;
  }

  .bomatlas-product-switcher .bomatlas-logo {
    justify-content: flex-start;
    gap: 0;
  }

  /* Auth link prominent on mobile */
  .bomatlas-nav-link-auth {
    text-align: center;
    margin-top: 8px;
  }

  .bomatlas-menu-toggle {
    display: flex;
  }

  .bomatlas-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: #0a0a0a;
    padding: 80px 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    transition: right 250ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.6);
    border-left: 1px solid #242424;
    z-index: 1000;
    overflow-y: auto;
  }

  .bomatlas-nav.active {
    right: 0;
  }

  .bomatlas-nav-link,
  .bomatlas-nav-dropdown-trigger {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 15px;
    white-space: normal;
    word-break: break-word;
  }

  .bomatlas-nav-dropdown {
    width: 100%;
  }

  .bomatlas-nav-dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin-top: 4px;
    box-shadow: none;
    border: none;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid #3b82f6;
    border-radius: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 250ms cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
  }

  /* Disable hover on mobile, only use active class */
  .bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-menu {
    max-height: 0;
    padding: 0;
  }

  .bomatlas-nav-dropdown.active .bomatlas-nav-dropdown-menu {
    max-height: 400px;
    padding: 8px 0;
  }

  /* Mobile overlay */
  body.nav-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    animation: fadeIn 300ms ease;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  body.nav-open {
    overflow: hidden;
  }
}

/* Responsive: Small Mobile */
@media (max-width: 480px) {
  .bomatlas-logo {
    font-size: 16px;
  }

  .bomatlas-nav {
    width: 100%;
    right: -100%;
  }
}

/* Sidebar Toggle in Header */
.bomatlas-sidebar-toggle {
  position: relative;
  color: #a1a1aa;
  background: transparent;
  border: 1px solid #242424;
  font-family: inherit;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bomatlas-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #3f3f46;
  color: #f4f4f5;
}

.bomatlas-sidebar-toggle:active {
  background: rgba(255, 255, 255, 0.08);
}

.bomatlas-sidebar-toggle.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.bomatlas-sidebar-toggle-icon {
  font-size: 16px;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bomatlas-sidebar-toggle.active .bomatlas-sidebar-toggle-icon {
  transform: rotate(90deg);
}

/* Hide text on smaller screens */
@media (max-width: 1024px) {
  .bomatlas-sidebar-toggle-text {
    display: none;
  }

  .bomatlas-sidebar-toggle {
    padding: 8px 12px;
  }
}

/* On mobile, hide header toggle and use floating button */
@media (max-width: 768px) {
  .bomatlas-sidebar-toggle {
    display: none;
  }
}

/* ============================================
   User Account Dropdown (Signed In State)
   ============================================ */

/* User dropdown container */
.bomatlas-user-dropdown {
  margin-left: 8px;
}

/* User trigger button with avatar */
.bomatlas-user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px !important;
  background: transparent;
  border: 1px solid #242424;
  border-radius: 6px;
}

.bomatlas-user-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #3f3f46;
}

/* User avatar circle */
.bomatlas-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* User name text */
.bomatlas-user-name {
  font-size: 13px;
  font-weight: 500;
  color: #f8fafc;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User menu dropdown */
.bomatlas-user-menu {
  min-width: 200px;
  right: 0;
  left: auto;
}

/* User email in header */
.bomatlas-user-email {
  font-size: 12px;
  color: #94a3b8;
  word-break: break-all;
}

/* Tenant badge in user dropdown */
.bomatlas-tenant-badge {
  display: inline-block;
  background: rgba(29, 155, 240, 0.15);
  color: #1d9bf0;
  padding: 3px 10px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

/* Logout button styling */
.bomatlas-logout-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: #ef4444;
}

.bomatlas-logout-btn:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #f87171 !important;
}

/* Mobile adjustments for user dropdown */
@media (max-width: 768px) {
  .bomatlas-user-trigger {
    padding: 8px 12px 8px 8px !important;
  }

  .bomatlas-user-name {
    max-width: 100px;
  }

  .bomatlas-user-menu {
    position: static;
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .bomatlas-user-name {
    display: none;
  }

  .bomatlas-user-trigger {
    padding: 6px !important;
    border-radius: 0;
  }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
  .bomatlas-logo-accent {
    animation: none;
  }

  .bomatlas-nav-link,
  .bomatlas-nav-dropdown-trigger,
  .bomatlas-nav-dropdown-menu,
  .bomatlas-nav-dropdown-item,
  .bomatlas-menu-toggle-icon::before,
  .bomatlas-menu-toggle-icon::after,
  .bomatlas-sidebar-toggle-icon {
    transition: none;
  }
}
