/* ============================================================
   HEADER SEARCH
   ============================================================ */
.cf-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 20px;
  margin-right: 14px;
  z-index: 20;
}

.cf-search-toggle {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}

.cf-search-toggle:hover,
.cf-search-toggle:focus-visible,
.cf-search.open .cf-search-toggle {
  color: var(--primary-lighter);
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.cf-search-panel {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 20px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 28px 80px rgba(2, 8, 23, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1200;
}

.cf-search.open .cf-search-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.cf-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e8edf5;
  background: #fff;
}

.cf-search-bar > .fas {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.95rem;
}

.cf-search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 1rem;
}

.cf-search-input::placeholder {
  color: #94a3b8;
}

.cf-search-clear {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  font-size: 0.75rem;
}

.cf-search-clear:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.cf-search-results {
  max-height: min(58vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.cf-search-label {
  margin: 8px 10px 9px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cf-search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 8px 8px;
}

.cf-search-chip {
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  padding: 7px 11px;
}

.cf-search-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef4ff;
}

.cf-search-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 10px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.cf-search-item:hover,
.cf-search-item.is-active {
  background: #eef4ff;
}

.cf-search-type {
  flex: 0 0 auto;
  max-width: 112px;
  margin-top: 2px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #e8f0ff;
  color: #1a56db;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.cf-search-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.cf-search-title {
  display: block;
  color: #0f172a;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.cf-search-title mark {
  border-radius: 3px;
  background: #fde68a;
  color: inherit;
}

.cf-search-desc {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cf-search-arrow {
  flex: 0 0 auto;
  margin-top: 7px;
  color: #94a3b8;
  font-size: 0.72rem;
}

.cf-search-item:hover .cf-search-arrow,
.cf-search-item.is-active .cf-search-arrow {
  color: var(--primary);
}

.cf-search-state {
  display: grid;
  gap: 6px;
  padding: 26px 18px;
  color: #64748b;
  font-size: 0.86rem;
  line-height: 1.5;
  text-align: center;
}

.cf-search-state strong {
  color: #0f172a;
  font-size: 0.95rem;
}

.cf-search-empty-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 6px;
}

.cf-search-empty-links a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cf-search-foot {
  padding: 9px 14px;
  border-top: 1px solid #e8edf5;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.7rem;
  text-align: right;
}

@media (min-width: 1180px) and (max-width: 1439.98px) {
  .cf-search { margin-left: 10px; margin-right: 14px; }
  .cf-search-toggle { width: 36px; height: 36px; }
  .nav-links { gap: 4px; }
  .nav-link { font-size: 0.94rem; padding: 7px 7px; }
  .header-btn { --main-size: 0.82em; padding: 0.58em 0.72em 0.58em 0.95em; }
}

@media (max-width: 1179px) {
  .cf-search {
    margin-left: auto;
    margin-right: 8px;
  }

  .cf-search-panel {
    position: fixed;
    top: calc(var(--header-height) + 8px);
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - var(--header-height) - 20px);
  }

  .cf-search-results {
    max-height: calc(100vh - var(--header-height) - 120px);
  }
}

@media (max-width: 480px) {
  .cf-search-toggle {
    width: 38px;
    height: 38px;
  }

  .cf-search-panel {
    border-radius: 16px;
  }
}
