.mk-search {
  position: relative;
  width: 100%;
  direction: rtl;
  font-family: yekan, Vazir, sans-serif;
  z-index: 30;
}

.mk-search__form {
  margin: 0;
}

.mk-search__field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 46px;
  padding: 0 0.9rem 0 0.4rem;
  background: #ececec;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background 180ms cubic-bezier(0.16, 1, 0.3, 1), border-color 180ms cubic-bezier(0.16, 1, 0.3, 1), border-radius 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mk-search.is-engaged .mk-search__field {
  background: #fff;
  border-color: #ffd3bc;
  box-shadow: 0 0 0 3px rgba(255, 103, 29, 0.14);
}

.mk-search.is-open .mk-search__field {
  border-radius: 16px 16px 0 0;
  border-bottom-color: #fff;
  box-shadow: none;
}

.mk-search__icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: #ff671d;
}

.mk-search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  color: #241c18;
  caret-color: #ff671d;
  -webkit-appearance: none;
  appearance: none;
}

.mk-search__input::-webkit-search-cancel-button,
.mk-search__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.mk-search__input::selection {
  background: #ff671d;
  color: #fffdfb;
}

.mk-search__ghost {
  position: absolute;
  right: 2.55rem;
  left: 2.5rem;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  pointer-events: none;
  color: #6d5348;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
}

.mk-search.is-engaged .mk-search__ghost {
  visibility: hidden;
}

.mk-search__brand {
  color: #ff5300;
  font-weight: 700;
}

.mk-search__clear {
  width: 32px;
  height: 32px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8a4b24;
  cursor: pointer;
}

.mk-search__clear[hidden] {
  display: none;
}

.mk-search__clear svg {
  width: 16px;
  height: 16px;
}

.mk-search__clear:hover {
  background: #fff1e8;
  color: #c2410c;
}

.mk-search__clear:focus-visible {
  outline: 2px solid #ff671d;
  outline-offset: 2px;
}

.mk-search__panel {
  position: fixed;
  z-index: 30;
  margin: 0;
  padding: 0.3rem 0 0.35rem;
  background: #fff;
  border: 1px solid #ffd3bc;
  border-top: 0;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 18px 32px -14px rgba(92, 32, 0, 0.28);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #e7b89a transparent;
}

.mk-search__panel[hidden] {
  display: none !important;
}

.mk-search.is-open .mk-search__panel {
  animation: mk-search-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mk-search__panel::-webkit-scrollbar {
  width: 8px;
}

.mk-search__panel::-webkit-scrollbar-thumb {
  background: #e7b89a;
  border-radius: 999px;
}

.mk-search__live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mk-search__note {
  margin: 0;
  padding: 0.85rem 1rem 0.95rem;
  color: #6a4636;
  font-size: 0.88rem;
  line-height: 1.6;
}

.mk-search__note--error {
  color: #9f1d1d;
}

.mk-search__label {
  display: block;
  margin: 0.15rem 0 0;
  padding: 0.45rem 0.95rem 0.2rem;
  color: #9a4314;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.4;
}

.mk-search__group + .mk-search__group .mk-search__label {
  margin-top: 0.15rem;
  border-top: 1px solid #f6e6dc;
}

.mk-search__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 52px;
  margin: 0.1rem 0.4rem;
  padding: 0.35rem 0.55rem;
  border-radius: 12px;
  text-decoration: none;
  color: #241c18;
}

.mk-search__item:hover,
.mk-search__item.is-active {
  background: #fff3eb;
}

.mk-search__item:focus-visible {
  outline: 2px solid #ff671d;
  outline-offset: 1px;
}

.mk-search__thumb {
  width: 40px;
  height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: #fff1e6;
  color: #e4570e;
}

.mk-search__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mk-search__thumb svg {
  width: 20px;
  height: 20px;
}

.mk-search__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  text-align: right;
}

.mk-search__title {
  overflow: hidden;
  color: #241c18;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mk-search__title mark {
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.mk-search__meta {
  overflow: hidden;
  color: #6a4636;
  font-size: 0.75rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mk-search__meta.is-unavailable {
  color: #9f1d1d;
}

.floating-categories__header {
  gap: 0.35rem;
}

.floating-categories__header .mk-search {
  flex: 1;
  min-width: 0;
}

@keyframes mk-search-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (max-width: 1024px) {
  .header-search {
    padding: 0 0.55rem;
  }

  .mk-search__field {
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mk-search.is-open .mk-search__panel,
  .mk-search__field {
    animation: none;
    transition: none;
  }
}
