/*
  Input 04 — Search Input — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is.
*/

:root {
  --input-accent: #39ff14;
  --input-fg: oklch(0.145 0 0);
  --input-border: oklch(0.87 0 0);
  --input-border-hover: oklch(0.72 0 0);
  --input-muted: oklch(0.5 0 0);
}

.search-field {
  position: relative;
}

.search-field__icon {
  position: absolute;
  top: 50%;
  left: 0.875rem;
  transform: translateY(-50%);
  display: flex;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--input-muted);
  pointer-events: none;
}

.search-field__control {
  display: block;
  width: 100%;
  height: 2.75rem;
  border-radius: 9999px;
  border: 1px solid var(--input-border);
  background-color: #ffffff;
  padding: 0 2.5rem 0 2.5rem;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 0.9375rem;
  color: var(--input-fg);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-field__control::placeholder {
  color: var(--input-muted);
}

.search-field__control:hover {
  border-color: var(--input-border-hover);
}

.search-field__control:focus-visible {
  border-color: var(--input-fg);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--input-accent) 40%, transparent);
}

.search-field__action {
  position: absolute;
  top: 50%;
  right: 0.375rem;
  transform: translateY(-50%);
  display: flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
}

.search-field__clear {
  display: none;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  background: none;
  color: var(--input-muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.search-field__clear svg {
  width: 0.875rem;
  height: 0.875rem;
}

.search-field__clear:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--input-fg);
}

.search-field__clear:focus-visible {
  outline: 2px solid var(--input-accent);
  outline-offset: 1px;
}

.search-field[data-has-value="true"]:not([data-loading="true"]) .search-field__clear {
  display: flex;
}

.search-field__spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  border: 2px solid var(--input-border);
  border-top-color: var(--input-fg);
  animation: search-field-spin 700ms linear infinite;
}

.search-field[data-loading="true"] .search-field__spinner {
  display: block;
}

@keyframes search-field-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .search-field__spinner {
    animation-duration: 1400ms;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

body {
  margin: 0;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
.input04-layout {
  display: flex;
  min-height: 20rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
}
.input04-layout__panel {
  width: 100%;
  max-width: 460px;
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
.input04-layout__status {
  margin: 0.625rem 0.25rem 0;
  font-size: 0.75rem;
  color: #737373;
}
.input04-layout__simulate {
  border-radius: 9999px;
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: #737373;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.input04-layout__simulate:hover {
  color: #0f172a;
}
