/* Captcha widget styles. */
/* */
/* Built to sit inside the landing's existing forms rather than look like a */
/* separate widget: it borrows the :root custom properties index.html already */
/* defines, with literal fallbacks so b2b.html and calculator.html look right on */
/* their own. Everything is scoped under .captcha-widget. */

.captcha-widget {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  /* The mount point (id="modalCaptcha" / id="b2bCaptcha") is a bare div, not a */
  /* .modal-field or .b2b-field, so it inherits none of their bottom margins and */
  /* the submit button ends up flush against the captcha. Spacing lives here so */
  /* all three forms get it. 20px matches .modal-field; .b2b-field uses 22px. */
  margin-bottom: 20px;
}

.captcha-widget__label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--gray, #6b6b6b);
}

.captcha-widget__controls {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.captcha-widget__image {
  position: relative;
  flex: 0 0 auto;
  width: 180px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cream, #f9f7f2);
  box-shadow: inset 0 0 0 1px rgba(38, 48, 31, 0.14);
}

/* While a new challenge loads, keep the box from collapsing. */
.captcha-widget__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.18s ease;
}

.captcha-widget__img.is-loading {
  opacity: 0;
}

.captcha-widget__img:not([src]) {
  visibility: hidden;
}

.captcha-widget__input {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  padding: 0 16px;
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--black, #1a1a1a);
  background: var(--white, #fff);
  border: 1px solid rgba(38, 48, 31, 0.16);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.captcha-widget__input::placeholder {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--gray-light, #b0b0b0);
}

.captcha-widget__input:focus {
  border-color: var(--green-mid, #86a47c);
  box-shadow: 0 0 0 3px rgba(134, 164, 124, 0.22);
}

/* Refresh rides in the image's corner on a soft pill, so it reads as an
   affordance on the picture rather than a third control in the row. */
.captcha-widget__refresh {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--green-dark, #5c7a54);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(38, 48, 31, 0.14);
  border-radius: 8px;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.captcha-widget__refresh:hover {
  background: var(--white, #fff);
  color: var(--green-ink, #4a7040);
}

.captcha-widget__refresh:active {
  transform: scale(0.94);
}

.captcha-widget__refresh:focus-visible {
  outline: 2px solid var(--green-mid, #86a47c);
  outline-offset: 2px;
}

.captcha-widget__refresh svg {
  width: 15px;
  height: 15px;
}

.captcha-widget__refresh.is-loading svg {
  animation: captcha-spin 0.8s linear infinite;
}

.captcha-widget__error {
  margin: 0;
  font-size: 13px;
  color: #c0392b;
}

.captcha-widget.has-error .captcha-widget__input {
  border-color: #d98b80;
  background: #fdf7f6;
}

.captcha-widget.has-error .captcha-widget__input:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.16);
}

.captcha-widget.has-error .captcha-widget__image {
  box-shadow: inset 0 0 0 1px rgba(192, 57, 43, 0.28);
}

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

@media (prefers-reduced-motion: reduce) {
  .captcha-widget__refresh.is-loading svg {
    animation: none;
  }

  .captcha-widget__img,
  .captcha-widget__input,
  .captcha-widget__refresh {
    transition: none;
  }
}

/* Narrow viewports: let the input take its own row rather than crushing it. */
@media (max-width: 420px) {
  .captcha-widget__controls {
    flex-wrap: wrap;
  }

  .captcha-widget__input {
    flex: 1 0 100%;
    min-height: 46px;
  }
}
