/**
 * Review Modal — Styles
 * Uses theme CSS variables exclusively. Enqueued on front-page only.
 *
 * @package Sudin_JCREA
 */

/* ============================================================
   OVERLAY
   ============================================================ */
.review-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  z-index: 9999;
  display: none;              /* JS sets display:flex on open */
  align-items: center;
  justify-content: center;
  padding: 20px;

  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease, cubic-bezier(.4,0,.2,1));
}

.review-modal-overlay.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   MODAL BOX
   ============================================================ */
.review-modal {
  background: var(--dark-2, #1C1F28);
  border: 1px solid var(--border-dark, #2E3140);
  border-radius: var(--r-lg, 24px);
  width: min(580px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;

  /* Slide-up entrance */
  transform: translateY(28px) scale(.97);
  transition: transform 320ms var(--ease, cubic-bezier(.4,0,.2,1));
}

.review-modal-overlay.open .review-modal {
  transform: translateY(0) scale(1);
}

/* Custom scrollbar inside modal */
.review-modal::-webkit-scrollbar { width: 5px; }
.review-modal::-webkit-scrollbar-track { background: transparent; }
.review-modal::-webkit-scrollbar-thumb {
  background: var(--orange, #FF6B2B);
  border-radius: 99px;
}

/* ============================================================
   HEADER
   ============================================================ */
.review-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border-dark, #2E3140);
  position: sticky;
  top: 0;
  background: var(--dark-2, #1C1F28);
  z-index: 1;
}

.review-modal__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-modal__icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 107, 43, .12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.review-modal__title {
  font-family: var(--font-display, 'Playfair Display', serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white, #fff);
  margin: 0;
  line-height: 1.2;
}

.review-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border-dark, #2E3140);
  background: transparent;
  color: rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 200ms, color 200ms, background 200ms;
  cursor: pointer;
}

.review-modal__close:hover,
.review-modal__close:focus-visible {
  border-color: var(--orange, #FF6B2B);
  color: var(--orange, #FF6B2B);
  background: rgba(255, 107, 43, .08);
  outline: none;
}

/* ============================================================
   BODY
   ============================================================ */
.review-modal__body {
  padding: 28px 32px 36px;
}

/* ============================================================
   FORM FIELDS — shared base
   ============================================================ */
.review-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 22px;
}

.review-field:last-of-type { margin-bottom: 0; }

.review-field__label,
.review-star-picker__label {
  display: block;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: .85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .7);
  margin-bottom: 10px;
  letter-spacing: .01em;
}

.review-required {
  color: var(--orange, #FF6B2B);
  margin-left: 2px;
}

.review-optional {
  color: rgba(255, 255, 255, .35);
  font-weight: 400;
  font-size: .8rem;
  margin-left: 4px;
}

/* Inputs & Textarea */
.review-modal__form input[type="text"],
.review-modal__form input[type="email"],
.review-modal__form textarea {
  width: 100%;
  padding: 13px 16px;
  background: var(--dark-3, #252833);
  border: 1.5px solid var(--border-dark, #2E3140);
  border-radius: var(--r-md, 16px);
  color: var(--white, #fff);
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: .92rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 220ms;
  -webkit-appearance: none;
}

.review-modal__form input[type="text"]::placeholder,
.review-modal__form textarea::placeholder {
  color: rgba(255, 255, 255, .25);
}

.review-modal__form input[type="text"]:focus,
.review-modal__form textarea:focus {
  border-color: var(--orange, #FF6B2B);
  box-shadow: 0 0 0 3px rgba(255, 107, 43, .12);
}

.review-modal__form textarea {
  resize: vertical;
  min-height: 110px;
}

/* Two-column row */
.review-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}

/* ============================================================
   STAR PICKER
   ============================================================ */
.review-field--stars {
  margin-bottom: 22px;
}

.review-stars-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.review-star-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: rgba(255, 255, 255, .2);
  line-height: 1;
  transition: color 150ms, transform 150ms;
  border-radius: 6px;
}

.review-star-btn:hover,
.review-star-btn.hovered,
.review-star-btn.active {
  color: var(--orange, #FF6B2B);
  transform: scale(1.15);
}

.review-star-btn:focus-visible {
  outline: 2px solid var(--orange, #FF6B2B);
  outline-offset: 2px;
}

/* ============================================================
   PHOTO UPLOAD
   ============================================================ */
.review-photo-field {
  position: relative;
}

/* Placeholder / drop zone */
.review-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  border: 1.5px dashed var(--border-dark, #2E3140);
  border-radius: var(--r-md, 16px);
  color: rgba(255, 255, 255, .4);
  cursor: pointer;
  transition: border-color 220ms, background 220ms;
  text-align: center;
}

.review-photo-placeholder:hover,
.review-photo-placeholder:focus-visible {
  border-color: var(--orange, #FF6B2B);
  background: rgba(255, 107, 43, .05);
  color: rgba(255, 255, 255, .7);
  outline: none;
}

.review-photo-placeholder__text {
  font-size: .88rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .6);
}

.review-photo-placeholder__hint {
  font-size: .76rem;
  color: rgba(255, 255, 255, .3);
  font-family: var(--font-sub, 'DM Sans', sans-serif);
}

/* Preview circle */
.review-photo-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--dark-3, #252833);
  border: 1.5px solid var(--border-dark, #2E3140);
  border-radius: var(--r-md, 16px);
  position: relative;
}

.review-photo-preview img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--orange, #FF6B2B);
  flex-shrink: 0;
}

.review-photo-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(220, 38, 38, .85);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 200ms;
}

.review-photo-remove:hover { background: #dc2626; }

/* ============================================================
   FIELD ERRORS
   ============================================================ */
.review-field-error {
  display: block;
  margin-top: 6px;
  font-size: .8rem;
  color: #F87171;
  min-height: 1rem;
  font-family: var(--font-sub, 'DM Sans', sans-serif);
  line-height: 1.4;
}

.review-field-error:empty { display: none; }

/* ============================================================
   SUBMIT BUTTON
   ============================================================ */
.review-modal__submit {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  font-size: .95rem;
  padding: 14px 24px;
  gap: 8px;
}

.review-modal__submit:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none !important;
}

/* Global error (below submit) */
.review-submit-error {
  margin-top: 12px;
  font-size: .85rem;
  color: #F87171;
  text-align: center;
  font-family: var(--font-sub, 'DM Sans', sans-serif);
  line-height: 1.5;
  min-height: 0;
}

.review-submit-error:empty { display: none; }

/* ============================================================
   HONEYPOT — visually hidden from real users
   ============================================================ */
.review-honeypot {
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   SUCCESS STATE
   ============================================================ */
.review-modal__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px 32px;
  gap: 16px;
  animation: review-fade-in 400ms var(--ease, cubic-bezier(.4,0,.2,1)) both;
}

@keyframes review-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.review-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 107, 43, .12);
  border: 2px solid var(--orange, #FF6B2B);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange, #FF6B2B);
  flex-shrink: 0;
}

.review-success__title {
  font-family: var(--font-display, 'Playfair Display', serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white, #fff);
  margin: 0;
}

.review-success__msg {
  font-size: .92rem;
  color: rgba(255, 255, 255, .6);
  line-height: 1.7;
  max-width: 340px;
  margin: 0;
  font-family: var(--font-sub, 'DM Sans', sans-serif);
}

/* ============================================================
   LEAVE A REVIEW TRIGGER BUTTON
   Placed inside .testimonials-nav inside the dark section
   ============================================================ */
.leave-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: .82rem;
  padding: 9px 18px;
  border: 1.5px solid rgba(255, 255, 255, .3);
  color: rgba(255, 255, 255, .85);
  background: transparent;
  border-radius: var(--r-full, 9999px);
  transition: border-color 220ms, color 220ms, background 220ms;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: .01em;
}

.leave-review-btn svg { flex-shrink: 0; }

.leave-review-btn:hover,
.leave-review-btn:focus-visible {
  border-color: var(--orange, #FF6B2B);
  color: var(--orange, #FF6B2B);
  background: rgba(255, 107, 43, .08);
  outline: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .review-modal__header { padding: 20px 20px 16px; }
  .review-modal__body   { padding: 20px 20px 28px; }

  .review-modal__title  { font-size: 1.1rem; }

  .review-fields-row    { grid-template-columns: 1fr; gap: 0; }

  .review-star-btn svg  { width: 26px; height: 26px; }
  .review-stars-wrap    { gap: 4px; }

  .leave-review-btn     { font-size: .78rem; padding: 8px 14px; }
  .leave-review-btn span { display: none; } /* hide text, show icon only on very small screens */
}

@media (max-width: 380px) {
  .review-modal { border-radius: var(--r-md, 16px); }
}
