/**
 * SHIBY Testimonials — Leave a Review UI, modal form, slider fixes.
 * Scoped to plugin classes only; overrides inherited Webflow form/button styles.
 */

:root {
  --shiby-emerald: #0f5c4c;
  --shiby-emerald-dark: #0a3d34;
  --shiby-gold: #c9a227;
  --shiby-gold-light: #e8c84a;
  --shiby-warm-white: #f8f6f1;
  --shiby-text: #1a2e2a;
  --shiby-muted: #4a5a56;
  --shiby-border: rgba(15, 74, 63, 0.18);
  --shiby-error: #b42318;
  --shiby-star-grey: #c5c5c5;
}

/* ── Leave a Review button (intro card) ─────────────────────────────── */

.shiby-leave-review-wrap {
  margin-top: 1.5rem;
  width: 100%;
  display: flex;
  justify-content: center;
}

.shiby-leave-review-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.85rem 1.65rem;
  border: 2px solid var(--shiby-emerald);
  border-radius: 999px;
  background-color: var(--shiby-emerald);
  color: #fff !important;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  box-shadow: 0 4px 14px rgba(15, 92, 76, 0.22);
  -webkit-appearance: none;
  appearance: none;
}

.shiby-leave-review-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
}

.shiby-leave-review-btn__icon svg {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
}

.shiby-leave-review-btn__text {
  display: inline-block;
  font-size: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  position: static !important;
}

.shiby-leave-review-btn:hover,
.shiby-leave-review-btn:focus-visible {
  background-color: var(--shiby-gold);
  border-color: var(--shiby-gold);
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(201, 162, 39, 0.28);
  outline: none;
}

.shiby-leave-review-btn:focus-visible {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--shiby-gold);
}

.shiby-leave-review-btn:active {
  transform: translateY(1px);
}

/* ── Modal shell ────────────────────────────────────────────────────── */

.shiby-review-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.shiby-review-modal[hidden] {
  display: none !important;
}

.shiby-review-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 28, 24, 0.72);
  backdrop-filter: blur(2px);
}

.shiby-review-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 600px);
  max-height: calc(100vh - 2.5rem);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--shiby-warm-white);
  border-radius: 20px;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(201, 162, 39, 0.35);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--shiby-text);
  -webkit-text-fill-color: currentColor;
}

.shiby-review-modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--shiby-emerald);
  color: #fff !important;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.shiby-review-modal__close:hover,
.shiby-review-modal__close:focus-visible {
  background: var(--shiby-gold);
  outline: none;
}

.shiby-review-modal__close:focus-visible {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--shiby-gold);
}

.shiby-review-modal__header {
  margin-bottom: 1.5rem;
  padding-right: 2.5rem;
}

.shiby-review-modal__title {
  margin: 0 0 0.65rem;
  color: var(--shiby-emerald) !important;
  font-size: 1.625rem !important;
  line-height: 1.25 !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

.shiby-review-modal__intro {
  margin: 0;
  color: var(--shiby-muted) !important;
  font-size: 0.95rem !important;
  line-height: 1.55 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ── Form layout & visible labels ─────────────────────────────────── */

.shiby-review-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.shiby-review-form__field {
  margin-bottom: 1.15rem;
}

.shiby-review-form__label,
.shiby-review-form__rating legend.shiby-review-form__label {
  display: block;
  margin: 0 0 0.4rem;
  padding: 0;
  color: var(--shiby-emerald) !important;
  font-size: 0.9375rem !important;
  line-height: 1.4 !important;
  font-weight: 600 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  -webkit-text-fill-color: currentColor !important;
  float: none;
  width: auto;
}

.shiby-review-form__rating {
  margin: 0 0 1.15rem;
  padding: 0;
  border: 0;
  min-width: 0;
}

.shiby-review-form__field input[type="text"],
.shiby-review-form__field input[type="email"],
.shiby-review-form__field select,
.shiby-review-form__field textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid var(--shiby-border);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: #fff !important;
  color: var(--shiby-text) !important;
  font: inherit;
  font-size: 0.9375rem !important;
  line-height: 1.45 !important;
  opacity: 1 !important;
  visibility: visible !important;
  -webkit-text-fill-color: currentColor !important;
  transform: none !important;
  height: auto;
}

.shiby-review-form__field select {
  cursor: pointer;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--shiby-emerald) 50%), linear-gradient(135deg, var(--shiby-emerald) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 2px), calc(100% - 12px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  -webkit-appearance: none;
  appearance: none;
}

.shiby-review-form__field textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.shiby-review-form__field input::placeholder,
.shiby-review-form__field textarea::placeholder {
  color: #7a8a86 !important;
  opacity: 1 !important;
}

.shiby-review-form__field input:focus,
.shiby-review-form__field select:focus,
.shiby-review-form__field textarea:focus {
  outline: 2px solid var(--shiby-gold);
  outline-offset: 1px;
  border-color: rgba(201, 162, 39, 0.55);
}

.shiby-review-form__hint {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem !important;
  color: #667672 !important;
  opacity: 1 !important;
}

.shiby-review-form__error {
  margin: 0.35rem 0 0;
  color: var(--shiby-error) !important;
  font-size: 0.85rem !important;
  min-height: 1.1rem;
  opacity: 1 !important;
}

