/* ============================================
   SELLER RATINGS & REVIEWS STYLES
   ============================================ */

/* --- Star Rating Display --- */
.star-rating {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.star {
  color: var(--neutral-300, #d1d5db);
  transition: color 0.2s ease;
  width: 1em;
  height: 1em;
}

.star.full {
  color: #fbbf24;
}

.star.half {
  background: linear-gradient(90deg, #fbbf24 50%, var(--neutral-300, #d1d5db) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.star.empty {
  color: var(--neutral-300, #d1d5db);
}

/* Star SVG styling */
.star svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Star Rating Input --- */
.star-input-container {
  display: inline-flex;
  gap: 4px;
  font-size: 24px;
  cursor: pointer;
  user-select: none;
}

.star-input {
  color: var(--neutral-300, #d1d5db);
  transition: all 0.15s ease;
  cursor: pointer;
}

.star-input:hover,
.star-input.hover {
  color: #f59e0b;
  transform: scale(1.1);
}

.star-input.active {
  color: #fbbf24;
}

/* --- Rating Summary --- */
.rating-summary {
  display: flex;
  gap: var(--space-2xl, 24px);
  padding: var(--space-xl, 20px);
  background-color: var(--bg-primary, #ffffff);
  border-radius: var(--radius-xl, 12px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
  margin-bottom: var(--space-lg, 16px);
}

@media (max-width: 768px) {
  .rating-summary {
    flex-direction: column;
    gap: var(--space-lg, 16px);
  }
}

.rating-average {
  text-align: center;
  min-width: 140px;
}

.rating-average-number {
  font-size: 48px;
  font-weight: 700;
  color: var(--neutral-900, #111827);
  line-height: 1;
  margin-bottom: 8px;
}

.rating-average-stars {
  margin-bottom: 8px;
}

.rating-average-count {
  font-size: 14px;
  color: var(--neutral-500, #6b7280);
}

.rating-breakdown {
  flex: 1;
}

.rating-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 8px);
  margin-bottom: 6px;
}

.rating-bar-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--neutral-700, #374151);
  min-width: 60px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rating-bar {
  flex: 1;
  height: 8px;
  background-color: var(--neutral-200, #e5e7eb);
  border-radius: 4px;
  overflow: hidden;
}

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

.rating-bar-count {
  font-size: 13px;
  color: var(--neutral-500, #6b7280);
  min-width: 30px;
  text-align: right;
}

/* --- Review Card --- */
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg, 16px);
}

.review-card {
  background-color: var(--bg-primary, #ffffff);
  border-radius: var(--radius-xl, 12px);
  padding: var(--space-xl, 20px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
  transition: box-shadow 0.2s ease;
}

.review-card:hover {
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.review-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md, 12px);
  margin-bottom: var(--space-md, 12px);
}

.review-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background-color: var(--primary-light, #e0e7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary, #0046be);
}

.review-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-info {
  flex: 1;
}

.review-author {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 8px);
  margin-bottom: 4px;
}

.review-author-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--neutral-900, #111827);
}

.review-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background-color: #10b981;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
}

.review-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md, 12px);
  font-size: 13px;
  color: var(--neutral-500, #6b7280);
}

.review-stars {
  margin-bottom: var(--space-sm, 8px);
}

.review-product {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 6px);
  margin-top: 4px;
  font-size: 13px;
  color: var(--neutral-600, #4b5563);
}

.review-product img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

.review-comment {
  font-size: 14px;
  line-height: 1.6;
  color: var(--neutral-700, #374151);
  margin-bottom: var(--space-md, 12px);
}

/* Detailed ratings */
.review-detailed-ratings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-sm, 8px);
  margin-bottom: var(--space-md, 12px);
  padding: var(--space-md, 12px);
  background-color: var(--bg-secondary, #f9fafb);
  border-radius: var(--radius-lg, 8px);
}

.review-detailed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.review-detailed-label {
  color: var(--neutral-600, #4b5563);
}

.review-detailed-value {
  font-weight: 600;
  color: var(--neutral-900, #111827);
}

/* Review actions */
.review-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md, 12px);
  padding-top: var(--space-md, 12px);
  border-top: 1px solid var(--neutral-200, rgba(0, 0, 0, 0.06));
}

.review-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--neutral-500, #6b7280);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md, 6px);
  transition: all 0.2s ease;
}

.review-action-btn:hover {
  background-color: var(--bg-secondary, #f9fafb);
  color: var(--neutral-700, #374151);
}

.review-action-btn.active {
  color: var(--primary, #0046be);
  background-color: var(--primary-light, rgba(0, 70, 190, 0.08));
}

/* Seller response */
.review-seller-response {
  margin-top: var(--space-md, 12px);
  padding: var(--space-md, 12px);
  background-color: var(--bg-secondary, #f9fafb);
  border-left: 3px solid var(--primary, #0046be);
  border-radius: 0 var(--radius-md, 8px) var(--radius-md, 8px) 0;
}

.review-seller-response-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 8px);
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--neutral-700, #374151);
}

.review-seller-response-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--primary-light, #e0e7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary, #0046be);
}

.review-seller-response-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--neutral-700, #374151);
}

.review-seller-response-date {
  font-size: 12px;
  color: var(--neutral-400, #9ca3af);
  margin-top: 4px;
}

/* --- Review Form Modal --- */
.review-form-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg, 16px);
}

.review-form-modal {
  background-color: var(--bg-primary, #ffffff);
  border-radius: var(--radius-xl, 12px);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
}

.review-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl, 20px);
  border-bottom: 1px solid var(--neutral-200, rgba(0, 0, 0, 0.06));
}

.review-form-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--neutral-900, #111827);
  margin: 0;
}

.review-form-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--neutral-500, #6b7280);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-md, 6px);
  transition: all 0.2s ease;
}

