/* ==========================================================================
   ReviewShowcase Widget Engine - Core Component Styles
   Supports: Carousel, Grid, Masonry layouts & Dynamic CSS variables
   ========================================================================== */

:root {
  --rps-theme-color: #FBBC05;
  --rps-theme-color-rgb: 251, 188, 5;
  --rps-bg-card: #ffffff;
  --rps-text-primary: #1e293b;
  --rps-text-secondary: #64748b;
  --rps-text-muted: #94a3b8;
  --rps-border: #e2e8f0;
  --rps-border-hover: #cbd5e1;
  --rps-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --rps-shadow-hover: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.06);
  --rps-radius-card: 16px;
  --rps-font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dark mode theme modifier for the widget */
.rps-widget[data-theme="dark"] {
  --rps-bg-card: #1e293b;
  --rps-text-primary: #f8fafc;
  --rps-text-secondary: #94a3b8;
  --rps-text-muted: #64748b;
  --rps-border: #334155;
  --rps-border-hover: #475569;
  --rps-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.35);
  --rps-shadow-hover: 0 16px 36px -4px rgba(0, 0, 0, 0.5);
}

.rps-widget {
  font-family: var(--rps-font-family);
  color: var(--rps-text-primary);
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.rps-widget * {
  box-sizing: border-box;
}

/* ==========================================================================
   Widget Header / Business Summary Banner
   ========================================================================== */
.rps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 24px;
  background: var(--rps-bg-card);
  border: 1px solid var(--rps-border);
  border-radius: var(--rps-radius-card);
  margin-bottom: 24px;
  box-shadow: var(--rps-shadow);
  transition: all 0.25s ease;
}

.rps-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rps-google-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.rps-business-info {
  display: flex;
  flex-direction: column;
}

.rps-business-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rps-business-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--rps-text-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.rps-verified-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #3b82f6;
  color: white;
  border-radius: 50%;
  font-size: 11px;
}

.rps-business-meta {
  font-size: 0.84rem;
  color: var(--rps-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.rps-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rps-rating-block {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.rps-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rps-rating-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--rps-text-primary);
  line-height: 1;
}

.rps-stars-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.rps-star-icon {
  width: 16px;
  height: 16px;
  fill: var(--rps-theme-color);
  color: var(--rps-theme-color);
  transition: fill 0.2s ease;
}

.rps-star-icon.rps-star-empty {
  fill: #e2e8f0;
  color: #e2e8f0;
}

.rps-widget[data-theme="dark"] .rps-star-icon.rps-star-empty {
  fill: #334155;
  color: #334155;
}

.rps-review-count-label {
  font-size: 0.78rem;
  color: var(--rps-text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.rps-btn-write-review {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(var(--rps-theme-color-rgb), 0.12);
  color: var(--rps-text-primary);
  border: 1px solid rgba(var(--rps-theme-color-rgb), 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.rps-btn-write-review:hover {
  background: var(--rps-theme-color);
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--rps-theme-color-rgb), 0.3);
}

/* ==========================================================================
   Review Card Styles
   ========================================================================== */
.rps-review-card {
  background: var(--rps-bg-card);
  border: 1px solid var(--rps-border);
  border-radius: var(--rps-radius-card);
  padding: 22px;
  box-shadow: var(--rps-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.2s ease;
  overflow: hidden;
}

.rps-review-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--rps-shadow-hover);
  border-color: var(--rps-border-hover);
}

.rps-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.rps-author-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rps-avatar-box {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.rps-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  background: #f1f5f9;
}

.rps-avatar-initials {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
  background: linear-gradient(135deg, var(--rps-theme-color), #4f46e5);
}

.rps-source-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  border: 1px solid #f1f5f9;
}

.rps-source-badge svg {
  width: 12px;
  height: 12px;
}

.rps-author-details {
  display: flex;
  flex-direction: column;
}

.rps-author-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--rps-text-primary);
  line-height: 1.25;
}

