/* search.css
 *
 * Styles specific to the Startlet Search widget.
 * Relies on base colors and typography from main.css.
 */

/* Main search bar – pill floating over background */
.search-widget-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 auto 1.25rem auto;
  max-width: 540px;
  background: #ffffff;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

/* Icon wrapper – relative so select can sit on top */
.search-widget-engine-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Engine icon */
.search-widget-engine-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: contain;
}

/* Invisible select positioned over the icon
 * Click / keyboard opens native dropdown, but we don’t see its label.
 */
.search-widget-engine {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;          /* visually hidden */
  cursor: pointer;
}

/* Let keyboard users see focus outline on the icon area */
.search-widget-engine:focus-visible + .search-widget-engine-icon,
.search-widget-engine:focus-visible ~ .search-widget-engine-icon {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 2px;
}

/* Query input */
.search-widget-input {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  color: #222;
  padding: 0.35em 0.4em;
  font-size: 0.95rem;
  outline: none;
}

.search-widget-input::placeholder {
  color: #999;
}

/* Right-side button (magnifying glass icon) */
.search-widget-button {
  flex: 0 0 auto;
  border-radius: 999px;
  border: none;
  background: transparent;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  cursor: pointer;
}

.search-widget-button::before {
  content: '🔍';
  font-size: 16px;
  color: #555;
}

.search-widget-button:hover::before {
  color: #222;
}

/* Small screens: bar stretches full width */
@media (max-width: 520px) {
  .search-widget-bar {
    max-width: none;
    margin: 0 0 1rem 0;
  }
}

/* Delete button (only in global edit) – red circle, white × in all themes */
.search-widget-delete {
  display: none;              /* hide by default */
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  padding: 0;
  margin-left: 6px;
  background: #D1131A;        /* red circle */
  color: #ffffff;             /* white “×” */
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Hover state */
.search-widget-delete:hover {
  background: #ED4045 !important;
}

body.global-edit-on .search-widget-delete {
  display: inline-flex;
}
