/**
 * Reviews & Points System - Styles
 * Product reviews, rating display, and point redemption UI
 */

/* ===================================
   PRODUCT REVIEWS
   =================================== */

.product-tabs {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  margin: 24px 0 16px;
  gap: 8px;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  top: 2px;
}

.tab-btn:hover {
  color: #111827;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.tab-content {
  padding: 20px 0;
}

/* Review Statistics */
.review-stats {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 24px;
  background: #f9fafb;
  border-radius: 12px;
  margin-bottom: 24px;
}

.rating-summary {
  text-align: center;
}

.avg-rating {
  display: block;
  font-size: 48px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.rating-summary .stars {
  font-size: 24px;
  color: #fbbf24;
  margin: 8px 0;
}

.total-reviews {
  display: block;
  font-size: 14px;
  color: #6b7280;
  margin-top: 4px;
}

.rating-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rating-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rating-label {
  font-size: 14px;
  color: #374151;
  width: 32px;
  text-align: right;
}

.bar-container {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
  transition: width 0.3s ease;
}

.rating-count {
  font-size: 14px;
  color: #6b7280;
  width: 40px;
  text-align: right;
}

/* Review Filters */
.review-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.review-sort {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.write-review-btn {
  padding: 10px 20px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.write-review-btn:hover {
  background: #1d4ed8;
}

/* Review List */
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-item {
  padding: 20px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  transition: box-shadow 0.2s;
}

.review-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.review-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-author strong {
  font-size: 15px;
  color: #111827;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #059669;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.anonymous-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  cursor: help;
}

.review-rating .stars {
  font-size: 16px;
  color: #fbbf24;
}

.review-date {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 12px;
}

.review-text {
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
  margin-bottom: 12px;
}

.review-images {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.review-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.review-img:hover {
  transform: scale(1.05);
}

.review-actions {
  display: flex;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.btn-helpful {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-helpful:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #d1d5db;
}

.btn-helpful.voted {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.helpful-icon {
  font-size: 14px;
}

.no-reviews {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
  font-size: 15px;
}

.load-more-btn {
  display: block;
  margin: 24px auto 0;
  padding: 12px 32px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.load-more-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* ===================================
   POINT BALANCE WIDGET
   =================================== */

.point-balance-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.point-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.point-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.point-header .balance {
  font-size: 32px;
  font-weight: 700;
}

.point-value {
  font-size: 14px;
  opacity: 0.9;
  margin: 8px 0 16px;
}

.point-stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 16px;
}

.btn-view-history {
  display: inline-block;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-view-history:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===================================
   CHECKOUT POINT REDEMPTION
   =================================== */

.checkout-points {
  padding: 16px;
  background: #fef3c7;
  border: 2px solid #fbbf24;
  border-radius: 12px;
  margin-bottom: 16px;
}

.points-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.points-header input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.points-header label {
  font-size: 15px;
  color: #78350f;
  cursor: pointer;
  margin: 0;
}

#points-slider {
  padding: 16px;
  background: white;
  border-radius: 8px;
  margin-top: 12px;
}

#points-slider label {
  display: block;
  font-size: 14px;
  color: #374151;
  margin-bottom: 8px;
  font-weight: 500;
}

#points-amount {
  width: 100%;
  margin-bottom: 8px;
}

#points-display {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #111827;
  margin-top: 8px;
}

#points-display .discount-amount {
  color: #059669;
  font-weight: 600;
}

.price-row.point-discount {
  color: #059669;
  font-weight: 500;
}

/* ===================================
   REVIEWABLE ORDERS
   =================================== */

.reviewable-orders {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.reviewable-orders h3 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #111827;
}

.order-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.order-card:last-child {
  margin-bottom: 0;
}

.order-card img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.order-info {
  flex: 1;
}

.order-info h4 {
  font-size: 15px;
  margin: 0 0 4px;
  color: #111827;
}

.order-info p {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 12px;
}

.btn-review {
  padding: 8px 16px;
  background: #059669;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-review:hover {
  background: #047857;
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */

.review-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: #111827;
  color: white;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10000;
  max-width: 400px;
  word-wrap: break-word;
}

.review-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Mobile: Position above bottom-nav */
@media (max-width: 768px) {
  .review-toast {
    bottom: 80px; /* Above bottom-nav (50px height + padding + safe margin) */
    right: 16px;
    left: 16px;
    max-width: calc(100% - 32px);
  }
}

.review-toast.toast-success {
  background: #059669;
}

.review-toast.toast-error {
  background: #dc2626;
}

.review-toast.toast-info {
  background: #2563eb;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 768px) {
  .review-stats {
    grid-template-columns: 120px 1fr;
    gap: 16px;
    padding: 16px;
  }

  .rating-summary {
    text-align: center;
  }
  
  .rating-summary .avg-rating {
    font-size: 36px;
  }
  
  .rating-summary .stars {
    font-size: 20px;
    margin: 4px 0;
  }
  
  .total-reviews {
    font-size: 12px;
  }
  
  /* Rating breakdown - more compact */
  .rating-breakdown {
    gap: 6px;
  }
  
  .rating-bar {
    gap: 6px;
  }
  
  .rating-label {
    font-size: 12px;
    width: 24px;
    text-align: left;
  }
  
  .bar-container {
    height: 6px;
  }
  
  .rating-count {
    font-size: 12px;
    width: 24px;
  }
  
  .review-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  
  .review-rating {
    order: -1;
    margin-bottom: 4px;
  }
  
  .review-rating .stars {
    font-size: 14px;
  }

  .review-filters {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .review-sort {
    width: 100%;
  }

  .point-header .balance {
    font-size: 24px;
  }

  .point-stats {
    flex-direction: column;
    gap: 8px;
  }

  .order-card {
    flex-direction: column;
  }

  .order-card img {
    width: 100%;
    height: 200px;
  }
}

/* ===================================
   LOADING & ERROR STATES
   =================================== */

.loading {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  font-size: 14px;
}

.error {
  text-align: center;
  padding: 40px;
  color: #dc2626;
  font-size: 14px;
  background: #fee2e2;
  border-radius: 8px;
}

.empty {
  text-align: center;
  padding: 10px;
  color: #6b7280;
  font-size: 14px;
}

/* ===================================
   REVIEWABLE ORDERS LIST
   =================================== */

.reviewable-orders-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reviewable-order-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  align-items: center;
  transition: box-shadow 0.2s;
}

.reviewable-order-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.reviewable-order-item .roi-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.reviewable-order-item .roi-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reviewable-order-item .roi-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}

.reviewable-order-item .roi-meta {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.reviewable-order-item .btn-write-review {
  white-space: nowrap;
  padding: 10px 20px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .reviewable-order-item {
    grid-template-columns: 60px 1fr;
    gap: 12px;
  }
  
  .reviewable-order-item .roi-image {
    width: 60px;
    height: 60px;
  }
  
  .reviewable-order-item .btn-write-review {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* ===================================
   REVIEW SUBMISSION MODAL
   =================================== */

/* Modal Overlay Background */
#review-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999 !important;
  padding: 20px;
}

.review-modal {
  max-width: 600px !important;
  width: 90% !important;
  background: white;
  border-radius: 16px !important;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

#review-modal-overlay .modal-content,
.review-modal .modal-content {
  padding: 0 !important;
  flex: initial !important;
  overflow-y: visible !important;
}

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

.review-modal .modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.review-modal .modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #6b7280;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-modal .modal-close:hover {
  color: #111827;
}

.review-modal .modal-body {
  padding: 24px;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

/* Custom Scrollbar for Modal */
.review-modal .modal-body::-webkit-scrollbar {
  width: 8px;
}

.review-modal .modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.review-modal .modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 4px;
}

.review-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
}

/* Firefox Scrollbar */
.review-modal .modal-body {
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 #f1f5f9;
}

.review-modal .modal-footer {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
}

.review-product-info {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 24px;
}

.review-product-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.review-product-details h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.review-product-details p {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

/* Star Rating Input */
.star-rating-input {
  display: inline-flex;
  gap: 8px;
  margin-right: 12px;
  vertical-align: middle;
}

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

.star-btn:hover,
.star-btn.active {
  color: #fbbf24;
  transform: scale(1.1);
}

.rating-label {
  display: inline-block;
  font-size: 15px;
  color: #6b7280;
  margin: 0;
  vertical-align: middle;
  min-width: 150px;
}

/* Form Elements */
.review-form .form-group {
  margin-bottom: 20px;
}

.review-form .form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.review-form .form-control {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.review-form .form-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.review-form .form-hint {
  font-size: 13px;
  color: #6b7280;
  margin-top: 8px;
}

/* Image Upload */
.btn-upload-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f9fafb;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  color: #374151;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-upload-trigger:hover {
  background: #f3f4f6;
  border-color: #2563eb;
  color: #2563eb;
}

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

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

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

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

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

/* Point Reward Info */
.point-reward-info {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #fbbf24;
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
}

.pri-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 12px;
}

.pri-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
}

.pri-list li {
  padding: 6px 0;
  font-size: 14px;
  color: #78350f;
  transition: opacity 0.2s;
}

.pri-total {
  padding-top: 12px;
  border-top: 2px solid rgba(251, 191, 36, 0.3);
  font-size: 16px;
  color: #92400e;
  font-weight: 600;
}

.form-error {
  background: #fee2e2;
  border: 1px solid #f87171;
  color: #991b1b;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 16px;
}

/* Buttons */
.review-form .btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.review-form .btn-primary {
  background: #2563eb;
  color: white;
}

.review-form .btn-primary:hover {
  background: #1d4ed8;
}

.review-form .btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.review-form .btn-secondary {
  background: #f1f5f9;
  color: #64748b;
}

.review-form .btn-secondary:hover {
  background: #e2e8f0;
  color: #475569;
}

/* ===================================
   POINT SUMMARY GRID (Profile Page)
   =================================== */

.point-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.point-summary-card {
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}

.point-summary-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.point-summary-card .psc-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.point-summary-card .psc-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.point-summary-card .psc-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
}

