/* ============================================================
   CUSTOMER REVIEWS ENGINE STYLESHEET
   marketplace-style two-column layout:
   Left: rating histogram + "Review this product" CTA
   Right: "Customers say" AI summary + keyword tags + photo gallery
   Below: full reviews list
   ============================================================ */

.cre-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* ── TWO-COLUMN TOP GRID ── */
.cre-top-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f1f5f9;
}

@media (max-width: 640px) {
  .cre-top-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ── LEFT COLUMN: Rating Summary ── */
.cre-summary-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cre-section-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f1111;
  margin: 0 0 4px 0;
}

.cre-rating-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cre-stars-row {
  display: inline-flex;
  gap: 1px;
}

.cre-star {
  font-size: 18px;
  color: #ddd;
  line-height: 1;
}
.cre-star.filled { color: #ffa41c; }
.cre-star.half {
  color: #ffa41c;
  position: relative;
}
.cre-star.half::after {
  content: "★";
  position: absolute;
  left: 0;
  color: #ddd;
  width: 50%;
  overflow: hidden;
}

.cre-rating-text {
  font-size: 14px;
  font-weight: 700;
  color: #0f1111;
}

.cre-total-count {
  font-size: 14px;
  color: #565959;
  margin-bottom: 8px;
}

/* ── Histogram ── */
.cre-histogram {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.cre-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.cre-bar-lbl {
  width: 48px;
  font-weight: 600;
  color: #565959;
  text-align: right;
  flex-shrink: 0;
}

.cre-bar-track {
  flex: 1;
  height: 18px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
}

.cre-bar-fill {
  height: 100%;
  background: #ffa41c;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.cre-bar-pct {
  width: 36px;
  color: #565959;
  font-size: 11px;
  text-align: right;
  flex-shrink: 0;
}

/* ── "How customer reviews and ratings work" ── */
.cre-how-it-works {
  margin: 4px 0 8px 0;
}

.cre-how-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: #007185;
  cursor: pointer;
  font-weight: 500;
}

.cre-how-toggle:hover {
  text-decoration: underline;
  color: #c45500;
}

.cre-how-text {
  margin-top: 8px;
  font-size: 12.5px;
  color: #565959;
  line-height: 1.5;
  background: #f7f8f8;
  border-radius: 8px;
  padding: 10px 12px;
}

/* ── "Review this product" CTA ── */
.cre-review-cta {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.cre-review-cta h4 {
  font-size: 15px;
  font-weight: 800;
  color: #0f1111;
  margin: 0 0 4px 0;
}

.cre-review-cta p {
  font-size: 13px;
  color: #565959;
  margin: 0 0 10px 0;
}

.cre-write-btn {
  display: inline-block;
  background: #f7f7f7;
  border: 1px solid #adb1b8;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #0f1111;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cre-write-btn:hover {
  background: #f0f0f0;
  border-color: #888;
}

/* ── RIGHT COLUMN: "Customers say" ── */
.cre-summary-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cre-customers-say-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f1111;
  margin: 0;
}

.cre-ai-summary {
  font-size: 14px;
  color: #0f1111;
  line-height: 1.6;
  margin: 0;
}

.cre-ai-summary::after {
  content: "AI-generated from the text of customer reviews";
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #565959;
}

/* ── Keyword Tags ── */
.cre-tags-section {
  margin-top: 4px;
}

.cre-tags-header {
  font-size: 13px;
  font-weight: 600;
  color: #565959;
  margin: 0 0 8px 0;
}

.cre-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cre-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0f2f2;
  border: 1px solid #d5d9d9;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f1111;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cre-tag-chip:hover {
  background: #e6e8e8;
  border-color: #b0b5b5;
}

.cre-tag-icon {
  color: #007185;
  flex-shrink: 0;
}

/* ── "Reviews with images" gallery ── */
.cre-media-section {
  margin-top: 8px;
}

.cre-media-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cre-media-header h4 {
  font-size: 16px;
  font-weight: 800;
  color: #0f1111;
  margin: 0;
}

.cre-see-all {
  font-size: 13px;
  color: #007185;
  cursor: pointer;
  text-decoration: none;
}

.cre-see-all:hover {
  text-decoration: underline;
  color: #c45500;
}

.cre-photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cre-photo-thumb {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d5d9d9;
  cursor: pointer;
  background: #f7f7f7;
}

