/* =============================================
   Header Search Icon Button
   ============================================= */
.header-search-icon-wrap {
  display: flex;
  align-items: center;
}

.header-search-toggle {
  /* background: #009262; */
  border: none;
  width: 40px;
  height: 42px;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.header-search-toggle.active svg {
  color: #fff !important;
}

/* =============================================
   Full-Width Search Panel (dropdown below nav)
   ============================================= */
.header-search-panel {
  display: none;
  width: 100%;
  background: #fff;
  position: relative;
  z-index: 998;
  padding: 24px 0 20px;
  direction: rtl;
  box-shadow: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  border-radius: 0 0 16px 16px;
}

.header-search-panel.open {
  display: block;
  animation: slideDown 0.2s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-search-panel-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* =============================================
   Search field row: [× close] [input + icon] [بحث btn]
   ============================================= */
.header-search-field-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-direction: row;
  position: relative;
}

/* Close button — inline at the start of the row (LTR left / RTL right) */
.header-search-close {
  background: none;
  border: none;
  display: flex;
}

html[dir="rtl"] .header-search-close {
  order: -1;
}

.header-search-input-group {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.header-search-input {
  width: 100%;
  height: 40px;
  border: 1px solid #d2d6db;
  border-radius: 8px;
  padding: 0 48px 0 16px;
  font-size: 15px;
  color: #435363;
  background: #fff;
  outline: none;
  direction: rtl;
  text-align: right;
  transition: border-color 0.2s;
}

.header-search-input:focus {
  border-color: #009262;
}

.header-search-input::placeholder {
  color: #384250;
  font-weight: 400;
  font-size: 16px;
}

.header-search-input-icon {
  position: absolute;
  right: 14px;
  color: #384250;
  display: flex;
  align-items: center;
  pointer-events: none;
}


/* =============================================
   Autocomplete dropdown
   ============================================= */
.header-search-autocomplete {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  left: 80px;
  /* leave space for submit button */
  background: #fff;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 1050;
  max-height: 320px;
  overflow-y: auto;
}

.header-search-field-wrap {
  position: relative;
}

.header-autocomplete-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-autocomplete-item,
.header-autocomplete-view-all {
  border-bottom: 1px solid #f0f0f0;
}

.header-autocomplete-item a,
.header-autocomplete-view-all a {
  display: block;
  padding: 11px 16px;
  font-size: 14px;
  color: #435363;
  text-decoration: none;
  text-align: right;
  direction: rtl;
  transition: background 0.15s;
}

.header-autocomplete-item a:hover,
.header-autocomplete-item.selected a {
  background: #f5f8fa;
  color: #009262;
}

.header-autocomplete-view-all a {
  font-weight: 600;
  color: #009262;
  background: #f9fafb;
}

.header-autocomplete-view-all a:hover {
  background: #e6f2ee;
}

/* =============================================
   Suggestions tags row
   ============================================= */
.header-search-suggestions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  direction: rtl;
  flex-direction: column;
}

.header-search-suggestions-label {
  color: #009262;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.header-search-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.header-search-tags .btn-outline-primary {
  display: flex;
  height: 32px;
  padding: 0 12px;
  justify-content: center;
  align-items: center;
  gap: 4px;
  color: #161616;
  text-align: center;
  font-size: 16px;
  font-style: normal;
  font-weight: 500;
  line-height: 24px;
  background-color: #F3F4F6;
  border: unset;
}

.header-search-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9999px;
  border: 1px solid #d2d6db;
  background: #fff;
  color: #435363;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.header-search-tag span {
  color: #009262;
  font-size: 16px;
  line-height: 1;
}

.header-search-tag:hover {
  background: #009262;
  color: #fff;
  border-color: #009262;
}

.header-search-tag:hover span {
  color: #fff;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
  .header-search-field-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .header-search-btn-submit {
    width: 100%;
  }

  .header-search-autocomplete {
    left: 0;
  }
}