/* Point History Section */
.point-history-section {
  margin-top: 32px;
}

.point-history-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 16px;
}

.point-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.point-history-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 16px;
  padding: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  align-items: center;
  transition: all 0.2s;
}

.point-history-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.point-history-item.credit {
  border-left: 3px solid #10b981;
}

.point-history-item.debit {
  border-left: 3px solid #f59e0b;
}

.point-history-item .phi-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 50%;
  background: #f9fafb;
}

.point-history-item.credit .phi-icon {
  background: #d1fae5;
}

.point-history-item.debit .phi-icon {
  background: #fef3c7;
}

.point-history-item .phi-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.point-history-item .phi-desc {
  font-size: 15px;
  font-weight: 500;
  color: #111827;
}

.point-history-item .phi-date {
  font-size: 13px;
  color: #9ca3af;
}

.point-history-item .phi-amount {
  font-size: 18px;
  font-weight: 700;
}

.point-history-item .phi-amount.credit {
  color: #10b981;
}

.point-history-item .phi-amount.debit {
  color: #f59e0b;
}

@media (max-width: 640px) {
  .point-summary-grid {
    grid-template-columns: 1fr;
  }
  
  .point-history-item {
    grid-template-columns: 36px 1fr;
    gap: 12px;
  }
  
  .point-history-item .phi-amount {
    grid-column: 2;
    text-align: right;
    margin-top: 8px;
  }
}
