/* 
==============================================================================
 BLACK ELM COFFEE - LAYOUT SYSTEM
 Consolidated layout styles: main layout grid, sidebar, navigation
 Combines: layout.css + sidebar-clean.css
==============================================================================
*/

/* 
 * ===== MAIN LAYOUT CONTAINER =====
 */
.layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Main content area */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-content {
  flex: 1;
  margin-left: 240px !important; /* Force sidebar spacing */
  margin-top: 60px !important; /* Force top navigation spacing */
  min-height: calc(100vh - 60px);
  padding: 1rem 2rem 2rem 2rem !important; /* Force "higher" content - reduced top padding */
  overflow-y: auto;
  background: var(--bg) !important;
  background-image: none !important;
  transition: margin-left 0.3s ease;
}

/* Additional specificity to override page-specific CSS */
body .main-content,
html body .main-content {
  padding: 1rem 2rem 2rem 2rem !important;
  margin-left: 240px !important;
  margin-top: 60px !important;
}

/* 
 * ===== UNIVERSAL CLEAN HEADER LAYOUT =====
 * Ensure all pages have clean, uncontained headers automatically
 */

/* Auto-restructure any page for clean header appearance */
.main-content > .table-container:first-child,
.main-content > .card:first-child,
.main-content > .panel:first-child {
  margin-top: 0 !important; /* Headers create their own spacing */
}

/* Ensure first headers in main-content are always clean */
.main-content > .table-header:first-child,
.main-content > .page-header:first-child,
.main-content > .page-header-with-actions:first-child,
.main-content > .dashboard-header:first-child {
  margin-top: 0 !important;
  margin-bottom: 1.5rem !important;
}

/* Auto-fix any div that contains the first h1 on a page */
.main-content > div:first-child:has(h1),
.main-content > div:first-child:has(h2) {
  background: var(--bg) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin-bottom: 1.5rem !important;
  padding: 0 !important;
}

/* Auto-enhance any container that starts with a header */
.table-container:has(.table-header:first-child),
.panel:has(.section-header:first-child),
.card:has(h1:first-child),
.card:has(h2:first-child) {
  border-radius: 8px !important;
  border: 1px solid var(--border-light) !important;
  background: var(--surface-1) !important;
  overflow: visible !important; /* Allow headers to break out */
}

/* Dashboard container for sidebar + main content layout */
.dashboard-container {
  display: flex;
  min-height: 100vh;
  padding-top: 60px; /* Account for top nav */
  background: var(--bg) !important;
  background-image: none !important;
}

/* Container for centered content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-4);
  width: 100%;
}

/* 
 * ===== SIDEBAR NAVIGATION =====
 */
