/* Search modal (RTL) */
.wm-search-modal,
.wm-search-modal * {
  box-sizing: border-box;
}

.wm-search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  direction: rtl;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.wm-search-modal[hidden] {
  display: flex;
}

.wm-search-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wm-search-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 20, 0.55);
  backdrop-filter: blur(2px);
}

.wm-search-modal__panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--wm-color-surface, #ffffff);
  border-radius: var(--wm-radius-lg, 28px);
  box-shadow: var(--wm-shadow-md, 0 20px 60px rgba(0, 0, 0, 0.25));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: translateY(-16px) scale(0.98);
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wm-search-modal.is-open .wm-search-modal__panel {
  transform: translateY(0) scale(1);
}

.wm-search-modal__form {
  display: flex;
  align-items: center;
  gap: var(--wm-space-2, 8px);
  padding: var(--wm-space-3, 12px) var(--wm-space-4, 16px);
  border-bottom: 1px solid var(--wm-color-border, #e5e0d8);
}

.wm-search-modal__icon {
  font-size: 20px;
  color: var(--wm-color-muted, #6b7280);
  flex-shrink: 0;
}

.wm-search-modal__field {
  flex: 1;
  border: 0;
  outline: none;
  font-size: var(--wm-font-size-base, 15px);
  font-family: var(--wm-font-primary, 'Vazirmatn', system-ui, sans-serif);
  background: transparent;
  color: var(--wm-color-text, #1f2937);
  direction: rtl;
}

.wm-search-modal__close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--wm-color-muted, #6b7280);
  padding: var(--wm-space-1, 4px) var(--wm-space-2, 8px);
}

.wm-search-modal__body {
  overflow-y: auto;
  padding: var(--wm-space-2, 8px) var(--wm-space-4, 16px) var(--wm-space-4, 16px);
}

.wm-search-modal__section-title {
  font-size: var(--wm-font-size-small, 13px);
  font-weight: 600;
  color: var(--wm-color-muted, #6b7280);
  margin: var(--wm-space-3, 12px) 0 var(--wm-space-2, 8px);
}

.wm-search-modal__results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--wm-space-1, 4px);
}

.wm-search-result__link {
  display: flex;
  align-items: center;
  gap: var(--wm-space-3, 12px);
  padding: var(--wm-space-2, 8px);
  border-radius: var(--wm-radius-md, 18px);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}

.wm-search-result__link:hover,
.wm-search-result__link:focus {
  background: var(--wm-color-soft, #f9f8f5);
}

.wm-search-result__media {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--wm-radius-sm, 10px);
  overflow: hidden;
}

.wm-search-result__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wm-search-result__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wm-search-result__title {
  font-size: var(--wm-font-size-base, 15px);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--wm-color-text, #1f2937);
}

.wm-search-result__brand {
  font-size: var(--wm-font-size-small, 13px);
  color: var(--wm-color-muted, #6b7280);
}

.wm-search-result__price {
  font-size: var(--wm-font-size-small, 13px);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  color: var(--wm-color-text, #1f2937);
}

.wm-search-modal__view-all {
  display: block;
  text-align: center;
  padding: var(--wm-space-3, 12px);
  margin-top: var(--wm-space-2, 8px);
  font-size: var(--wm-font-size-small, 13px);
  font-weight: 600;
  color: var(--wm-color-primary, #111827);
  text-decoration: none;
  border-top: 1px solid var(--wm-color-border, #e5e0d8);
}

.wm-search-modal__empty {
  text-align: center;
  color: var(--wm-color-muted, #6b7280);
  font-size: var(--wm-font-size-base, 15px);
  padding: var(--wm-space-6, 24px) 0;
}

body.wm-search-modal-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .wm-search-modal {
    padding: 0;
  }

  .wm-search-modal__panel {
    max-width: none;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
}
