/* Quick search — integrated in site header navbar */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.navbar--with-search {
  overflow: visible;
}

.navbar--with-search .nav-container {
  gap: 10px;
  overflow: visible;
}

.nav-search {
  position: relative;
  flex: 1;
  max-width: 300px;
  min-width: 0;
}

.nav-search input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(13, 79, 60, 0.15);
  background: rgba(13, 79, 60, 0.05);
  color: var(--dark-color, #1a1a1a) !important;
  font-size: 0.82rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.nav-search input::placeholder {
  color: #7a8f86;
}

.nav-search input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary-color, #0D4F3C);
  box-shadow: 0 0 0 3px rgba(13, 79, 60, 0.1);
}

.quick-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color, #0D4F3C);
  opacity: 0.55;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.quick-search-icon svg,
.quick-search-icon i {
  width: 16px;
  height: 16px;
}

.quick-search-results {
  z-index: 10050;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(13, 79, 60, 0.1);
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(13, 79, 60, 0.04),
    0 20px 50px rgba(13, 79, 60, 0.14);
  padding: 8px;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* Portaled to body — width/position set by quick-search.js */
.quick-search-results--portal {
  position: fixed;
  width: 480px;
  max-width: calc(100vw - 24px);
  max-height: 420px;
}

.quick-search-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--dark-color, #1a1a1a) !important;
  transition: background 0.15s ease;
  min-height: 64px;
}

.quick-search-item:hover,
.quick-search-item.is-active {
  background: rgba(13, 79, 60, 0.06);
}

.quick-search-item-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0f4f2;
}

.quick-search-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quick-search-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-search-item-type {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--primary-color, #0D4F3C);
}

.quick-search-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--dark-color, #1a1a1a) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-search-item-sub {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--medium-gray, #5a6b63) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-search-item > svg,
.quick-search-item > i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-left: auto;
  opacity: 0.4;
  color: var(--primary-color, #0D4F3C);
}

.quick-search-empty {
  margin: 0;
  padding: 12px;
  font-size: 0.82rem;
  color: var(--medium-gray, #5a6b63) !important;
  text-align: center;
}

[data-theme="dark"] .nav-search input {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f0f0f0 !important;
}

[data-theme="dark"] .nav-search input:focus {
  background: #1e2423;
  border-color: rgba(168, 213, 186, 0.4);
}

[data-theme="dark"] .quick-search-results {
  background: #1e2423;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .quick-search-item-title {
  color: #f0f0f0 !important;
}

[data-theme="dark"] .quick-search-item:hover,
[data-theme="dark"] .quick-search-item.is-active {
  background: rgba(255, 255, 255, 0.06);
}

/* Tablet: hide long logo text, keep search + menu in one row */
@media (max-width: 1100px) {
  .navbar--with-search .logo-text {
    display: none;
  }
}

@media (max-width: 1024px) {
  .navbar--with-search .nav-container {
    flex-wrap: nowrap;
    align-items: center;
  }

  .navbar--with-search .nav-logo {
    flex-shrink: 0;
  }

  .navbar--with-search .nav-search {
    flex: 1;
    max-width: none;
    min-width: 0;
  }

  .navbar--with-search .hamburger {
    margin-left: 0;
    flex-shrink: 0;
  }
}

@media (min-width: 769px) {
  /* Wider than the input field — dropdown is not trapped at 300px */
  .navbar--with-search .nav-search {
    position: relative;
    overflow: visible;
  }
}

@media (max-width: 768px) {
  .nav-search input {
    font-size: 16px;
  }

  .quick-search-results--portal {
    border-radius: 14px;
    padding: 6px;
  }

  .quick-search-item {
    min-height: 58px;
    padding: 10px 12px;
    gap: 12px;
  }

  .quick-search-item-thumb {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  .nav-search input {
    height: 36px;
    padding-left: 12px;
  }
}
