/* HandyVictor Live Reviews Pro – Frontend Stylesheet */
/* Premium glassmorphism design with smooth animations */

/* ─── CSS Variables ───────────────────────────────────────── */
:root {
  --hv-primary:     #1a73e8;
  --hv-accent:      #00B67A;
  --hv-stars:       #FFB800;
  --hv-radius:      16px;
  --hv-font-size:   15px;
  --hv-spacing:     24px;
  --hv-shadow:      0 4px 24px rgba(0, 0, 0, 0.08);
  --hv-shadow-hover:0 12px 48px rgba(0, 0, 0, 0.14);
  --hv-card-bg:     rgba(255, 255, 255, 0.97);
  --hv-card-border: rgba(0, 0, 0, 0.06);
  --hv-text:        #1a1a2e;
  --hv-text-muted:  #6b7280;
  --hv-bg:          #f0f4f8;
  --hv-transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Dark Theme ─────────────────────────────────────────── */
.hv-theme-dark {
  --hv-card-bg:     rgba(30, 32, 48, 0.95);
  --hv-card-border: rgba(255, 255, 255, 0.08);
  --hv-text:        #e8eaf6;
  --hv-text-muted:  #9ca3af;
  --hv-bg:          #0f1117;
  --hv-shadow:      0 4px 24px rgba(0, 0, 0, 0.3);
  --hv-shadow-hover:0 12px 48px rgba(0, 0, 0, 0.4);
}

/* System dark mode */
@media (prefers-color-scheme: dark) {
  .hv-reviews-wrapper:not(.hv-theme-light) {
    --hv-card-bg:     rgba(30, 32, 48, 0.95);
    --hv-card-border: rgba(255, 255, 255, 0.08);
    --hv-text:        #e8eaf6;
    --hv-text-muted:  #9ca3af;
    --hv-bg:          #0f1117;
    --hv-shadow:      0 4px 24px rgba(0, 0, 0, 0.3);
    --hv-shadow-hover:0 12px 48px rgba(0, 0, 0, 0.4);
  }
}

/* ─── Wrapper ────────────────────────────────────────────── */
.hv-reviews-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--hv-font-size);
  color: var(--hv-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hv-reviews-wrapper *,
.hv-reviews-wrapper *::before,
.hv-reviews-wrapper *::after {
  box-sizing: border-box;
}

/* ─── Aggregate Header ───────────────────────────────────── */
.hv-aggregate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: calc(var(--hv-spacing) * 1.5);
  padding: 20px 24px;
  background: var(--hv-card-bg);
  border: 1px solid var(--hv-card-border);
  border-radius: var(--hv-radius);
  box-shadow: var(--hv-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hv-aggregate-rating {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hv-aggregate-score {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--hv-text);
  line-height: 1;
}

.hv-aggregate-stars {
  display: flex;
  gap: 2px;
}

.hv-aggregate-stars .hv-star--filled {
  color: var(--hv-stars);
  font-size: 1.4rem;
}

.hv-aggregate-stars .hv-star--empty {
  color: #d1d5db;
  font-size: 1.4rem;
}

.hv-aggregate-count {
  font-size: 0.85rem;
  color: var(--hv-text-muted);
}

/* ─── Grid Layout ────────────────────────────────────────── */
.hv-reviews-grid {
  display: grid;
  gap: var(--hv-spacing);
}

.hv-grid-cols-1 { grid-template-columns: 1fr; }
.hv-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.hv-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.hv-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .hv-grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .hv-grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .hv-reviews-grid { grid-template-columns: 1fr; }
}

/* ─── Review Card ────────────────────────────────────────── */
.hv-review-card {
  height: 100%;
}

.hv-card-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 24px;
  background: var(--hv-card-bg);
  border: 1px solid var(--hv-card-border);
  border-radius: var(--hv-radius);
  box-shadow: var(--hv-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform var(--hv-transition), box-shadow var(--hv-transition);
  position: relative;
  overflow: hidden;
}

.hv-card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hv-primary), var(--hv-accent));
  opacity: 0;
  transition: opacity var(--hv-transition);
}

.hv-card-inner:hover {
  transform: translateY(-4px);
  box-shadow: var(--hv-shadow-hover);
}

.hv-card-inner:hover::before {
  opacity: 1;
}

