/* ============================================================
   Google Reviews Flyout Widget
   Fixed badge + slide-in panel showing Google Reviews
   Uses design tokens from styles.css :root
   ============================================================ */

/* --- Badge (fixed bottom-left trigger) --- */
.gr-badge {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  background: var(--color-white);
  border-radius: var(--radius-pill);
  box-shadow:
    0 4px 20px rgba(232, 88, 32, 0.12),
    0 2px 8px rgba(40, 40, 40, 0.08);
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  border: 1px solid var(--color-border);
  user-select: none;
  -webkit-user-select: none;
}

.gr-badge:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 28px rgba(232, 88, 32, 0.18),
    0 4px 12px rgba(40, 40, 40, 0.10);
}

.gr-badge:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.gr-badge:active {
  transform: translateY(0);
}

.gr-badge__google-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.gr-badge__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.gr-badge__rating-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gr-badge__score {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-charcoal);
  letter-spacing: -0.02em;
}

.gr-badge__stars {
  display: flex;
  gap: 1px;
}

.gr-badge__star {
  width: 14px;
  height: 14px;
  color: #F4B400;
}

.gr-badge__count {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-gray);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* --- Overlay (backdrop) --- */
.gr-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: var(--color-overlay);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-base),
    visibility var(--transition-base);
  cursor: pointer;
}

.gr-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* --- Slide-in Panel --- */
.gr-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1002;
  width: 420px;
  max-width: 100vw;
  background: var(--color-warm);
  transform: translateX(-100%);
  transition: transform 0.4s var(--transition-smooth);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 40px rgba(40, 40, 40, 0.15);
}

.gr-panel.is-open {
  transform: translateX(0);
}

/* --- Panel Header --- */
.gr-panel__header {
  padding: 28px 24px 20px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  position: relative;
}

.gr-panel__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-gray);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.gr-panel__close:hover {
  background: var(--color-light);
  color: var(--color-charcoal);
}

.gr-panel__close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.gr-panel__close:active {
  transform: scale(0.92);
}

.gr-panel__close svg {
  width: 20px;
  height: 20px;
}

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

.gr-panel__brand-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.gr-panel__brand-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-charcoal);
  letter-spacing: -0.02em;
}

.gr-panel__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gr-panel__summary-score {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--color-charcoal);
  letter-spacing: -0.03em;
}

.gr-panel__summary-stars {
  display: flex;
  gap: 2px;
}

.gr-panel__summary-star {
  width: 20px;
  height: 20px;
  color: #F4B400;
}

.gr-panel__summary-text {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--color-gray);
  margin-top: 2px;
}

/* --- CTA Button --- */
.gr-panel__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--color-accent);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  box-shadow: 0 2px 8px rgba(232, 88, 32, 0.25);
}

.gr-panel__cta:hover {
  background: var(--color-accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232, 88, 32, 0.3);
}

.gr-panel__cta:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.gr-panel__cta:active {
  transform: translateY(0);
}

.gr-panel__cta svg {
  width: 16px;
  height: 16px;
}

/* --- Review List (scrollable body) --- */
.gr-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.gr-panel__body::-webkit-scrollbar {
  width: 6px;
}

.gr-panel__body::-webkit-scrollbar-track {
  background: transparent;
}

.gr-panel__body::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

/* --- Individual Review Card --- */
.gr-review {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--color-border);
  transition: box-shadow var(--transition-fast);
}

.gr-review:hover {
  box-shadow: var(--shadow-subtle);
}

.gr-review:last-child {
  margin-bottom: 0;
}

.gr-review__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.gr-review__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.gr-review__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.gr-review__name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-charcoal);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gr-review__date {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-gray-light);
  font-weight: 400;
}

.gr-review__stars {
  display: flex;
  gap: 1px;
  margin-bottom: 8px;
}

.gr-review__star {
  width: 14px;
  height: 14px;
  color: #F4B400;
}

.gr-review__text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--color-charcoal-light);
}

/* --- Owner Reply --- */
.gr-review__reply {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--color-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-accent);
}

.gr-review__reply-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--color-charcoal);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.gr-review__reply-text {
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--color-gray);
}

/* --- Panel Footer --- */
.gr-panel__footer {
  padding: 14px 24px;
  border-top: 1px solid var(--color-border);
  background: var(--color-white);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gr-panel__powered {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-gray-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.gr-panel__powered svg {
  width: 14px;
  height: 14px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .gr-badge {
    bottom: 16px;
    left: 16px;
    padding: 8px 12px 8px 10px;
    gap: 8px;
  }

  .gr-badge__google-icon {
    width: 24px;
    height: 24px;
  }

  .gr-badge__score {
    font-size: 0.95rem;
  }

  .gr-badge__star {
    width: 12px;
    height: 12px;
  }

  .gr-badge__count {
    display: none;
  }

  .gr-panel {
    width: 100vw;
  }

  .gr-panel__header {
    padding: 20px 16px 16px;
  }

  .gr-panel__body {
    padding: 12px 16px 20px;
  }

  .gr-review {
    padding: 14px;
  }

  .gr-panel__footer {
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .gr-badge {
    bottom: 12px;
    left: 12px;
    padding: 7px 10px 7px 8px;
  }

  .gr-badge__info {
    gap: 0;
  }

  .gr-panel__summary-score {
    font-size: 1.25rem;
  }

  .gr-panel__summary-star {
    width: 16px;
    height: 16px;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .gr-badge,
  .gr-overlay,
  .gr-panel,
  .gr-panel__close,
  .gr-panel__cta,
  .gr-review {
    transition: none;
  }
}
