/* Voice Search Button */

.voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 5.3rem;
  height: 2.45rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(21, 49, 66, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #153142;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

.voice-btn:hover:not(:disabled) {
  background: #eef7f2;
  border-color: rgba(33, 135, 91, 0.35);
  color: #176b49;
}

.voice-btn:focus-visible {
  outline: 3px solid rgba(33, 135, 91, 0.28);
  outline-offset: 2px;
}

.voice-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.voice-btn__icon {
  font-size: 0.98rem;
}

.voice-btn__text {
  white-space: nowrap;
}

.voice-btn--listening {
  background: #eaf8f0;
  border-color: rgba(33, 135, 91, 0.55);
  color: #0f6a42;
  box-shadow: 0 0 0 0 rgba(33, 135, 91, 0.34);
  animation: voice-pulse 1.2s ease-in-out infinite;
}

.voice-btn--listening:hover:not(:disabled) {
  background: #ddf3e7;
}

.voice-btn--error,
.voice-btn--blocked {
  background: #fff4ed;
  border-color: rgba(198, 88, 34, 0.34);
  color: #a3481d;
  box-shadow: none;
  animation: none;
}

.voice-btn--error:hover:not(:disabled),
.voice-btn--blocked:hover:not(:disabled) {
  background: #ffe9db;
  border-color: rgba(198, 88, 34, 0.48);
  color: #8d3e17;
}

.voice-btn--unsupported,
.voice-btn:disabled {
  background: #f4f7f8;
  border-color: rgba(75, 93, 100, 0.24);
  color: #6b7b82;
  cursor: not-allowed;
  box-shadow: none;
  animation: none;
}

.voice-btn--unsupported .voice-btn__icon,
.voice-btn:disabled .voice-btn__icon {
  opacity: 0.92;
}

.voice-search-status {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  min-width: 0;
  color: #4b5d64;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

.voice-search-status--idle {
  color: #51656d;
}

.voice-search-status--listening {
  color: #0f6a42;
}

.voice-search-status--blocked,
.voice-search-status--error {
  color: #a3481d;
}

.voice-search-status--unsupported {
  color: #6b7b82;
}

@keyframes voice-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(33, 135, 91, 0.34);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(33, 135, 91, 0);
  }
}

.curated-field .voice-btn {
  align-self: flex-end;
  margin-left: 0.25rem;
  margin-bottom: 0.05rem;
}

.search-recipe-view .search-input-group .voice-btn {
  position: relative;
  order: 2;
  margin-left: 0.2rem;
}

.search-recipe-view .search-input-group .voice-search-status {
  order: 3;
}

.usda-search-form > .voice-search-status,
.curated-field > .voice-search-status,
.hc-input-panel > .voice-search-status {
  display: flex;
  margin-top: 0.4rem;
}

@media (max-width: 720px) {
  .voice-btn {
    min-width: 2.55rem;
    width: 2.55rem;
    padding: 0;
  }

  .voice-btn__text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .voice-search-status {
    flex-basis: 100%;
    min-height: 1.2rem;
    font-size: 0.76rem;
  }
}
