/* ===== ShopiPersia Review System - consolidated CSS =====
   This file was created by moving inline <style> blocks from the plugin
   into an external stylesheet. Enqueued via wp_enqueue_style in the plugin.
*/

/* Popup (review form) */
#review_popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  z-index: 100000;
}
.review-popup-inner {
  background: #fff;
  border-radius: 12px;
  width: 95%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: sp-fadeIn .25s ease;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  box-sizing: border-box;
}
@keyframes sp-fadeIn { from {opacity:0; transform:scale(0.95);} to {opacity:1; transform:scale(1);} }

.close-popup {
  position: absolute;
  right: 18px;
  top: 14px;
  font-size: 28px;
  cursor: pointer;
  color: #555;
  background: none;
  border: none;
  z-index: 5;
}

.review-header {
  text-align: center;
  padding: 15px;
  border-bottom: 1px solid #eee;
}
.review-header img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 10px;
}
.review-header h2 {
  font-size: 18px;
  margin: 5px 0;
}

.star-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 38px;
  cursor: pointer;
  color: #ddd;
  user-select: none;
}
.star.hovered, .star.selected { color: #f0ad4e; }

.popup-form {
  padding: 15px 20px 0;
}
.popup-form textarea {
  width: 100%;
  min-height: 110px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ddd;
  resize: vertical;
  font-size: 14px;
  box-sizing: border-box;
}
.upload-label {
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
}

.upload-boxes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.upload-box {
  position: relative;
  width: 100%;
  padding-top: 100%; /* حفظ نسبت 1:1 */
  border: 2px dashed #ccc;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  background-color: #f9f9f9;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: border-color .2s, color .2s, background .3s;
  box-sizing: border-box;
}
.upload-box:hover { border-color: #999; }

.upload-box span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  color: #aaa;
}
.upload-box.has-image span {
  display: none !important;
}
.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-note {
  font-size: 13px;
  color: #666;
  margin-top: 5px;
}

/* دکمه ارسال */
#popup_commentform .form-submit input[type="submit"] {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  background: #0073aa;
  color: #fff;
  font-weight: 600;
  margin-top: 15px;
  cursor: pointer;
  transition: background .25s;
  box-sizing: border-box;
}
#popup_commentform .form-submit input[type="submit"]:hover {
  background: #005d88;
}

#popup_commentform .form-submit {
  margin-bottom: 0;
}

#popup-form-message {
  display: none;
  color: #b00;
  margin-top: 8px;
}

/* REMOVE button: much smaller and positioned top-right */
.upload-box .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  z-index: 4;
  padding: 0;
}
.upload-box.has-image .remove-btn { display: flex; }

