/* ==========================================================================
   PSL DENTAL — Google Reviews Widget Stylesheet
   Version: 2.5.1 — картки на всю ширину на мобільному, вертикальний скрол тексту
   Color Scheme: #604738 (коричневий PSL), #4d3829 (hover), #C8A96E (золото), #FDF6F0 (крем)
   ========================================================================== */

:root {
  --psl-gr-primary: #604738;
  --psl-gr-primary-hover: #4d3829;
  --psl-gr-gold: #C8A96E;
  --psl-gr-star-yellow: #FFB800;
  --psl-gr-bg: #FDF6F0;
  --psl-gr-card-bg: #FFFFFF;
  --psl-gr-text-main: #2c1810;
  --psl-gr-text-muted: #7a6a5c;
  --psl-gr-border: #E0D0C8;
  --psl-gr-shadow: 0 4px 20px rgba(96, 71, 56, 0.08);
  --psl-gr-hover-shadow: 0 10px 30px rgba(96, 71, 56, 0.16);
  --psl-gr-radius-lg: 16px;
  --psl-gr-radius-md: 12px;
  --psl-gr-radius-sm: 8px;
  --psl-gr-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Ensure box-sizing across all widget components */
.psl-gr-widget,
.psl-gr-widget *,
.psl-gr-widget *::before,
.psl-gr-widget *::after {
  box-sizing: border-box;
}

/* Base Widget Container */
.psl-gr-widget {
  font-family: var(--psl-gr-font);
  background-color: var(--psl-gr-bg);
  border-radius: var(--psl-gr-radius-lg);
  padding: 32px 24px;
  max-width: 1140px;
  width: 100%;
  margin: 24px auto;
  color: var(--psl-gr-text-main);
  border: 1px solid var(--psl-gr-border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
  overflow: hidden;
  position: relative;
}

/* Header Section */
.psl-gr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px dashed #E0D0C8;
  width: 100%;
}

.psl-gr-brand-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 100%;
}

/* Brand Logo Badge in Header */
.psl-gr-brand-badge {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  border: 1px solid var(--psl-gr-border);
  flex-shrink: 0;
  padding: 6px;
}

/* Лого PSL — біле на прозорому (розраховане на темну шапку сайту).
   На білій картці воно було б невидиме, тому підкладаємо фірмову коричневу плашку.
   Перевірено 03.08.2026: 100% непрозорих пікселів логотипа — майже білі. */
.psl-gr-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  background: var(--psl-gr-primary);
  padding: 4px;
  box-sizing: border-box;
}

/* Small Google Overlay Badge */
.psl-gr-google-overlay {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  border: 1px solid #E0D0C8;
}

.psl-gr-title-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.psl-gr-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--psl-gr-text-main);
  margin: 0;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.psl-gr-rating-overview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.psl-gr-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--psl-gr-primary);
}

.psl-gr-stars-header {
  display: inline-flex;
  gap: 2px;
}

.psl-gr-count {
  color: var(--psl-gr-text-muted);
  font-weight: 400;
  font-size: 14px;
}

/* Header Actions (Button + Nav Controls) */
.psl-gr-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* CTA Button */
.psl-gr-btn-review {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--psl-gr-primary);
  color: #FFFFFF !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 50px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(96, 71, 56, 0.3);
  max-width: 100%;
}

.psl-gr-btn-review:hover {
  background-color: var(--psl-gr-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(96, 71, 56, 0.4);
  color: #FFFFFF !important;
}

/* Slider Nav Buttons */
.psl-gr-nav-controls {
  display: flex;
  gap: 6px;
}

.psl-gr-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--psl-gr-border);
  background: #FFFFFF;
  color: var(--psl-gr-text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.psl-gr-nav-btn:hover {
  background-color: var(--psl-gr-primary);
  color: #FFFFFF;
  border-color: var(--psl-gr-primary);
  transform: scale(1.05);
}

/* Layout 1: Grid Mode */
.psl-gr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  width: 100%;
}

/* Layout 2: Slider / Horizontal Scroll Mode */
.psl-gr-slider-mode {
  display: flex !important;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 8px 4px 16px 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--psl-gr-primary) #E0D0C8;
  width: 100%;
}

.psl-gr-slider-mode::-webkit-scrollbar {
  height: 6px;
}

.psl-gr-slider-mode::-webkit-scrollbar-track {
  background: #E0D0C8;
  border-radius: 10px;
}

.psl-gr-slider-mode::-webkit-scrollbar-thumb {
  background: var(--psl-gr-primary);
  border-radius: 10px;
}

.psl-gr-slider-mode .psl-gr-card {
  flex: 0 0 350px;
  max-width: 350px;
  scroll-snap-align: start;
}

/* Review Card */
.psl-gr-card {
  background: var(--psl-gr-card-bg);
  border: 1px solid var(--psl-gr-border);
  border-radius: var(--psl-gr-radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: var(--psl-gr-shadow);
  position: relative;
  min-width: 0;
}

.psl-gr-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--psl-gr-hover-shadow);
  border-color: rgba(96, 71, 56, 0.4);
}