/* ─── Source Badge ───────────────────────────────────────── */
.hv-card-source {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hv-source-icon {
  flex-shrink: 0;
}

.hv-source-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hv-source-google     { color: #4285F4; }
.hv-source-trustpilot { color: #00B67A; }

/* ─── Card Header ────────────────────────────────────────── */
.hv-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ─── Avatar ─────────────────────────────────────────────── */
.hv-avatar-wrap {
  flex-shrink: 0;
  position: relative;
}

.hv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.hv-avatar-initials {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

/* ─── Reviewer Info ──────────────────────────────────────── */
.hv-reviewer-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.hv-reviewer-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--hv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hv-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #00B67A;
  letter-spacing: 0.02em;
}

/* ─── Stars ──────────────────────────────────────────────── */
.hv-rating {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hv-stars {
  display: flex;
  gap: 1px;
}

.hv-star {
  font-size: 1.1rem;
  line-height: 1;
}

.hv-star--filled { color: var(--hv-stars); }
.hv-star--empty  { color: #d1d5db; }

/* ─── Review Content ─────────────────────────────────────── */
.hv-review-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--hv-text);
  margin: 0;
}

.hv-review-text {
  flex: 1;
  font-size: var(--hv-font-size);
  color: var(--hv-text-muted);
  line-height: 1.7;
}

.hv-review-text p {
  margin: 0;
}

/* ─── Read More ──────────────────────────────────────────── */
.hv-read-more {
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #dc2626;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--hv-transition);
  display: inline-block;
}

.hv-read-more:hover { color: #b91c1c; }

/* ─── Date ───────────────────────────────────────────────── */
.hv-review-date {
  font-size: 0.78rem;
  color: var(--hv-text-muted);
  margin-top: auto;
}

/* ─── Marquee / Infinite Scroll Layout ───────────────────── */
.hv-reviews-marquee-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  /* Fade-edge colour tokens — updated per theme */
  --hv-mq-fade-light: #ffffff;
  --hv-mq-fade-dark:  #0f1117;
}

/* Light theme fade */
.hv-reviews-marquee-wrapper.hv-theme-light {
  --hv-mq-fade: var(--hv-mq-fade-light);
}

/* Dark theme fade */
.hv-reviews-marquee-wrapper.hv-theme-dark {
  --hv-mq-fade: var(--hv-mq-fade-dark);
}

/* System dark mode for auto theme */
@media (prefers-color-scheme: dark) {
  .hv-reviews-marquee-wrapper:not(.hv-theme-light) {
    --hv-mq-fade: var(--hv-mq-fade-dark);
  }
}

/* Fade mask edges — only when .hv-marquee-fade-edges is present */
.hv-reviews-marquee-wrapper.hv-marquee-fade-edges::before,
.hv-reviews-marquee-wrapper.hv-marquee-fade-edges::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(60px, 8vw, 140px);
  z-index: 2;
  pointer-events: none;
}
.hv-reviews-marquee-wrapper.hv-marquee-fade-edges::before {
  left: 0;
  background: linear-gradient(to right, var(--hv-mq-fade, #fff) 0%, transparent 100%);
}
.hv-reviews-marquee-wrapper.hv-marquee-fade-edges::after {
  right: 0;
  background: linear-gradient(to left, var(--hv-mq-fade, #fff) 0%, transparent 100%);
}

.hv-marquee-viewport {
  overflow: hidden;
  width: 100%;
}

/* Drag cursor — JS sets grabbing on the track itself while dragging */
.hv-reviews-marquee-wrapper {
  cursor: grab;
}
.hv-reviews-marquee-wrapper:active {
  cursor: grabbing;
}

/* Track starts paused; JS adds .hv-marquee-ready to begin */
.hv-marquee-track {
  display: flex;
  gap: var(--hv-spacing);
  width: max-content;
  will-change: transform;
  animation: hv-marquee var(--hv-marquee-duration, 40s) linear infinite;
  animation-play-state: paused;
}

.hv-marquee-track.hv-marquee-ready {
  animation-play-state: running;
}

/* Pause on hover — disabled when wrapper has .hv-marquee-no-pause */
.hv-reviews-marquee-wrapper:not(.hv-marquee-no-pause):hover .hv-marquee-track {
  animation-play-state: paused !important;
}

/* Reduced motion — show as static wrapping grid */
@media (prefers-reduced-motion: reduce) {
  .hv-marquee-track,
  .hv-marquee-track.hv-marquee-ready {
    animation: none !important;
    flex-wrap: wrap;
  }
  /* Hide the cloned duplicates under reduced-motion */
  .hv-marquee-item[aria-hidden="true"] {
    display: none;
  }
}

@keyframes hv-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ─── Marquee Card Item ───────────────────────────────────── */
.hv-marquee-item {
  flex-shrink: 0;
  width: clamp(280px, 30vw, 360px);
}

.hv-marquee-item .hv-review-card,
.hv-marquee-item .hv-card-inner {
  height: 100%;
}

/* Keep cards uniform height within marquee */
.hv-marquee-item .hv-card-inner {
  min-height: 200px;
}

/* ─── Marquee Card Style Variants ────────────────────────── */

/* Glass (default) — already handled by base .hv-card-inner */

/* Minimal */
.hv-card-style-minimal .hv-card-inner {
  background: transparent;
  border-color: var(--hv-card-border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.hv-card-style-minimal .hv-card-inner:hover {
  box-shadow: var(--hv-shadow);
  background: var(--hv-card-bg);
}

/* Elevated */
.hv-card-style-elevated .hv-card-inner {
  border: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.hv-card-style-elevated .hv-card-inner:hover {
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.18);
}
.hv-theme-dark .hv-card-style-elevated .hv-card-inner {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.hv-theme-dark .hv-card-style-elevated .hv-card-inner:hover {
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.6);
}

/* ─── Empty State ────────────────────────────────────────── */
.hv-reviews-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--hv-card-bg);
  border: 1px dashed var(--hv-card-border);
  border-radius: var(--hv-radius);
  color: var(--hv-text-muted);
}

.hv-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.hv-reviews-empty p {
  margin: 0;
  font-size: 0.95rem;
}

/* ─── Loading Skeleton ───────────────────────────────────── */
.hv-skeleton-card {
  background: var(--hv-card-bg);
  border: 1px solid var(--hv-card-border);
  border-radius: var(--hv-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hv-skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: hv-shimmer 1.5s infinite;
}

.hv-theme-dark .hv-skeleton-line {
  background: linear-gradient(90deg, #2a2d40 25%, #333648 50%, #2a2d40 75%);
  background-size: 200% 100%;
}

@keyframes hv-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.hv-skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hv-skeleton-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.hv-skeleton-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ─── Floating Widget ────────────────────────────────────── */
.hv-floating-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 320px;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  background: var(--hv-card-bg);
  border: 1px solid var(--hv-card-border);
  border-radius: calc(var(--hv-radius) * 1.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.hv-floating-widget.hv-widget-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.hv-floating-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--hv-primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(26, 115, 232, 0.4);
  transition: all var(--hv-transition);
}

.hv-floating-trigger:hover {
  box-shadow: 0 8px 32px rgba(26, 115, 232, 0.5);
  transform: translateY(-2px);
}

/* ─── Animations ─────────────────────────────────────────── */
.hv-review-card {
  animation: hv-fade-up 0.5s ease both;
}

.hv-reviews-grid .hv-review-card:nth-child(1)  { animation-delay: 0.05s; }
.hv-reviews-grid .hv-review-card:nth-child(2)  { animation-delay: 0.10s; }
.hv-reviews-grid .hv-review-card:nth-child(3)  { animation-delay: 0.15s; }
.hv-reviews-grid .hv-review-card:nth-child(4)  { animation-delay: 0.20s; }
.hv-reviews-grid .hv-review-card:nth-child(5)  { animation-delay: 0.25s; }
.hv-reviews-grid .hv-review-card:nth-child(6)  { animation-delay: 0.30s; }
.hv-reviews-grid .hv-review-card:nth-child(n+7){ animation-delay: 0.35s; }

@keyframes hv-fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Accessibility ──────────────────────────────────────── */
.hv-review-card:focus-within .hv-card-inner {
  outline: 2px solid var(--hv-primary);
  outline-offset: 2px;
}

.hv-read-more:focus-visible,
.hv-slider-prev:focus-visible,
.hv-slider-next:focus-visible {
  outline: 2px solid var(--hv-primary);
  outline-offset: 2px;
}

/* ─── Print ──────────────────────────────────────────────── */
@media print {
  .hv-slider-prev,
  .hv-slider-next,
  .hv-slider-dots,
  .hv-floating-trigger,
  .hv-floating-widget { display: none !important; }

  .hv-reviews-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