.sidebar {
  width: 280px;
  background: var(--surface-1);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

/* Clean Sidebar (used by dashboard) */
.sidebar-clean {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: var(--sidebar-bg, #0a0a0a);
  border-right: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

/* Enhanced Sidebar Header with Better Logo */
.sidebar-clean-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  flex-shrink: 0;
  background: var(--sidebar-bg, #0a0a0a);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0.25rem;
  border-radius: 8px;
}

.logo-container:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.sidebar-logo {
  width: 32px !important;
  height: 32px !important;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  /* Ensure logo is visible in both light and dark modes */
  filter: brightness(1);
}

/* Logo visibility fixes for theme switching */
:root .sidebar-logo {
  filter: brightness(1) contrast(1);
}

[data-theme="dark"] .sidebar-logo {
  filter: brightness(1.2) contrast(1.1);
}

[data-theme="light"] .sidebar-logo {
  filter: brightness(0.7) contrast(1.3) saturate(1.2);
}

/* MAXIMUM SPECIFICITY LOGO SIZE OVERRIDE */
html body .sidebar-clean .sidebar-clean-header .logo-container .sidebar-logo,
html body .top-nav .top-nav-content .top-nav-logo img,
html body .sidebar .sidebar-logo,
html body .messaging-sidebar .sidebar-logo,
html body img[src*="black-elm-symbol"],
html body img[alt*="Black Elm"] {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Clean Navigation */
.sidebar-clean-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  margin-bottom: 0.25rem;
  text-decoration: none !important;
  display: block;
}

/* Expandable sidebar sections with chevrons */
.nav-section.expandable .nav-section-title {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 1rem;
  transition: all 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.nav-section.expandable .nav-section-title:hover {
  color: var(--accent);
  background: var(--hover);
  border-radius: 4px;
}

.nav-section.expandable .section-arrow {
  transition: transform 0.3s ease;
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.7;
}

.nav-section.expandable.expanded .section-arrow {
  transform: rotate(180deg);
}

.nav-section.expandable .nav-section-content {
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Subsection labels for organized grouping */
.nav-subsection {
  margin-bottom: 0.75rem;
}

.nav-subsection:first-child {
  margin-top: 0.25rem;
}

.nav-subsection-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem 0.25rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

.nav-subsection:first-child .nav-subsection-label {
  margin-top: 0;
}

.nav-subsection .nav-item {
  padding-left: 1.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--hover);
  color: var(--text);
  border-left-color: var(--accent);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item:hover svg,
.nav-item.active svg {
  opacity: 1;
}

/* Enhanced Footer with Branding */
.sidebar-clean-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  flex-shrink: 0;
  background: var(--sidebar-bg, #0a0a0a);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.user-info:hover {
  background: var(--hover);
}

.user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name-small {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-small {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar header */
.sidebar-header {
  padding: var(--spacing-6) var(--spacing-4);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-1);
}

.sidebar-header .logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  text-decoration: none;
  color: var(--text-primary);
}

.sidebar-header .logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-base);
}

.sidebar-header .logo-text {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

/* User info section */
.user-info-section {
  padding: var(--spacing-4);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-2);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
}

.user-details h3 {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.user-details p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Navigation sections */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-4) 0;
}

.sidebar-section {
  margin-bottom: var(--spacing-6);
}

.sidebar-section h3 {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 var(--spacing-3) 0;
  padding: 0 var(--spacing-4);
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition-base);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  margin-right: var(--spacing-4);
}

.nav-links a:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-links a.active {
  background: var(--accent-primary);
  color: white;
}

.nav-links a .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Collapsible sections */
.sidebar-section details {
  margin-bottom: var(--spacing-2);
}

.sidebar-section details summary {
  cursor: pointer;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--spacing-2) var(--spacing-4);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section details summary::-webkit-details-marker {
  display: none;
}

.sidebar-section details summary::after {
  content: '▼';
  font-size: 10px;
  transition: transform var(--transition-base);
}

.sidebar-section details:not([open]) summary::after {
  transform: rotate(-90deg);
}

.sidebar-section details[open] summary {
  color: var(--accent-primary);
}

.sidebar-section details .nav-links {
  padding-left: var(--spacing-4);
  margin-top: var(--spacing-2);
}

/* Top navigation bar */
.top-nav {
  position: fixed;
  top: 0;
  left: 240px; /* Respect sidebar width */
  right: 0;
  height: 60px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  display: flex;
  align-items: center;
  transition: all var(--transition-base);
}

.top-nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 1rem;
  gap: 1rem;
}

.top-nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.top-nav-logo img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 4px;
  /* Ensure top nav logo is visible in both themes */
  filter: brightness(1);
}

/* Top nav logo visibility fixes */
:root .top-nav-logo img {
  filter: brightness(1) contrast(1);
}

[data-theme="dark"] .top-nav-logo img {
  filter: brightness(1.2) contrast(1.1);
}

[data-theme="light"] .top-nav-logo img {
  filter: brightness(0.7) contrast(1.3) saturate(1.2);
}

.top-nav-brand {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Breadcrumb Container */
.breadcrumb-container {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

/* Global Search - Enhanced */
.global-search-container {
  position: relative !important;
  flex: 0 0 400px !important;
  max-width: 400px !important;
  min-width: 300px !important;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 0.75rem;
  transition: all 0.2s ease;
  height: 36px;
}

.search-input-wrapper:focus-within {
  background: var(--surface-3);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.search-icon {
  position: absolute !important;
  left: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: rgba(255, 255, 255, 0.6) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: none !important;
  z-index: 999 !important;
  font-size: 16px !important;
  width: 16px !important;
  height: 16px !important;
}

#global-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.6rem 0.75rem 0.6rem 40px !important;
  font-size: 0.875rem;
  color: var(--text) !important;
  outline: none !important;
  width: 100%;
}

#global-search-input::placeholder {
  color: var(--text-muted);
}

/* Enhanced Global Search Results Container */
.global-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 500px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  margin-top: 1px;
}

