.search-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.search-page__header {
  background: var(--color-bg-base);
  padding-top: var(--space-9);
}

.search-page__field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-page__field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-base);
  pointer-events: none;
}

.search-page__input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  background-color: var(--color-bg-elevated);
  color: var(--color-text-base);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 400;
  border: none;
  border-radius: var(--radius-pill);
  outline: none;
  box-shadow: var(--shadow-input-inset);
  transition: box-shadow 0.15s ease;
}

.search-page__input::placeholder {
  color: var(--color-text-muted);
}

.search-page__input:hover {
  box-shadow: rgb(18, 18, 18) 0px 1px 0px,
    rgb(179, 179, 179) 0px 0px 0px 1px inset;
}

.search-page__input:focus {
  box-shadow: var(--shadow-input-focus);
}

.search-page__body {
  flex: 1;
  padding: var(--space-5) var(--space-5) var(--space-9);
}

.search-page__heading {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-base);
  margin: 0 0 var(--space-4);
}

.categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.category-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-comfortable);
  overflow: hidden;
  background-color: var(--cat-color);
  text-decoration: none;
  isolation: isolate;
  transition: transform 0.15s ease;
}

.category-card:hover {
  transform: translateY(-2px);
}

.category-card__image {
  position: absolute;
  top: -12%;
  right: -18%;
  width: 60%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-subtle);
  transform: rotate(25deg);
  box-shadow: var(--shadow-medium);
  z-index: 1;
}

.category-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--cat-color) 0%,
    var(--cat-color) 35%,
    color-mix(in srgb, var(--cat-color) 35%, transparent) 100%
  );
  z-index: 2;
  pointer-events: none;
}

.category-card__name {
  position: relative;
  z-index: 3;
  display: block;
  padding: var(--space-4);
  font-family: var(--font-title);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-base);
  line-height: 1.2;
}

.search-page__results {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.search-results__empty {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-9) 0;
}

.search-results__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.search-results__title {
  font-family: var(--font-title);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-base);
  margin: 0;
}

.search-results__hint {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin: 0;
}

.search-results__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.search-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-standard);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
}

.search-result:hover {
  background-color: var(--color-bg-surface);
  text-decoration: none;
}

.search-page__history {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-4);
}

.search-page__empty {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

.search-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.search-history {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.search-history__row {
  flex: 1;
  min-width: 0;
}

.search-history__remove-form {
  margin: 0;
  display: inline-flex;
}

.search-history__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-circle);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.search-history__remove:hover {
  color: var(--color-text-base);
  background-color: var(--color-bg-elevated);
}

.search-result__image {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--radius-subtle);
  object-fit: cover;
  background-color: var(--color-bg-elevated);
}

.search-result__image--round {
  border-radius: var(--radius-circle);
}

.search-result__image--placeholder {
  background-color: var(--color-bg-elevated);
}

.search-result__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result__name {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-base);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result__sub {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 576px) {
  .categories {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 896px) {
  .categories {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
