// =============================================================================
// Global Search (NetSuite-style inline search bar)
// =============================================================================

// Search input group
#globalSearchGroup {
  border-radius: 0.375rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;

  .input-group-text,
  .form-control {
    transition: background-color 0.2s ease;
  }

  &:focus-within {
    box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.15);

    .input-group-text,
    .form-control {
      background-color: var(--bs-body-bg) !important;
    }
  }
}

#globalSearchClear {
  cursor: pointer;
}

// Search wrapper — max width
.navbar-nav > #globalSearchWrapper {
  // Width handled by parent container
}

// Results dropdown
#globalSearchResults {
  top: calc(100% + 4px);
  left: 0;
  z-index: 1080;
  max-height: 460px;
  overflow: hidden;
  animation: gsSlideDown 0.15s ease-out;
}

#globalSearchBody {
  max-height: 420px;
  overflow-y: auto;

  // Custom scrollbar
  &::-webkit-scrollbar {
    width: 5px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 3px;

    &:hover {
      background-color: rgba(0, 0, 0, 0.25);
    }
  }
}

// Slide-down animation for results panel
@keyframes gsSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// Section headers (Pages / Records dividers)
.gs-section-header {
  position: sticky;
  top: 0;
  z-index: 2;
}

// Result items (pages + records)
.gs-result-item {
  text-decoration: none;
  transition: background-color 0.12s ease;

  &:hover,
  &.active {
    background-color: rgba(var(--bs-primary-rgb), 0.06) !important;
    text-decoration: none;
  }

  &:last-child {
    border-bottom: none !important;
  }
}

// Icon box (32×32 rounded container for result icons)
.gs-icon-box {
  width: 32px;
  height: 32px;
  font-size: 1rem;
}

// Result item name text
.gs-item-name {
  font-size: 0.8125rem;
}

// Module header — category icon size
.gs-module-header {
  .gs-module-icon {
    font-size: 1rem;
  }

  .gs-module-count {
    font-size: 0.65rem;
  }
}

// Record items (extra specificity for record badges)
.gs-record-item {
  .badge {
    font-size: 0.625rem;
  }
}

// Section labels (Pages / Records dividers)
.gs-section-label {
  font-size: 0.625rem;
  letter-spacing: 0.08em;
}

// Module group headers
.gs-module-group {
  > .d-flex:first-child {
    // Module category header row
    position: sticky;
    z-index: 1;
  }
}

// Responsive: collapse search bar on very small screens
@media (max-width: 575.98px) {
  #globalSearchGroup {
    .form-control {
      font-size: 0.8125rem;

      &::placeholder {
        font-size: 0.8125rem;
      }
    }
  }
}

// =============================================================================
// Navbar — User Context (App Store Connect style)
// =============================================================================
.navbar-dropdown.dropdown-user {
  .nav-link {
    .user-context-name {
      font-size: 0.9375rem;
    }

    .user-context-subtitle {
      font-size: 0.8125rem;
    }
  }
}

// Navbar — Vertical divider between user context and notifications
.navbar-vr {
  height: 24px;
  opacity: 0.2;
}

// =============================================================================
// Global Search container max-width
// =============================================================================
.gs-search-container {
  max-width: 560px;
}