.global-search-results.active {
  display: block;
}

/* Search Result Items */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.search-result-item:hover {
  background: var(--surface-2);
}

.search-result-item:last-child {
  border-bottom: none;
}

.result-icon {
  font-size: 1.2rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-content {
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.result-type-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.result-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.result-highlight {
  font-size: 0.85rem;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.result-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Result Actions */
.result-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.result-action-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.result-action-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.result-action-btn.secondary {
  background: transparent;
  color: var(--primary);
}

.result-action-btn.secondary:hover {
  background: var(--primary);
  color: white;
}

/* Search Suggestions */
.search-suggestions {
  padding: 0.5rem 0;
}

.search-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  margin: 0 0.5rem;
}

.search-suggestion-item:hover {
  background: var(--surface-2);
  transform: translateX(2px);
}

.suggestion-icon {
  font-size: 1.1rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

.suggestion-content {
  flex: 1;
  min-width: 0;
}

.suggestion-text {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.2;
}

.suggestion-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 0.1rem;
}

.suggestion-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface-3);
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
  font-weight: 500;
}

/* Search Results */
.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}

.results-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.view-all-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-all-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.search-results-list {
  padding: 0.5rem 0;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  margin: 0 0.5rem;
  border-left: 3px solid transparent;
}

.search-result-item:hover {
  background: var(--surface-2);
  border-left-color: var(--accent);
  transform: translateX(2px);
}

.result-icon {
  font-size: 1.2rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  margin-top: 0.1rem;
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-type-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.result-title {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.result-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.meta-item {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Recent Searches */
.search-recent {
  padding: 0.5rem 0;
}

.search-recent-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  margin: 0 0.5rem;
}

.search-recent-item:hover {
  background: var(--surface-2);
  transform: translateX(2px);
}

.recent-icon {
  font-size: 1rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.recent-content {
  flex: 1;
  min-width: 0;
}

.recent-query {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.2;
}

.recent-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Loading State */
.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  gap: 1rem;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Empty State */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  gap: 0.5rem;
  text-align: center;
}

.empty-icon {
  font-size: 2rem;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

.empty-message {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

.empty-suggestion {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Error State */
.search-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  gap: 0.5rem;
  text-align: center;
}

.error-icon {
  font-size: 2rem;
  color: var(--error);
  margin-bottom: 0.5rem;
}

.error-message {
  font-size: 0.875rem;
  color: var(--error);
  font-weight: 500;
}

/* Search Result Highlights */
.search-result-item mark,
.result-description mark {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
  font-weight: 600;
}

/* Keyboard Navigation */
.search-suggestion-item:focus,
.search-result-item:focus,
.search-recent-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--surface-2);
}

/* Custom Scrollbar for Search Results */
.global-search-results::-webkit-scrollbar {
  width: 6px;
}

.global-search-results::-webkit-scrollbar-track {
  background: var(--surface-1);
}

.global-search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.global-search-results::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Search Input Focus Ring */
#global-search-input:focus {
  outline: none;
}

.search-input-wrapper:focus-within {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Content Type Specific Icons and Colors */
.result-icon.employee {
  color: #3b82f6;
}

.result-icon.document {
  color: #10b981;
}

.result-icon.course {
  color: #f59e0b;
}

.result-icon.recipe {
  color: #8b5cf6;
}

.result-icon.inventory {
  color: #ef4444;
}

.result-icon.message {
  color: #06b6d4;
}

/* User Actions */
.user-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

/* Enhanced button visibility for both themes */
.nav-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nav-action-btn:active {
  transform: translateY(0);
}

/* Theme toggle button specific styling */
#theme-toggle-btn {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

#theme-toggle-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Notifications button styling */
#notifications-btn {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#notifications-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Sidebar toggle button styling */
#sidebar-toggle-btn {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

#sidebar-toggle-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* SVG icon styling for better visibility */
.nav-action-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  transition: all var(--transition-base);
}

.nav-action-btn:hover svg {
  stroke: currentColor;
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.3rem;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 2px solid var(--surface-1);
  display: none;
}

.notification-badge:not(:empty) {
  display: block;
}

/* Ensure notification button icon is always visible */
#notifications-btn svg {
  stroke: currentColor !important;
  fill: none !important;
  opacity: 1 !important;
}

/* User Profile Menu */
.user-profile-menu {
  position: relative;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-light);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  height: 36px;
  outline: none;
}