.shiby-review-form__message {
  margin: 0 0 1rem;
  min-height: 1.25rem;
  font-size: 0.95rem !important;
  opacity: 1 !important;
}

.shiby-review-form__message.is-success {
  color: var(--shiby-emerald) !important;
}

.shiby-review-form__message.is-error {
  color: var(--shiby-error) !important;
}

.shiby-review-form__honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.shiby-required {
  color: var(--shiby-gold) !important;
  font-weight: 700;
}

/* ── Consent checkbox ───────────────────────────────────────────────── */

.shiby-review-form__consent-label {
  display: flex !important;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  cursor: pointer;
  font-weight: 400 !important;
}

.shiby-review-form__consent-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--shiby-emerald);
  cursor: pointer;
}

.shiby-review-form__consent-text {
  display: block;
  color: var(--shiby-text) !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

/* ── Star rating ────────────────────────────────────────────────────── */

.shiby-star-input__hint {
  margin: 0 0 0.5rem;
  color: var(--shiby-muted) !important;
  font-size: 0.875rem !important;
  opacity: 1 !important;
}

.shiby-star-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.shiby-star-input__label {
  cursor: pointer;
  margin: 0;
  padding: 0.15rem;
  border-radius: 6px;
  line-height: 1;
}

.shiby-star-input__label input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.shiby-star-input__star {
  display: block;
  font-size: 1.85rem;
  line-height: 1;
  color: var(--shiby-star-grey) !important;
  transition: color 0.15s ease, transform 0.15s ease;
  opacity: 1 !important;
  visibility: visible !important;
}

.shiby-star-input__label:hover .shiby-star-input__star,
.shiby-star-input__label:focus-within .shiby-star-input__star,
.shiby-star-input__label.is-active .shiby-star-input__star,
.shiby-star-input__label.is-preview .shiby-star-input__star,
.shiby-star-input__label input:checked + .shiby-star-input__star {
  color: var(--shiby-gold) !important;
}

.shiby-star-input__label:hover .shiby-star-input__star,
.shiby-star-input__label:focus-within .shiby-star-input__star {
  transform: scale(1.08);
}

.shiby-star-input__value {
  margin: 0.45rem 0 0;
  min-height: 1.25rem;
  color: var(--shiby-emerald) !important;
  font-size: 0.875rem !important;
  font-weight: 600;
  opacity: 1 !important;
}

/* ── Submit button ──────────────────────────────────────────────────── */

.shiby-review-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.95rem 1.5rem;
  border: 2px solid var(--shiby-emerald);
  border-radius: 12px;
  background-color: var(--shiby-emerald) !important;
  color: #fff !important;
  font-family: inherit;
  font-size: 1rem !important;
  font-weight: 600;
  line-height: 1.2 !important;
  letter-spacing: 0.01em;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  position: static !important;
  overflow: visible !important;
  box-shadow: 0 4px 14px rgba(15, 92, 76, 0.22);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.shiby-review-form__submit:hover:not(:disabled),
.shiby-review-form__submit:focus-visible:not(:disabled) {
  background-color: var(--shiby-gold) !important;
  border-color: var(--shiby-gold);
  color: #fff !important;
  outline: none;
}

.shiby-review-form__submit:focus-visible:not(:disabled) {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--shiby-gold);
}

.shiby-review-form__submit:disabled {
  opacity: 0.7 !important;
  cursor: not-allowed;
}

/* ── Accessibility helpers ────────────────────────────────────────── */

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

body.shiby-review-modal-open {
  overflow: hidden;
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .shiby-review-modal {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .shiby-review-modal__dialog {
    width: 100%;
    max-height: calc(100vh - 1.5rem);
    padding: 1.5rem 1.15rem 1.25rem;
    border-radius: 18px 18px 14px 14px;
  }

  .shiby-review-modal__title {
    font-size: 1.35rem !important;
  }

  .shiby-leave-review-btn {
    width: 100%;
    max-width: 18rem;
  }

  .shiby-review-form__submit {
    width: 100%;
  }
}

/* ── Frontend validation highlighting (scoped) ──────────────────────── */

.shiby-review-modal .shiby-review-form .shiby-review-form__field.is-field-invalid input[type="text"],
.shiby-review-modal .shiby-review-form .shiby-review-form__field.is-field-invalid input[type="email"],
.shiby-review-modal .shiby-review-form .shiby-review-form__field.is-field-invalid select,
.shiby-review-modal .shiby-review-form .shiby-review-form__field.is-field-invalid textarea {
  border-color: var(--shiby-error) !important;
  background-color: rgba(180, 35, 24, 0.06) !important;
}

.shiby-review-modal .shiby-review-form .shiby-review-form__rating.is-field-invalid .shiby-star-input {
  border: 1px solid var(--shiby-error);
  background-color: rgba(180, 35, 24, 0.06);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
}

.shiby-review-modal .shiby-review-form .shiby-review-form__consent.is-field-invalid .shiby-review-form__consent-label {
  border: 1px solid var(--shiby-error);
  background-color: rgba(180, 35, 24, 0.06);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.shiby-review-modal .shiby-review-form .shiby-review-form__error:not(:empty) {
  display: block;
}