/* Main reviews layout */
.shopipersia-review-container { display:flex; flex-wrap:wrap; gap:20px; }
.shopipersia-review-summary { flex:0 0 30%; background:#fafafa; padding:20px; border-radius:10px; border:1px solid #ddd; height:fit-content; position:sticky; top:100px; box-shadow:0 2px 8px rgba(0,0,0,0.1); box-sizing:border-box; }
.shopipersia-rating { display:flex; align-items:center; gap:10px;}
.shopipersia-rating strong { font-size:1.1em; color:#333; font-weight:600; }
.shopipersia-rating-table { width:100%; margin:15px 0; }
.shopipersia-rating-table td { padding:5px 0; font-size:0.9em; }
.shopipersia-rating-table .bar { background:#eee; height:8px; width:70%; border-radius:3px; display:inline-block; margin-right:5px; vertical-align:middle; }
.shopipersia-rating-table .fill { background:#f0ad4e; height:8px; border-radius:3px; }
.review-info { color:#666; font-size:0.85em; margin-top:10px; }
.review-call { font-size:1.4em; font-weight:bold; margin-top:15px; margin-bottom:0; }
.review-subtitle { font-size:0.9em; color:#555; margin-top:0; margin-bottom:10px; }
.review-button { background-color:#e15500; border:none; color:#fff; padding:10px 20px; border-radius:6px; cursor:pointer; display:block; margin-top:10px; transition:background 0.3s ease; }
.shopipersia-review-list { flex:1; }
.average-rating-row { display:flex; align-items:center; gap:10px; margin-bottom:20px; font-size:1.2em; color:black; }
.single-review { border-bottom:1px solid #eee; padding:15px 0; display:flex; gap:15px; }
.lazy-avatar, .single-review .avatar { width:60px; height:60px; border-radius:50%; flex:0 0 60px; background:#eee; background-size:cover; background-position:center; } 
.single-review .avatar img { width:60px; height:60px; border-radius:50%; object-fit:cover; }
.single-review .content { flex:1; }
.single-review .author { color: black; }
.single-review .role { font-size:1em; color:#FF6200; margin-bottom:5px; font-weight: bold; }
.single-review .review-stars { font-size:1.6em; margin-bottom:5px; display: flex; }

/* گالری و تصاویر (anchor با background image به جای img) */
.shopipersia-review-gallery { margin:20px 0; display:flex; flex-wrap:wrap; gap:10px; border-bottom:1px solid #eee; padding-bottom:10px; }
.shopipersia-review-gallery .lazy-review-bg { display:block; width:80px; height:80px; background-size:cover; background-position:center; background-repeat:no-repeat; border-radius:6px; border:1px solid #ddd; text-decoration:none; }
.shopipersia-review-gallery .lazy-review-bg:hover { transform: scale(1.05); transition: all 0.2s ease; }

.single-review-images { margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }
.single-review-images .lazy-review-bg { width:64px; height:64px; display:block; border-radius:6px; border:1px solid #ddd; background-size: contain !important;}

/* Placeholder قبل از لود تصویر */
.lazy-review-bg { background-color: #eee; min-width:40px; min-height:40px; max-width: 80px; max-height: 80px; aspect-ratio: 1 / 1;}

@media (max-width:991px){ 
  .shopipersia-review-summary { flex:100%; position:static; height:auto; } 
  .author-role {display: grid !important;} 
  .role {font-size: 1em !important;} 
  .sh-product-section {padding-left:0 !important; padding-right:0 !important;} 
}
@media (max-width: 767px) {
  .shopipersia-review-gallery {
      display: flex;
      flex-wrap: nowrap;             
      overflow-x: auto;              
      -webkit-overflow-scrolling: touch;
      gap: 10px;
      padding: 0 16px 10px;
      scroll-snap-type: x mandatory;
      box-sizing: border-box;
  }

  .shopipersia-review-gallery .lazy-review-bg {
      flex: 0 0 calc((100vw - 32px - 30px) / 4); /* 4 items per viewport */
      max-width: calc((100vw - 32px - 30px) / 4);
      height: auto;
      aspect-ratio: 1 / 1;
      scroll-snap-align: center;
      box-sizing: border-box;
  }

  .shopipersia-review-gallery::-webkit-scrollbar {
      display: none;
  }

  .shopipersia-review-list-titles {
     padding-top: 20px;
  }
}

/* modal inner responsive */
#sp_login_modal .sp-modal-inner {
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 16px;
}

/* inputs & submit full-width */
#sp_login_modal input[type="text"],
#sp_login_modal input[type="password"],
#sp_login_modal button[type="submit"] {
  box-sizing: border-box;
  width: 100%;
}

/* small tweak for very small screens */
@media (max-width: 420px) {
  #sp_login_modal .sp-modal-inner { padding: 12px; width: calc(100% - 24px); }
}

/* lighbox */
#sp-lightbox-overlay { position:fixed; inset:0; background:rgb(177 177 177 / 0%); display:none; align-items:center; justify-content:center; z-index:100000; }
#sp-lightbox-overlay img { max-width:80%; max-height:700px; display:block; border-radius:8px; margin: auto;}