.user-profile-btn:hover,
.user-profile-btn:focus {
  background: var(--surface-2);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  outline: none;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  background: var(--surface-1) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0.5rem 0 !important;
  min-width: 220px !important;
  z-index: 9999 !important;
  display: none !important;
}

/* Force proper dropdown display when active */
.user-dropdown[style*="display: block"] {
  display: block !important;
}

#user-dropdown {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  background: var(--surface-1) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0.5rem 0 !important;
  min-width: 220px !important;
  z-index: 9999 !important;
}

/* Clean Top Nav Dropdown Item Styling */
.user-dropdown .dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0.75rem 1rem !important;
  color: var(--text-primary) !important;
  text-decoration: none !important;
  border: none !important;
  background: transparent !important;
  width: calc(100% - 4px) !important;
  text-align: left !important;
  cursor: pointer !important;
  font-size: 0.875rem !important;
  transition: all 0.2s ease !important;
  border-radius: 4px !important;
  margin: 2px !important;
  font-family: inherit !important;
  outline: none !important;
}

.user-dropdown .dropdown-item:hover {
  background: var(--surface-2) !important;
  color: var(--text-primary) !important;
}

.user-dropdown .dropdown-item:focus {
  background: var(--surface-2) !important;
  color: var(--text-primary) !important;
  outline: none !important;
}

/* Special styling for logout button */
.user-dropdown .logout-btn {
  border-top: 1px solid var(--border-light) !important;
  margin-top: 0.5rem !important;
  padding-top: 1rem !important;
}

/* Dropdown item SVG icons */
.user-dropdown .dropdown-item svg {
  width: 16px !important;
  height: 16px !important;
  stroke-width: 2 !important;
  flex-shrink: 0 !important;
}

/* Clean Top Nav Dropdown Section Styling */
.user-dropdown .dropdown-divider {
  height: 1px !important;
  background: var(--border-light) !important;
  margin: 0.5rem 0 !important;
  border: none !important;
}

.user-dropdown .dropdown-section {
  padding: 0.5rem 0 !important;
}

.user-dropdown .dropdown-section-title {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 0.5rem 1rem !important;
  margin-bottom: 0.25rem !important;
  border-bottom: 1px solid var(--border-light) !important;
  background: transparent !important;
}

/* Breadcrumb navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb .separator {
  color: var(--text-muted);
  opacity: 1;
}

.breadcrumb .current,
.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* === CUSTOM OVERRIDES (added by July 2025 top-nav fix) === */

/* Hide sidebar (hamburger) button and top nav logo on desktop */
@media (min-width: 769px) {
  #sidebar-toggle-btn,
  .sidebar-toggle-btn {
    display: none !important;
  }
  
  /* Hide top nav logo on desktop - sidebar has the main logo */
  .top-nav-logo {
    display: none !important;
  }
}

/* Let profile button size to its content with minimum width */
.user-profile-btn {
  width: auto !important;
  min-width: 120px !important; /* ensure minimum readable width */
  padding: 0.4rem 0.75rem !important; /* keep nice padding */
}

/* Ensure user name is always visible */
.user-name {
  min-width: 60px !important; /* minimum space for name */
  display: inline-block !important;
}

/* Responsive Search */
@media (max-width: 1024px) {
  .global-search-container {
    flex: 0 0 300px;
    max-width: 300px;
  }
}

@media (max-width: 768px) {
  /* Show mobile sidebar toggle button */
  .sidebar-toggle-btn {
    display: flex !important;
  }
  
  /* Show top nav logo on mobile (since sidebar is hidden) */
  .top-nav-logo {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
  }
  
  /* Top nav should span full width on mobile */
  .top-nav {
    left: 0 !important;
  }
  
  /* Mobile sidebar behavior */
  .sidebar,
  .sidebar-clean,
  #sidebar-container {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 500;
    transition: left 0.3s ease;
    background: var(--sidebar-bg, #1a1a1a);
  }
  
  .sidebar.mobile-open,
  .sidebar-clean.mobile-open,
  #sidebar-container.mobile-open {
    left: 0;
  }
  
  /* Adjust main content for mobile */
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  
  /* Adjust search container for mobile */
  .global-search-container {
    flex: 1;
    max-width: none;
    margin: 0 0.5rem;
  }
  
  .global-search-results {
    left: -0.5rem;
    right: -0.5rem;
  }
  
  .search-suggestion-item,
  .search-result-item,
  .search-recent-item {
    padding: 1rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .search-results-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  .view-all-btn {
    width: 100%;
    text-align: center;
  }
  
  .result-meta {
    gap: 0.5rem;
  }
  
  .meta-item {
    font-size: 0.65rem;
  }
}

