/* Global Search Styles */
#global-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 550px;
  max-height: 600px;
  overflow-y: auto;
  margin-top: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  background: white;
  z-index: 1050;
  padding: 0;
}

#global-search-results-content {
  padding: 0;
}

#global-search-results .dropdown-menu-header:first-child {
  border-radius: 8px 8px 0 0;
}

#global-search-results .dropdown-menu-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  gap: 8px;
}

#global-search-results .dropdown-menu-header i {
  font-size: 12px;
}

#global-search-results .list-group {
  margin-bottom: 0;
}

#global-search-results .list-group-item {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid #f0f0f0;
  padding: 12px 16px;
  transition: background-color 0.15s ease;
}

#global-search-results .list-group-item:last-child {
  border-bottom: none;
}

#global-search-results .list-group-item:hover,
#global-search-results .list-group-item.active {
  background-color: #f8f9fa;
  cursor: pointer;
}

#global-search-results .global-search-item {
  text-decoration: none;
  color: inherit;
  display: block;
}

#global-search-results .global-search-item:hover {
  text-decoration: none;
}

#global-search-results .fw-semibold {
  color: #212529;
  font-size: 14px;
  margin-bottom: 4px;
}

#global-search-results .text-muted.small {
  font-size: 12px;
  color: #6c757d;
}

#global-search-results mark {
  background-color: #fff3cd;
  padding: 2px 4px;
  border-radius: 2px;
  font-weight: 500;
}

/* Quick Actions Styling */
.global-search-quick-actions {
  padding: 8px;
}

.global-search-quick-action {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  color: #495057;
  text-decoration: none;
  transition: background-color 0.15s ease;
  font-size: 14px;
  gap: 10px;
}

.global-search-quick-action:hover,
.global-search-quick-action.active {
  background-color: #f8f9fa;
  color: #212529;
  text-decoration: none;
}

.global-search-quick-action i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: #6c757d;
}