.cre-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.cre-photo-thumb:hover img {
  transform: scale(1.06);
}

/* ── Reviews List (below the two-column section) ── */
.cre-reviews-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cre-review-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cre-review-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.cre-author-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cre-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.cre-author-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f1111;
}

.cre-verified-badge {
  display: inline-block;
  font-size: 11px;
  color: #16a34a;
  background: #dcfce7;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: 6px;
}

.cre-stars {
  color: #ffa41c;
  font-size: 14px;
}

.cre-review-content p {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.5;
  margin: 4px 0 0 0;
}

.cre-review-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f1111;
}

/* Photo Gallery in Reviews */
.cre-photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.cre-review-card .cre-photo-gallery .cre-photo-thumb {
  width: 80px;
  height: 80px;
}

.cre-badge-fast {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  background: rgba(15, 23, 42, 0.85);
  color: #38bdf8;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
}

.cre-review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.cre-date {
  font-size: 12px;
  color: #94a3b8;
}

.cre-helpful-btn {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.cre-helpful-btn:hover {
  background: #f1f5f9;
}

.cre-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
  font-size: 14px;
}

.cre-empty-state p {
  margin-bottom: 12px;
}

/* Write Review Modal */
.cre-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cre-modal-box {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.cre-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cre-modal-header h4 {
  font-size: 16px;
  font-weight: 800;
  color: #0f1111;
  margin: 0;
}

.cre-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
}

.cre-modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cre-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cre-form-group label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.cre-form-group input,
.cre-form-group textarea {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  color: #0f172a;
  background: #f8fafc;
}

.cre-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cre-star-picker {
  display: flex;
  gap: 6px;
  font-size: 28px;
  cursor: pointer;
  color: #cbd5e1;
}

.cre-star-picker span.active {
  color: #ffa41c;
}

.cre-dropzone {
  border: 2px dashed #3b82f6;
  background: #eff6ff;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
}

.cre-dz-icon {
  font-size: 24px;
}

.cre-dropzone-inner p {
  font-size: 13px;
  color: #1e3a8a;
  margin: 4px 0 0 0;
}

.cre-dropzone-inner small {
  font-size: 11px;
  color: #64748b;
}

.cre-photos-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.cre-preview-card {
  position: relative;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cre-preview-card img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.cre-preview-stats {
  padding: 4px;
  background: #0f172a;
  color: #ffffff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.cre-comp-sz { color: #38bdf8; font-weight: 700; }
.cre-ratio-tag { color: #4ade80; font-weight: 700; }

.cre-remove-photo {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.cre-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* Lightbox Modal */
.cre-lightbox-box {
  position: relative;
  background: #0f172a;
  border-radius: 16px;
  max-width: 800px;
  width: 90%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cre-lb-img-wrap {
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.cre-lb-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cre-lb-toolbar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  color: #fff;
}

.cre-lb-badge {
  font-size: 12px;
  color: #38bdf8;
  font-weight: 600;
}

/* ── Dark mode ── */
.dark .cre-wrapper {
  background: #1e1e2f;
  border-color: #2d2d44;
}
.dark .cre-section-title,
.dark .cre-customers-say-title,
.dark .cre-review-cta h4,
.dark .cre-review-title,
.dark .cre-author-name {
  color: #f1f5f9;
}
.dark .cre-rating-text {
  color: #f1f5f9;
}
.dark .cre-total-count,
.dark .cre-bar-lbl,
.dark .cre-bar-pct,
.dark .cre-tags-header,
.dark .cre-review-cta p {
  color: #94a3b8;
}
.dark .cre-bar-track {
  background: #2d2d44;
}
.dark .cre-review-card {
  background: #1e1e2f;
  border-color: #2d2d44;
}
.dark .cre-review-content p {
  color: #cbd5e0;
}
.dark .cre-tag-chip {
  background: #2d2d44;
  border-color: #3d3d55;
  color: #f1f5f9;
}
.dark .cre-write-btn {
  background: #2d2d44;
  border-color: #4a4a66;
  color: #f1f5f9;
}
.dark .cre-ai-summary {
  color: #cbd5e0;
}
.dark .cre-ai-summary::after {
  color: #64748b;
}
.dark .cre-how-text {
  background: #2d2d44;
  color: #94a3b8;
}
.dark .cre-how-toggle {
  color: #38bdf8;
}