/* 
 * ===== LOGO THEME HANDLING =====
 */
.logo img,
.sidebar-header img {
  transition: opacity var(--transition-base);
}

/* Light mode logo */
:root .logo img,
:root .sidebar-header img {
  content: url('/assets/black-elm-symbol.png');
}

/* Dark mode logo */
[data-theme="dark"] .logo img,
[data-theme="dark"] .sidebar-header img {
  content: url('/assets/Black Elm - Coffee Shop - White.jpg');
}

/* 
 * ===== ACCESSIBILITY IMPROVEMENTS =====
 */
.skip-navigation {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--accent-primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: var(--z-tooltip);
  border-radius: var(--radius-base);
}

.skip-navigation:focus {
  top: 6px;
}

/* Focus management for sidebar navigation */
.nav-links a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .nav-links a,
  .dropdown-content {
    transition: none;
  }
}

/* Global button outline removal - AGGRESSIVE */
*:focus,
*:focus-visible,
*:focus-within,
button,
input,
.nav-action-btn,
.user-profile-btn,
.sidebar-toggle-btn,
button:focus,
input:focus,
.nav-action-btn:focus,
.user-profile-btn:focus,
.sidebar-toggle-btn:focus,
button:active,
.nav-action-btn:active,
.user-profile-btn:active,
button:focus-visible,
.nav-action-btn:focus-visible,
.user-profile-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  -webkit-focus-ring-color: transparent !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Restore borders for styled buttons only */
.nav-action-btn,
.user-profile-btn {
  border: 1px solid var(--border-light) !important;
}

/* === FINAL OVERRIDE : Hide hamburger on desktop (July 2025) === */
@media (min-width: 769px) {
  .top-nav #sidebar-toggle-btn,
  #sidebar-toggle-btn {
    display: none !important;
  }
}

/* === NUCLEAR OPTION: Force hide hamburger on desktop === */
@media screen and (min-width: 769px) {
  html body .top-nav #sidebar-toggle-btn,
  html body #sidebar-toggle-btn,
  .top-nav-content #sidebar-toggle-btn,
  button#sidebar-toggle-btn,
  button.sidebar-toggle-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
  }
}

/* 
 * ===== THEME-SPECIFIC OVERRIDES =====
 */

/* Light theme specific adjustments */
[data-theme="light"] {
  --sidebar-bg: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-clean {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-light);
}

[data-theme="light"] .sidebar-clean-header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-light);
}

[data-theme="light"] .sidebar-clean-footer {
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border-light);
}

[data-theme="light"] .nav-action-btn {
  background: var(--surface-0);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}

[data-theme="light"] .nav-action-btn:hover {
  background: var(--surface-1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Dark theme specific adjustments */
[data-theme="dark"] {
  --sidebar-bg: #0a0a0a;
  --border-subtle: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar-clean {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-subtle);
}

[data-theme="dark"] .sidebar-clean-header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="dark"] .sidebar-clean-footer {
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border-subtle);
}

[data-theme="dark"] .nav-action-btn {
  background: var(--surface-1);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

[data-theme="dark"] .nav-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* FINAL OVERRIDE: Force notification icon to 22px */
html body #notifications-btn svg,
html body #notifications-btn svg#notification-icon {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
}

/* MAXIMIZE THEME TOGGLE ICON SIZE AND MANAGE VISIBILITY */
#theme-toggle-btn svg {
  width: 28px !important;
  height: 28px !important;
  transition: transform 0.3s ease;
}

/* MAXIMIZE NOTIFICATION ICON SIZE TO MATCH THEME TOGGLE */
#notifications-btn svg,
#notifications-btn svg#notification-icon {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  transition: transform 0.3s ease;
}

#theme-toggle-btn .sun-icon,
#theme-toggle-btn .moon-icon {
  display: none;
}

#theme-toggle-btn.light-mode .sun-icon {
  display: block;
}

#theme-toggle-btn.dark-mode .moon-icon {
  display: block;
} 