/* ========================================
   Global Search Bar Styles - Elegant Design
   ======================================== */

/* CRITICAL: Forza visualizzazione navbar su mobile/tablet */
@media (max-width: 991.98px) {
  .navbar-collapse,
  .collapse.navbar-collapse,
  #navbar.collapse,
  #navbar {
    display: flex !important;
    flex-basis: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}
ul.nav.flex-column.ms-4 {
    padding: 10px;
}
.global-search-container {
  width: 220px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-search-container.expanded {
  width: 400px;
}

@media (max-width: 768px) {
  .global-search-container {
    width: 160px;
  }
  .global-search-container.expanded {
    width: 300px;
  }
}

.global-search-input-group {
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,249,250,0.95) 100%);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0,0,0,0.06);
}

.global-search-container.expanded .global-search-input-group {
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.2), 0 2px 8px rgba(0,0,0,0.08);
  background: #fff;
  border-color: rgba(102, 126, 234, 0.3);
}

.global-search-input {
  background: transparent !important;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.global-search-input:focus {
  box-shadow: none !important;
}

.global-search-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

/* Dropdown elegante */
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: -20px;
  right: -20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0,0,0,0.05);
  max-height: 480px;
  overflow: hidden;
  z-index: 1050;
  animation: searchDropdownFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes searchDropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header con filtri */
.global-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

.global-search-header-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.global-search-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.global-search-filter-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.global-search-filter-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: transparent;
}

/* Filtri dropdown */
.global-search-filters {
  display: none;
  padding: 12px 16px;
  background: #fafbfc;
  border-bottom: 1px solid #e2e8f0;
  gap: 8px;
  flex-wrap: wrap;
}

.global-search-filters.show {
  display: flex;
}

.global-search-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.global-search-filter-tag:hover {
  border-color: #667eea;
  color: #667eea;
}

.global-search-filter-tag.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: transparent;
}

.global-search-filter-tag .filter-check {
  display: none;
}

.global-search-filter-tag.active .filter-check {
  display: inline;
}

/* Scrollable results */
.global-search-results {
  max-height: 380px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.global-search-results::-webkit-scrollbar {
  width: 6px;
}

.global-search-results::-webkit-scrollbar-track {
  background: transparent;
}

.global-search-results::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.global-search-results::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Sezioni */
.global-search-section {
  border-bottom: 1px solid #f1f5f9;
}

.global-search-section:last-child {
  border-bottom: none;
}

.global-search-section.hidden {
  display: none;
}

.global-search-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: sticky;
  top: 0;
  z-index: 1;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.9);
}

.global-search-section-header:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

.global-search-section-header .badge {
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.global-search-section.filtered .global-search-section-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.global-search-section.filtered .global-search-section-header .badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #fff;
}

.global-search-section-items {
  padding: 4px 8px 8px;
}

/* Items eleganti */
.global-search-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: inherit;
  margin: 2px 0;
}

.global-search-item:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.global-search-item:hover .global-search-item-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: scale(1.05);
}

.global-search-item:hover .global-search-item-desc {
  color: rgba(255, 255, 255, 0.85);
}

.global-search-item-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 100%);
  border-radius: 10px;
  margin-right: 12px;
  color: #667eea;
  font-size: 0.95rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-search-item-content {
  flex: 1;
  min-width: 0;
}

.global-search-item-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-item-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-item-arrow {
  opacity: 0;
  transform: translateX(-8px);
  transition: all 0.2s;
  color: rgba(255,255,255,0.8);
}

.global-search-item:hover .global-search-item-arrow {
  opacity: 1;
  transform: translateX(0);
}

.global-search-highlight {
  background: rgba(102, 126, 234, 0.15);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
}

.global-search-item:hover .global-search-highlight {
  background: rgba(255, 255, 255, 0.25);
}

/* Keyboard navigation */
.global-search-item.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.global-search-item.active .global-search-item-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.global-search-item.active .global-search-item-desc {
  color: rgba(255, 255, 255, 0.85);
}

.global-search-item.active .global-search-item-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Loading e Empty states */
.global-search-loading,
.global-search-empty {
  padding: 40px 20px;
}

.global-search-empty i {
  color: #cbd5e1;
}

/* Footer shortcut hint */
.global-search-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 0.7rem;
  color: #94a3b8;
}

.global-search-footer kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-family: inherit;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