.rps-author-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.rps-local-guide-pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: #ea580c;
  background: #ffedd5;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1;
}

.rps-widget[data-theme="dark"] .rps-local-guide-pill {
  background: rgba(234, 88, 12, 0.2);
  color: #fb923c;
}

.rps-time-ago {
  font-size: 0.76rem;
  color: var(--rps-text-muted);
}

.rps-card-google-icon {
  width: 20px;
  height: 20px;
  opacity: 0.85;
}

.rps-rating-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rps-verified-purchase {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #059669;
  font-weight: 600;
  background: #ecfdf5;
  padding: 2px 7px;
  border-radius: 9999px;
}

.rps-widget[data-theme="dark"] .rps-verified-purchase {
  background: rgba(5, 150, 105, 0.18);
  color: #34d399;
}

.rps-review-body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--rps-text-secondary);
  flex-grow: 1;
  word-break: break-word;
}

.rps-review-body p {
  margin: 0;
}

/* Owner response block */
.rps-owner-response {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.025);
  border-left: 3px solid var(--rps-theme-color);
  border-radius: 0 8px 8px 0;
  font-size: 0.8rem;
}

.rps-widget[data-theme="dark"] .rps-owner-response {
  background: rgba(255, 255, 255, 0.04);
}

.rps-owner-title {
  font-weight: 700;
  color: var(--rps-text-primary);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rps-owner-text {
  color: var(--rps-text-secondary);
  font-style: italic;
  line-height: 1.45;
}

/* ==========================================================================
   LAYOUT 1: GRID
   ========================================================================== */
.rps-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

/* ==========================================================================
   LAYOUT 2: MASONRY
   ========================================================================== */
.rps-layout-masonry {
  column-count: 3;
  column-gap: 20px;
}

.rps-layout-masonry .rps-review-card {
  break-inside: avoid;
  margin-bottom: 20px;
  display: inline-block;
  width: 100%;
}

@media (max-width: 900px) {
  .rps-layout-masonry {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .rps-layout-masonry {
    column-count: 1;
  }
}

/* ==========================================================================
   LAYOUT 3: CAROUSEL
   ========================================================================== */
.rps-layout-carousel {
  position: relative;
  overflow: hidden;
  padding: 8px 0 20px 0;
}

.rps-carousel-viewport {
  overflow: hidden;
  width: 100%;
  cursor: grab;
  user-select: none;
}

.rps-carousel-viewport:active {
  cursor: grabbing;
}

.rps-carousel-track {
  display: flex;
  gap: 20px;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.rps-layout-carousel .rps-review-card {
  flex: 0 0 calc((100% - 40px) / 3);
  min-width: 270px;
  max-width: 380px;
}

@media (max-width: 960px) {
  .rps-layout-carousel .rps-review-card {
    flex: 0 0 calc((100% - 20px) / 2);
  }
}

@media (max-width: 640px) {
  .rps-layout-carousel .rps-review-card {
    flex: 0 0 100%;
  }
}

/* Carousel Nav Controls */
.rps-carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.rps-carousel-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rps-carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--rps-border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.25s ease;
}

.rps-carousel-dot.active {
  width: 24px;
  background: var(--rps-theme-color);
}

.rps-carousel-arrows {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rps-carousel-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--rps-border);
  background: var(--rps-bg-card);
  color: var(--rps-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
}

.rps-carousel-btn:hover:not(:disabled) {
  background: var(--rps-theme-color);
  color: #111827;
  border-color: var(--rps-theme-color);
  transform: scale(1.06);
}

.rps-carousel-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Empty State / Filter State Notice */
.rps-empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--rps-bg-card);
  border-radius: var(--rps-radius-card);
  border: 1px dashed var(--rps-border);
}

.rps-empty-state h4 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  color: var(--rps-text-primary);
}

.rps-empty-state p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--rps-text-muted);
}