/* Card Top: Author Profile */
.psl-gr-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}

.psl-gr-author-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.psl-gr-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #F5EDE6;
  flex-shrink: 0;
}

.psl-gr-avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #604738 0%, #4d3829 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(96, 71, 56, 0.3);
}

.psl-gr-author-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.psl-gr-author-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--psl-gr-text-main);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psl-gr-author-name:hover {
  color: var(--psl-gr-primary);
}

.psl-gr-time {
  font-size: 12px;
  color: var(--psl-gr-text-muted);
  margin-top: 3px;
}

.psl-gr-gicon {
  opacity: 0.85;
  flex-shrink: 0;
}

/* Stars Rating */
.psl-gr-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.psl-gr-star {
  font-size: 16px;
  color: var(--psl-gr-star-yellow);
}

.psl-gr-star-empty {
  color: #F5EDE6;
}

/* Scrollable Long Review Text Container */
.psl-gr-text {
  font-size: 14px;
  line-height: 1.6;
  color: #6b5a50;
  margin-bottom: 12px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 6px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 71, 56, 0.4) transparent;
}

.psl-gr-text::-webkit-scrollbar {
  width: 4px;
}

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

.psl-gr-text::-webkit-scrollbar-thumb {
  background: rgba(96, 71, 56, 0.4);
  border-radius: 4px;
}

.psl-gr-text::-webkit-scrollbar-thumb:hover {
  background: var(--psl-gr-primary);
}

/* Owner Response Box */
.psl-gr-owner-reply {
  background-color: #FDF6F0;
  border-left: 3px solid var(--psl-gr-primary);
  border-radius: 0 var(--psl-gr-radius-sm) var(--psl-gr-radius-sm) 0;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 13px;
  color: #6b5a50;
  max-height: 100px;
  overflow-y: auto;
}

.psl-gr-owner-reply-title {
  font-weight: 700;
  color: var(--psl-gr-primary);
  font-size: 12px;
  margin-bottom: 4px;
}

/* Затухання внизу тексту, поки є що догортати. Клас ставить JS —
   без нього градієнта немає, тобто короткі відгуки не «підрізані» візуально. */
.psl-gr-text.is-clipped {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent 100%);
}

/* Тема сайту має .single-post .entry-content img { border-radius: 4px }
   зі специфічністю 0,2,1 — вона перебиває наші 50% і робить круглі
   аватарки та лого квадратними, якщо віджет стоїть усередині статті.
   Піднімаємо специфічність до 0,3,0. */
.single-post .entry-content .psl-gr-avatar,
.single-post .entry-content .psl-gr-logo-img { border-radius: 50%; }

/* Текст лише для читалок: зірки самі по собі нічого не озвучують */
.psl-gr-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Резервний стан: Places API недоступний. Карток не вигадуємо —
   показуємо рейтинг у шапці й ведемо в профіль Google. */
.psl-gr-empty {
  margin: 0;
  padding: 22px 20px;
  background: var(--psl-gr-card-bg);
  border: 1px dashed #E0D0C8;
  border-radius: var(--psl-gr-radius-md);
  text-align: center;
  font-size: 14px;
  color: var(--psl-gr-text-muted);
}

.psl-gr-empty a {
  color: var(--psl-gr-primary);
  font-weight: 600;
}

/* Focus-стан для клавіатури — без нього кнопки не видно при Tab */
.psl-gr-nav-btn:focus-visible,
.psl-gr-btn-review:focus-visible,
.psl-gr-author-name:focus-visible,
.psl-gr-footer a:focus-visible,
.psl-gr-empty a:focus-visible {
  outline: 2px solid var(--psl-gr-primary);
  outline-offset: 3px;
}

/* Footer / Powered By */
.psl-gr-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--psl-gr-text-muted);
}

.psl-gr-footer a {
  color: var(--psl-gr-primary);
  text-decoration: none;
  font-weight: 600;
}

/* Responsive Mobile Adjustments (Option C: 100% Width Cards) */
@media (max-width: 640px) {
  .psl-gr-widget {
    padding: 20px 16px;
    margin: 12px auto;
  }
  .psl-gr-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .psl-gr-brand-summary {
    width: 100%;
  }
  .psl-gr-header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .psl-gr-btn-review {
    flex: 1;
    margin-top: 4px;
  }
  .psl-gr-grid {
    grid-template-columns: 1fr;
  }
  .psl-gr-slider-mode .psl-gr-card {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Користувач попросив менше руху — вимикаємо анімації та плавний скрол */
@media (prefers-reduced-motion: reduce) {
  .psl-gr-slider-mode { scroll-behavior: auto; }
  .psl-gr-card,
  .psl-gr-btn-review,
  .psl-gr-nav-btn { transition: none !important; }
  .psl-gr-card:hover,
  .psl-gr-btn-review:hover,
  .psl-gr-nav-btn:hover { transform: none !important; }
}
