/**
 * PetFeedback — styles for the shared submit-feedback layer (toasts + spinner).
 * Paired with assets/js/form-feedback.js. Loaded globally.
 *
 * Brand accent: coral #f27059 (spinner). Toast types use semantic colours.
 */

/* ------------------------------------------------------------------ *
 * Toast container + toasts
 * ------------------------------------------------------------------ */

.petfeedback-toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2147483000; /* above Bootstrap modals (1050+) and overlays */
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none; /* container ignores clicks; toasts re-enable */
}

.petfeedback-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border-radius: 10px;
  background: #ffffff;
  color: #3e3322;
  box-shadow: 0 8px 24px rgba(62, 51, 34, 0.18);
  border-left: 4px solid #646668;
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.petfeedback-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.petfeedback-toast.is-leaving {
  opacity: 0;
  transform: translateX(16px);
}

.petfeedback-toast__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 1px;
}

.petfeedback-toast__body {
  flex: 1 1 auto;
  min-width: 0;
  word-wrap: break-word;
}

.petfeedback-toast__close {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: #939393;
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.125rem;
  margin: -0.125rem -0.25rem 0 0;
}

.petfeedback-toast__close:hover {
  color: #3e3322;
}

/* Type variants */
.petfeedback-toast--success {
  border-left-color: #2e9e5b;
}
.petfeedback-toast--success .petfeedback-toast__icon {
  background: #2e9e5b;
}

.petfeedback-toast--error {
  border-left-color: #f25c54;
}
.petfeedback-toast--error .petfeedback-toast__icon {
  background: #f25c54;
}

.petfeedback-toast--warning {
  border-left-color: #f7b267;
}
.petfeedback-toast--warning .petfeedback-toast__icon {
  background: #f7b267;
  color: #3e3322;
}

.petfeedback-toast--info {
  border-left-color: #f27059;
}
.petfeedback-toast--info .petfeedback-toast__icon {
  background: #f27059;
}

/* ------------------------------------------------------------------ *
 * Button spinner + loading state
 * ------------------------------------------------------------------ */

.petfeedback-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: petfeedback-spin 0.6s linear infinite;
}

/* Standalone button spinners default to the brand coral when no inherited
 * colour reads well; buttons with their own text colour keep currentColor. */
.petfeedback-loading-text {
  margin-left: 0.5em;
}

button.is-loading,
input.is-loading {
  cursor: progress;
  position: relative;
}

/* Defense-in-depth for re-clicks while loading. Buttons/inputs are covered by
 * the `disabled` attribute busy() sets; anchors (<a>) ignore `disabled`, so
 * this blocks mouse re-clicks and shows the loading cursor. It is NOT the
 * correctness guard on its own (it doesn't stop keyboard activation and fails
 * if the stylesheet doesn't load) — anchor-triggered handlers additionally
 * check the is-loading class in JS before submitting. */
.is-loading {
  pointer-events: none;
}

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

@media (prefers-reduced-motion: reduce) {
  .petfeedback-spinner {
    animation-duration: 1.2s;
  }
  .petfeedback-toast {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .petfeedback-toast.is-visible,
  .petfeedback-toast.is-leaving {
    transform: none;
  }
}
