/**
 * YayReviews - Review Edit/Reply Actions Styles
 */

/* Action Buttons Container */
.yayrev-action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.yayrev-action-buttons.yayrev-hidden {
  display: none;
}

/* Action Button Base */
.yayrev-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.yayrev-btn:hover {
  color: #333;
  border-color: #bbb;
  background: #f9f9f9;
}

.yayrev-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.yayrev-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.yayrev-btn-icon svg {
  display: block;
}

/* Primary Button */
.yayrev-btn-primary {
  color: #fff;
  background: #000;
  border-color: #000;
}

.yayrev-btn-primary:hover {
  color: #fff;
  background: #2F2F2F;
  border-color: #000;
}

.yayrev-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading State */
.yayrev-btn.yayrev-loading {
  position: relative;
}

.yayrev-btn.yayrev-loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  top: 50%;
  left: 50%;
  margin-top: -7px;
  margin-left: -7px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: yayrev-spin 0.6s linear infinite;
}

.yayrev-btn-primary.yayrev-loading::after {
  border-top-color: #fff;
}

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

/* Action Forms Container */
.yayrev-action-forms {
  margin-top: 12px;
}

/* Form Base */
.yayrev-form {
  background: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}

.yayrev-form-header {
  margin-bottom: 12px;
}

.yayrev-form-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

/* Form Fields */
.yayrev-form-field {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.yayrev-form-field:last-child {
  margin-bottom: 0;
}

.yayrev-form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

.yayrev-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #fff;
  border-radius: var(--yayrev-radius, 6px);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Rating Field — icon modes (progressive/single): horizontal row */
.yayrev-rating-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yayrev-rating-field label {
  margin-bottom: 0;
  white-space: nowrap;
}

/* Rating Field — dropdown mode: stack vertically like other fields */
.yayrev-rating-field:has(.yayrev-rating-input--dropdown) {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.yayrev-rating-field:has(.yayrev-rating-input--dropdown) label {
  margin-bottom: 0;
}

/* Select input styling inside edit/reply forms */
.yayrev-form .yayrev-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  color: #333;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.yayrev-form .yayrev-input:focus {
  outline: none;
  border-color: #999;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

/* Form Actions */
.yayrev-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e5e5;
}

/* Form Error */
.yayrev-form-error {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
}

/* Store replies: cards hanging off a thread line, laid out like Q&A answers (qna-display.css) */
.yayrev-store-replies {
  --yayrev-reply-primary: #6366f1;
  --yayrev-reply-bg: #f0f0ff;
  --yayrev-reply-border: #e0e0ff;
  margin-top: 12px;
  margin-left: 14px;
  padding: 12px 0 0 24px;
}

.yayrev-store-reply {
  position: relative;
  padding: 14px;
  border: 1px solid var(--yayrev-reply-border);
  border-radius: 8px;
  background: var(--yayrev-reply-bg);
}

.yayrev-store-reply + .yayrev-store-reply {
  margin-top: 12px;
}

/* Curved branch from the line into the card, level with its store mark. */
.yayrev-store-reply::before {
  content: '';
  position: absolute;
  left: -25px;
  top: -13px;
  width: 24px;
  height: 41px;
  border-left: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  border-bottom-left-radius: 12px;
}

/* The line runs on past this card to the next one. */
.yayrev-store-reply:not(:last-child)::after {
  content: '';
  position: absolute;
  left: -25px;
  top: 0;
  bottom: -13px;
  border-left: 1px solid #e5e7eb;
}

/* Store mark, then name over date */
.yayrev-reply-person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.yayrev-reply-mark {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--yayrev-reply-primary);
  color: #fff;
}

.yayrev-reply-meta {
  min-width: 0;
}

.yayrev-reply-author {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}

.yayrev-reply-date {
  display: block;
  font-size: 11px;
  color: #6b7280;
}

/* Text lines up with the name, past the 28px mark + 10px gap. */
.yayrev-reply-text {
  margin-top: 10px;
  padding-left: 38px;
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
}

.yayrev-reply-text p {
  margin: 0;
}

.yayrev-reply-text p + p {
  margin-top: 8px;
}

@media (max-width: 480px) {
  .yayrev-store-reply {
    padding: 12px;
  }

  .yayrev-store-reply::before {
    height: 39px;
  }

  .yayrev-reply-text {
    padding-left: 0;
  }
}

/* Edited Badge */
.yayrev-edited-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 4px;
}

.yayrev-edited-badge svg {
  flex-shrink: 0;
}

/* Responsive Adjustments */
@media (max-width: 600px) {
  .yayrev-action-buttons {
    flex-wrap: wrap;
  }

  .yayrev-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .yayrev-form {
    padding: 12px;
  }

  .yayrev-form-actions {
    flex-direction: column;
  }

  .yayrev-form-actions .yayrev-btn {
    width: 100%;
    justify-content: center;
  }

  .yayrev-store-replies {
    padding-left: 12px;
  }

  .yayrev-rating-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