/* Navigation Shortcuts Styling */
.global-search-navigation-shortcut {
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.global-search-navigation-shortcut:hover {
  border-left-color: var(--bs-primary, #0d6efd);
  background-color: #f8f9fa;
}

.global-search-navigation-shortcut .navigation-shortcut-icon {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.global-search-navigation-shortcut .fw-semibold {
  color: #212529;
  font-size: 14px;
}

.global-search-navigation-shortcut .text-muted.small {
  font-size: 12px;
  color: #6c757d;
}

/* View All Link */
.global-search-view-all {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--bs-primary, #0d6efd);
  text-decoration: none;
  border-top: 1px solid #f0f0f0;
  transition: background-color 0.15s ease;
}

.global-search-view-all:hover {
  background-color: #f8f9fa;
  text-decoration: none;
}

.global-search-view-all i {
  margin-left: auto;
  font-size: 12px;
}

/* Empty and Loading States */
.global-search-empty,
.global-search-loading {
  padding: 40px 20px;
  text-align: center;
}

.global-search-empty i,
.global-search-loading i {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

/* Badge Styling */
#global-search-results .badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
}

/* Avatar Styling */
.global-search-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e9ecef;
  color: #6c757d;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

/* Category Icons — neutral default so every section gets a tile;
   per-category classes below override with their own hue */
.global-search-category-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: #f1f3f5;
  color: #6c757d;
}

.global-search-category-icon.people {
  background-color: #e7f3ff;
  color: var(--bs-primary, #0d6efd);
}

.global-search-category-icon.tasks {
  background-color: #e8f5e9;
  color: var(--bs-success, #28a745);
}

.global-search-category-icon.reviews {
  background-color: #fff3e0;
  color: var(--bs-warning, #fd7e14);
}

.global-search-category-icon.goals {
  background-color: #f3e5f5;
  color: #6f42c1;
}

.global-search-category-icon.documents {
  background-color: #e0f2f1;
  color: #20c997;
}

.global-search-category-icon.recruiting {
  background-color: #fff8e1;
  color: var(--bs-warning, #ffc107);
}

.global-search-category-icon.libraries {
  background-color: #e3f2fd;
  color: #1976d2;
}

.global-search-category-icon.shifts {
  background-color: #e8eaf6;
  color: #3f51b5;
}

.global-search-category-icon.leave-requests {
  background-color: #fce4ec;
  color: #d63384;
}

.global-search-category-icon.recognition {
  background-color: #fff3cd;
  color: #cc9a06;
}

.global-search-category-icon.drive {
  background-color: #e0f7fa;
  color: #0aa2c0;
}

.global-search-category-icon.wikis {
  background-color: #ede7f6;
  color: #59359a;
}

.global-search-category-icon.ideas {
  background-color: #fff9db;
  color: #e8a500;
}

.global-search-category-icon.workforce-bots {
  background-color: #eceff1;
  color: #546e7a;
}

.global-search-category-icon.esignature {
  background-color: #e6f4ea;
  color: var(--bs-success, #198754);
}

.global-search-category-icon.inspections {
  background-color: #d9f2ef;
  color: #0f9d8a;
}

.global-search-category-icon.safety-hub {
  background-color: #fdecea;
  color: var(--bs-danger, #dc3545);
}

.global-search-category-icon.policy-hub {
  background-color: #e7f1ff;
  color: #3b71ca;
}

.global-search-category-icon.sop-hub {
  background-color: #eef7ed;
  color: #4f9d4a;
}

.global-search-category-icon.frontline-execution {
  background-color: #f4fce3;
  color: #5c940d;
}

.global-search-category-icon.sites {
  background-color: #e6f7ff;
  color: #0c8599;
}

.global-search-category-icon.workspace {
  background-color: #f1f0ff;
  color: #5f3dc4;
}

.global-search-category-icon.comms-hub {
  background-color: #fff0eb;
  color: #e8590c;
}

.global-search-category-icon.contracts {
  background-color: #f4ede4;
  color: #8a6d3b;
}

.global-search-category-icon.field-service {
  background-color: #fff9db;
  color: #b08d00;
}

.global-search-category-icon.onboarding-hub {
  background-color: #e7f5ff;
  color: #1c7ed6;
}

.global-search-category-icon.mango-iq {
  background-color: #f3f0ff;
  color: #7048e8;
}

.global-search-category-icon.mango-gtm {
  background-color: #fff4e6;
  color: #f76707;
}

.global-search-category-icon.mango-cs {
  background-color: #ebfbee;
  color: #2f9e44;
}

.global-search-category-icon.ai-front-office {
  background-color: #fff5f5;
  color: #fa5252;
}

.global-search-category-icon.apps {
  background-color: #f1f3f5;
  color: #495057;
}

.global-search-category-icon.plugin-apps {
  background-color: #fff0f6;
  color: #d6336c;
}

.global-search-category-icon.plugins {
  background-color: #f8f0fc;
  color: #ae3ec9;
}

.global-search-category-icon.settings {
  background-color: #f1f3f5;
  color: #495057;
}

/* Keyboard Shortcut */
.global-search-kbd {
  display: inline-block;
  padding: 3px 6px;
  font-size: 11px;
  font-family: monospace;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  color: #6c757d;
}

/* Scrollbar Styling */
#global-search-results::-webkit-scrollbar {
  width: 8px;
}

#global-search-results::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 0 8px 8px 0;
}

#global-search-results::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

#global-search-results::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Ask AI Footer */
.global-search-footer {
  border-top: 1px solid #e9ecef;
  padding: 12px 16px;
  background-color: #f8f9fa;
  border-radius: 0 0 8px 8px;
  position: sticky;
  bottom: 0;
}

.global-search-ai-prompt {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #6c757d;
}

.global-search-ai-prompt i {
  color: var(--bs-primary, #0d6efd);
  font-size: 14px;
}

.global-search-ai-prompt button {
  color: var(--bs-primary, #0d6efd);
  font-weight: 500;
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s ease;
}

.global-search-ai-prompt button:hover {
  color: #0b5ed7;
  text-decoration: underline;
}

.global-search-ai-prompt button:focus {
  outline: none;
  box-shadow: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   Dark theme
   --------------------------------------------------------------------------
   `background: white` at the top of this file paints the panel opaque white in
   every theme, while BusinessTheme's dark block forces rgb(222,222,223) body
   ink onto whatever is inside it — measured 1.06:1, i.e. blank rows. Ordinary
   .dropdown-menus in the app come out rgb(51,51,51) on their own, so this is
   this file's bug rather than a platform one: nothing else here is opting out
   of the theme, only the literal above.

   Surfaces are re-pointed at the tenant's own dark tokens so the panel matches
   the dropdowns beside it in the same navbar; the literal inside each var() is
   only the fallback for a tenant with no theme block. The PANEL takes the card
   surface and its chrome (section headers, footer, hover) takes the one-step-
   darker page surface — the dark mirror of the white-panel/#f8f9fa-chrome
   pairing above.

   Deliberately NOT re-pointed: the per-category `.global-search-category-icon`
   hues (.people, .tasks, …) and the navigation-shortcut gradient. Those are a
   32px tile per row carrying the app's category colour-coding, they stay
   internally readable because both halves of each pair move together, and they
   read on a dark panel the way an app icon does. Only the two NEUTRAL greys —
   the base tile and the fallback avatar, which carry no hue identity — follow
   the theme below.

   Keyed on `:root[data-theme="dark"]`, i.e. <html>, which is where
   layouts/application sets the attribute.
   ══════════════════════════════════════════════════════════════════════════ */

:root[data-theme="dark"] #global-search-results {
  background: var(--bs-card-bg, #333333);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] #global-search-results .dropdown-menu-header {
  color: var(--text-muted, #a7acb1);
  background-color: var(--bs-body-bg, #252526);
  border-bottom-color: var(--bs-border-color, #4b4b4b);
}

:root[data-theme="dark"] #global-search-results .list-group-item {
  border-bottom-color: var(--bs-border-color, #4b4b4b);
}

:root[data-theme="dark"] #global-search-results .list-group-item:hover,
:root[data-theme="dark"] #global-search-results .list-group-item.active,
:root[data-theme="dark"] .global-search-quick-action:hover,
:root[data-theme="dark"] .global-search-quick-action.active,
:root[data-theme="dark"] .global-search-navigation-shortcut:hover,
:root[data-theme="dark"] .global-search-view-all:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] #global-search-results .fw-semibold,
:root[data-theme="dark"] .global-search-navigation-shortcut .fw-semibold,
:root[data-theme="dark"] .global-search-quick-action:hover,
:root[data-theme="dark"] .global-search-quick-action.active {
  color: var(--bs-body-color, #dededf);
}

:root[data-theme="dark"] #global-search-results .text-muted.small,
:root[data-theme="dark"] .global-search-navigation-shortcut .text-muted.small,
:root[data-theme="dark"] .global-search-quick-action,
:root[data-theme="dark"] .global-search-quick-action i,
:root[data-theme="dark"] .global-search-ai-prompt {
  color: var(--text-muted, #a7acb1);
}

/* The search-term highlight. #fff3cd carries near-black ink, so the fill and
   the ink have to move together or the match becomes unreadable rather than
   just bright. 5.2:1 as re-expressed. */
:root[data-theme="dark"] #global-search-results mark {
  background-color: rgba(255, 193, 7, 0.28);
  color: #ffe08a;
}

/* The ink moves with the border: --bs-primary (#4e73ac on this tenant) was a
   marginal 4.3:1 on the white panel and drops to 2.63:1 once the panel behind
   it goes dark — measured on the four "View all …" links. --bs-link-color is
   the same brand already clamped for a dark surface, and is what the footer's
   Ask link below uses. */
:root[data-theme="dark"] .global-search-view-all {
  border-top-color: var(--bs-border-color, #4b4b4b);
  color: var(--bs-link-color, #8ba3c9);
}

:root[data-theme="dark"] .global-search-avatar {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #a7acb1);
}

/* The NEUTRAL default tile only — see the note above on why the hued tiles stay
   put. `:where()` is what makes that true: it contributes ZERO specificity, so
   this lands at (0,1,0), exactly matching the base `.global-search-category-icon`
   rule it is meant to answer and losing to every (0,2,0) modifier below it
   (.people, .tasks, … and .navigation-shortcut-icon). Written as an ordinary
   `:root[data-theme="dark"] .global-search-category-icon` it is (0,3,0) and
   out-ranks all of them — measured: every tile flattened to this grey wash and
   the shortcut tile's white icon turned muted grey on its purple gradient. */
:where(:root[data-theme="dark"]) .global-search-category-icon {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #a7acb1);
}

/* .settings and .apps declare the SAME #f1f3f5 / #495057 pair as the base rule
   above — they are the neutral tile wearing a modifier class, carrying no hue
   identity to preserve — so they follow the theme with it. Every other modifier
   is a real hue and is left alone. */
:root[data-theme="dark"] .global-search-category-icon.settings,
:root[data-theme="dark"] .global-search-category-icon.apps {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #a7acb1);
}

:root[data-theme="dark"] .global-search-kbd {
  background-color: var(--bs-body-bg, #252526);
  border-color: var(--bs-border-color, #4b4b4b);
  color: var(--text-muted, #a7acb1);
}

:root[data-theme="dark"] .global-search-footer {
  background-color: var(--bs-body-bg, #252526);
  border-top-color: var(--bs-border-color, #4b4b4b);
}

/* --bs-primary is the raw brand fill; --bs-link-color is the same brand already
   clamped for readability against the dark surface. */
:root[data-theme="dark"] .global-search-ai-prompt i,
:root[data-theme="dark"] .global-search-ai-prompt button,
:root[data-theme="dark"] .global-search-ai-prompt button:hover {
  color: var(--bs-link-color, #8ba3c9);
}

:root[data-theme="dark"] #global-search-results::-webkit-scrollbar-track {
  background: var(--bs-body-bg, #252526);
}

:root[data-theme="dark"] #global-search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

:root[data-theme="dark"] #global-search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}