.review-form-close:hover {
  background-color: var(--bg-secondary, #f9fafb);
  color: var(--neutral-900, #111827);
}

.review-form-body {
  padding: var(--space-xl, 20px);
}

.review-form-section {
  margin-bottom: var(--space-lg, 16px);
}

.review-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--neutral-700, #374151);
  margin-bottom: var(--space-sm, 8px);
}

.review-form-stars {
  display: flex;
  justify-content: center;
  padding: var(--space-md, 12px);
  background-color: var(--bg-secondary, #f9fafb);
  border-radius: var(--radius-lg, 8px);
}

.review-form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--neutral-300, rgba(0, 0, 0, 0.1));
  border-radius: var(--radius-lg, 8px);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
}

.review-form-textarea:focus {
  outline: none;
  border-color: var(--primary, #0046be);
  box-shadow: 0 0 0 3px rgba(0, 70, 190, 0.1);
}

.review-form-textarea::placeholder {
  color: var(--neutral-400, #9ca3af);
}

.review-form-detailed {
  display: grid;
  gap: var(--space-md, 12px);
}

.review-form-detailed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm, 8px) var(--space-md, 12px);
  background-color: var(--bg-secondary, #f9fafb);
  border-radius: var(--radius-md, 6px);
}

.review-form-footer {
  display: flex;
  gap: var(--space-md, 12px);
  padding: var(--space-xl, 20px);
  border-top: 1px solid var(--neutral-200, rgba(0, 0, 0, 0.06));
}

.review-form-btn {
  flex: 1;
  padding: 12px 24px;
  border-radius: var(--radius-lg, 8px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.review-form-btn--primary {
  background-color: var(--primary, #0046be);
  color: #ffffff;
}

.review-form-btn--primary:hover {
  background-color: var(--primary-dark, #003399);
  transform: translateY(-1px);
}

.review-form-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.review-form-btn--secondary {
  background-color: var(--bg-secondary, #f9fafb);
  color: var(--neutral-700, #374151);
}

.review-form-btn--secondary:hover {
  background-color: var(--neutral-200, #e5e7eb);
}

/* --- Seller Profile Rating --- */
.seller-rating {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm, 8px);
  padding: 8px 12px;
  background-color: var(--bg-primary, #ffffff);
  border-radius: var(--radius-lg, 8px);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.seller-rating-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--neutral-900, #111827);
}

.seller-rating-count {
  font-size: 13px;
  color: var(--neutral-500, #6b7280);
}

/* --- Write Review Button --- */
.write-review-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm, 8px);
  padding: 10px 20px;
  background-color: var(--primary, #0046be);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-lg, 8px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.write-review-btn:hover {
  background-color: var(--primary-dark, #003399);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 70, 190, 0.3);
}

.write-review-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --- Empty State --- */
.empty-reviews {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl, 48px);
  text-align: center;
}

.empty-reviews-icon {
  font-size: 64px;
  margin-bottom: var(--space-lg, 16px);
  opacity: 0.3;
}

.empty-reviews h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--neutral-700, #374151);
  margin: 0 0 var(--space-sm, 8px);
}

.empty-reviews p {
  font-size: 14px;
  color: var(--neutral-500, #6b7280);
  margin: 0;
  max-width: 320px;
}

/* --- Reviews Section Header --- */
.reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg, 16px);
}

.reviews-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--neutral-900, #111827);
  margin: 0;
}

.reviews-header-actions {
  display: flex;
  gap: var(--space-sm, 8px);
}

/* --- Loading State --- */
.reviews-loading {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg, 16px);
}

.review-card-skeleton {
  background-color: var(--bg-primary, #ffffff);
  border-radius: var(--radius-xl, 12px);
  padding: var(--space-xl, 20px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.skeleton-line {
  height: 16px;
  background: linear-gradient(
    90deg,
    var(--neutral-200, #f3f4f6) 25%,
    var(--neutral-300, #e5e7eb) 50%,
    var(--neutral-200, #f3f4f6) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-line.short {
  width: 60%;
}
.skeleton-line.medium {
  width: 80%;
}
.skeleton-line.long {
  width: 100%;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .review-form-footer {
    flex-direction: column;
  }

  .review-form-footer .btn {
    width: 100%;
  }

  .review-form-detailed-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

@media (max-width: 640px) {
  .rating-average-number {
    font-size: 36px;
  }

  .review-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .review-author {
    justify-content: center;
  }

  .review-meta {
    justify-content: center;
    flex-wrap: wrap;
  }

  .review-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .review-detailed-ratings {
    grid-template-columns: 1fr;
  }

  .reviews-header {
    flex-direction: column;
    gap: var(--space-md, 12px);
    align-items: flex-start;
  }
}

/* --- Dark Mode Overrides --- */
[data-theme='dark'] .star,
[data-theme='dark'] .star.empty,
[data-theme='dark'] .star-input {
  color: var(--neutral-300);
}

[data-theme='dark'] .star.half {
  background: linear-gradient(90deg, #fbbf24 50%, var(--neutral-300) 50%);
}

[data-theme='dark'] .review-form-textarea {
  background-color: var(--bg-secondary);
  color: var(--neutral-900);
}

[data-theme='dark'] .review-form-textarea:focus {
  box-shadow: 0 0 0 3px rgba(109, 158, 255, 0.15);
}
