/* ==========================================
   Header Live Search Dropdown
   ========================================== */

/* Dropdown container */
.hs-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 360px;
  max-width: 480px;
  max-height: 440px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 8px;
  z-index: 1050;
  animation: hsSlideIn 0.2s ease;
}

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

html.dark-mode .hs-dropdown {
  background: rgba(30, 30, 30, 0.98);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

/* Scrollbar */
.hs-dropdown::-webkit-scrollbar {
  width: 4px;
}

.hs-dropdown::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

html.dark-mode .hs-dropdown::-webkit-scrollbar-thumb {
  background: #4b5563;
}

/* Group */
.hs-group {
  margin-bottom: 4px;
}

.hs-group:not(:last-child) {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

html.dark-mode .hs-group:not(:last-child) {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.hs-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
}

html.dark-mode .hs-group-header {
  color: #6b7280;
}

.hs-group-header i {
  font-size: 14px;
}

/* Result item */
.hs-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.hs-result-item:hover,
.hs-result-item.hs-active {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

html.dark-mode .hs-result-item:hover,
html.dark-mode .hs-result-item.hs-active {
  background: rgba(59, 130, 246, 0.12);
}

/* Thumbnail */
.hs-result-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

html.dark-mode .hs-result-thumb {
  background: rgba(255, 255, 255, 0.08);
}

.hs-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hs-result-thumb i {
  font-size: 20px;
  color: #6b7280;
}

html.dark-mode .hs-result-thumb i {
  color: #9ca3af;
}

/* Text info */
.hs-result-info {
  flex: 1;
  min-width: 0;
}

.hs-result-title {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.dark-mode .hs-result-title {
  color: #f3f4f6;
}

.hs-result-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.dark-mode .hs-result-subtitle {
  color: #9ca3af;
}

/* Highlight match */
.hs-highlight {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  border-radius: 2px;
  padding: 0 1px;
}

html.dark-mode .hs-highlight {
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
}

/* See all link */
.hs-see-all {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.hs-see-all:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
}

html.dark-mode .hs-see-all {
  color: #60a5fa;
}

html.dark-mode .hs-see-all:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

/* Loading skeleton */
.hs-loading {
  padding: 8px 4px;
}

.hs-skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.hs-skeleton-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #e5e7eb;
  flex-shrink: 0;
  animation: hsPulse 1.5s infinite ease-in-out;
}

html.dark-mode .hs-skeleton-thumb {
  background: rgba(255, 255, 255, 0.08);
}

.hs-skeleton-text {
  flex: 1;
}

.hs-skeleton-line {
  border-radius: 4px;
  animation: hsPulse 1.5s infinite ease-in-out;
}

.hs-skeleton-title {
  width: 70%;
  height: 12px;
  background: #e5e7eb;
  margin-bottom: 6px;
}

.hs-skeleton-sub {
  width: 45%;
  height: 10px;
  background: #f3f4f6;
}

html.dark-mode .hs-skeleton-title {
  background: rgba(255, 255, 255, 0.1);
}

html.dark-mode .hs-skeleton-sub {
  background: rgba(255, 255, 255, 0.06);
}

@keyframes hsPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Empty state */
.hs-empty {
  text-align: center;
  padding: 28px 16px;
}

.hs-empty i {
  font-size: 36px;
  color: #d1d5db;
  display: block;
  margin-bottom: 8px;
}

html.dark-mode .hs-empty i {
  color: #4b5563;
}

.hs-empty p {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  margin: 0;
}

html.dark-mode .hs-empty p {
  color: #9ca3af;
}

.hs-empty span {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

html.dark-mode .hs-empty span {
  color: #6b7280;
}

/* Search wrapper - position context for the dropdown */
.header-search-live-wrapper {
  position: relative;
}

/* Fix: allow dropdown to overflow expandable search container */
.header-search-expandable {
  overflow: visible !important;
}

/* ==========================================
   Mobile Responsive
   ========================================== */

@media (max-width: 768px) {
  .hs-dropdown {
    position: fixed;
    top: 68px;
    left: 8px;
    right: 8px;
    min-width: auto;
    max-width: none;
    max-height: 60vh;
    border-radius: 14px;
  }
}

@media (max-width: 576px) {
  .hs-dropdown {
    top: 60px;
    left: 4px;
    right: 4px;
    max-height: 55vh;
    border-radius: 12px;
  }

  .hs-result-thumb {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  .hs-result-title {
    font-size: 12px;
  }

  .hs-result-subtitle {
    font-size: 11px;
  }
}

/* RTL adjustments */
[dir="rtl"] .hs-dropdown {
  left: 0;
  right: 0;
}
