/*!
Vouch app code (c) Rofsky Solutions. Unauthorized copying or reuse prohibited. Merchant content and third-party licenses unaffected.
*/
/* --- Buttons (Global Actions) --- */
.write-review-btn,
.btn-submit {
  background: var(--review-primary-color);
  color: var(--review-button-text-color);
  border: none;
  padding-block: 8px;
  padding-inline: 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.write-review-btn:hover,
.btn-submit:hover {
  background: #000;
}

.btn-cancel {
  background: #f1f2f3;
  color: var(--review-text-color);
  border: none;
  padding-block: 14px;
  padding-inline: 28px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-cancel:hover {
  background: #e0e0e0;
}

/* --- Review Popup Modal --- */
.review-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.review-popup[style*="display: flex"] {
  display: flex !important;
}

.review-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.review-popup-content {
  position: relative;
  background: white;
  border-radius: var(--review-radius);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 10000;
}

.review-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--review-border-color);
}

.review-popup-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--review-text-color);
}

.review-popup-close {
  position: absolute;
  inset-inline-end: 20px;
  top: 20px;
  z-index: 3;
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  color: var(--review-text-secondary);
  transition: color 0.2s ease;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-popup-close:hover {
  color: var(--review-text-color);
}

/* --- Review Form --- */
.review-form {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--review-text-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--review-border-color);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--review-primary-color);
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.1);
}

/* Star Rating Input */
.star-input {
  display: flex;
  justify-content: center;
  gap: 6px;
}

/* Center-aligned form content */
.review-form {
  text-align: center;
}

.review-form .form-group label {
  text-align: center;
}

.review-form .form-group input,
.review-form .form-group textarea {
  text-align: center;
}

/* Inline field error */
.field-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 15px;
  font-weight: 500;
  color: #d93025;
}

.field-error[hidden] {
  display: none;
}

.field-error svg {
  flex-shrink: 0;
  color: #d93025;
  stroke: #d93025;
}

.star-btn {
  background: none;
  border: none;
  font-size: 36px;
  color: #ddd;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  line-height: 1;
}

.star-btn.selected,
.star-btn:hover,
.star-btn.hover {
  color: var(--review-star-color);
  transform: scale(1.1);
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--review-border-color);
}

.btn-back {
  margin-inline-end: auto;
  background: transparent;
  color: var(--review-text-color);
  border: 1px solid var(--review-border-color);
  padding-block: 10px;
  padding-inline: 18px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.btn-back:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
}

.btn-next {
  background: var(--review-primary-color);
  color: var(--review-button-text-color);
  border: none;
  padding-block: 10px;
  padding-inline: 22px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    opacity 0.2s ease;
}

.btn-next:hover {
  background: #000;
}

/* --- Multi-step wizard --- */
.review-form-steps-viewport {
  overflow: hidden;
  /* Unlike hidden, clip cannot auto-scroll when an input receives focus. */
  overflow: clip;
}

.review-form-steps {
  display: flex;
  transition: transform 0.3s ease;
  will-change: transform;
}

.review-form-step {
  flex: 0 0 100%;
  min-width: 0;
  box-sizing: border-box;
  padding-inline: 2px;
  /* Off-screen fields must not steal focus and scroll the sliding viewport. */
  visibility: hidden;
}

.review-form[data-current-step="1"] .review-form-step[data-step="1"],
.review-form[data-current-step="2"] .review-form-step[data-step="2"],
.review-form[data-current-step="3"] .review-form-step[data-step="3"] {
  visibility: visible;
}

.review-form-step[data-step="2"] {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.review-form[data-current-step="1"] .review-form-steps {
  transform: translateX(0);
}

.review-form[data-current-step="2"] .review-form-steps {
  transform: translateX(-100%);
}

.review-form[data-current-step="3"] .review-form-steps {
  transform: translateX(-200%);
}

[dir="rtl"] .review-form[data-current-step="2"] .review-form-steps {
  transform: translateX(100%);
}

[dir="rtl"] .review-form[data-current-step="3"] .review-form-steps {
  transform: translateX(200%);
}

/* Keep the last form-group in each step flush with no bottom margin so
   the action bar spacing stays consistent across steps */
.review-form-step .form-group:last-child {
  margin-bottom: 0;
}

.form-step-hint {
  margin: -2px 0 12px;
  font-size: 13px;
  color: var(--review-text-color);
  opacity: 0.6;
}

/* Step dots */
.form-step-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.form-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e0e0e0;
  transition:
    width 0.25s ease,
    background-color 0.25s ease,
    border-radius 0.25s ease;
}

.form-step-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--review-primary-color);
}

/* --- Image Upload Styles --- */
.review-form-step[data-step="2"] .form-group {
  position: relative;
}

/* More specific than the general .form-group input rule above. */
.review-form .form-group .review-image-input {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

label.upload-photos-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  background: var(--review-button-bg);
  color: var(--review-button-text-color);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    transform 0.15s ease;
}

label.upload-photos-btn:hover,
.review-image-input:focus + label.upload-photos-btn {
  opacity: 0.9;
}

.review-form-step[data-step="2"] .form-group:focus-within label.upload-photos-btn {
  outline: 2px solid var(--review-primary-color, #333);
  outline-offset: 2px;
}

label.upload-photos-btn:active {
  transform: scale(0.99);
}

label.upload-photos-btn span {
  color: var(--review-button-text-color);
  line-height: 1;
}

label.upload-photos-btn svg {
  flex-shrink: 0;
  display: block;
  color: var(--review-button-text-color);
  stroke: var(--review-button-text-color);
}

.image-previews {
  margin-top: 12px;
}

.image-preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.image-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--review-border-color);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.remove-image:hover {
  background: rgba(255, 0, 0, 0.8);
}

/* Form Messages */
.form-message {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  display: none;
}

.form-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.form-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.form-message.warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* --- Submission Status Overlay (uploading / success) --- */
.review-form-status {
  position: absolute;
  inset: 0;
  background: var(--review-bg-color, #ffffff);
  border-radius: var(--review-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 40px 24px;
  text-align: center;
  z-index: 2;
}

.review-form-status[hidden] {
  display: none;
}

.review-form-status-text {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--review-text-color);
  max-width: 360px;
}

.review-form-status[data-state="success"] .review-form-status-text {
  font-size: 36px;
}

.review-form-status[data-state="success"] .review-form-status-spinner {
  display: none;
}

.review-form-status-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--review-border-color, #ebebeb);
  border-top-color: var(--review-primary-color);
  animation: review-form-status-spin 0.8s linear infinite;
}

@keyframes review-form-status-spin {
  to {
    transform: rotate(360deg);
  }
}
