/**
 * MDH Google Reviews — Modal + Star Badge Styles
 *
 * Scoped to .mdh-reviews-modal and .mdh-hero-stars.
 * Mobile-first: base → 641px → 1024px.
 */

/* ── Custom Properties ────────────────────────── */
:root {
  --mdh-brand: #013656;
  --mdh-secondary: #83c8f3;
  --mdh-gold: #fbbc04;
  --mdh-gray: #e2e8f0;
  --mdh-modal-radius: 12px;
  --mdh-modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ── Star Badge ───────────────────────────────── */
/* !important needed: theme applies outline/border to [role="button"] and [tabindex] elements */
.mdh-hero-stars {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  cursor: pointer !important;
  padding: 4px 0 !important;
  margin: 2px 0 !important;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  /* Center on mobile (hero dark background) */
  justify-content: center !important;
  width: 100%;
}

.mdh-hero-stars:hover,
.mdh-hero-stars:active {
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Apply scale to individual stars so the container stays in place */
.mdh-hero-stars .mdh-star {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.mdh-hero-stars:hover .mdh-star {
  transform: scale(1.1);
}

.mdh-hero-stars:focus-visible {
  outline: 2px solid var(--mdh-secondary) !important;
  outline-offset: 4px !important;
  border-radius: 4px;
}

.mdh-hero-stars:focus-visible .mdh-star {
  transform: scale(1.1);
}

/* ── Tablet+ ──────────────────────────────────── */
@media (min-width: 641px) {
  .mdh-hero-stars {
    /* Block-level flex: immune to parent text-align: center */
    display: flex !important;
    justify-content: flex-start !important;
    width: fit-content;
    gap: 4px !important;
    margin-bottom: 8px !important;
  }

  .mdh-hero-stars .mdh-star {
    width: 34px !important;
    height: 34px !important;
  }
}

/* ── Button Reset ─────────────────────────────── */
/* !important needed: WordPress theme applies background-color, padding, and
   color to bare <button> elements. Without this reset, the close button,
   nav arrows, dots, and read-more links inherit theme button styles. */
.mdh-reviews-modal button,
.mdh-reviews-modal button:hover,
.mdh-reviews-modal button:focus {
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: auto !important;
  min-width: auto !important;
  line-height: normal !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  font-size: inherit !important;
  color: inherit !important;
}

/* Re-apply our specific button styles after the reset */
.mdh-reviews-modal__close {
  padding: 8px !important;
  color: #64748b !important;
}
.mdh-reviews-modal__close:hover,
.mdh-reviews-modal__close:focus-visible {
  background: #f1f5f9 !important;
  color: var(--mdh-brand) !important;
}

.mdh-reviews-modal__prev,
.mdh-reviews-modal__next {
  border: 1px solid var(--mdh-gray) !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  color: var(--mdh-brand) !important;
}
.mdh-reviews-modal__prev:hover:not(:disabled),
.mdh-reviews-modal__next:hover:not(:disabled) {
  background: #f4f9fc !important;
  border-color: var(--mdh-secondary) !important;
  color: var(--mdh-brand) !important;
}
.mdh-reviews-modal__prev:disabled,
.mdh-reviews-modal__next:disabled {
  opacity: 0.35 !important;
  color: var(--mdh-brand) !important;
}

.mdh-reviews-modal__dot {
  width: 8px !important;
  height: 8px !important;
  padding: 0 !important;
  background: var(--mdh-gray) !important;
}
.mdh-reviews-modal__dot--active {
  background: var(--mdh-brand) !important;
}
.mdh-reviews-modal__dot:hover {
  background: var(--mdh-secondary) !important;
}

.mdh-reviews-modal__read-more {
  color: var(--mdh-secondary) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  padding: 0 !important;
  margin-left: 4px !important;
}
.mdh-reviews-modal__read-more:hover {
  color: var(--mdh-brand) !important;
}

/* ── Modal Overlay ────────────────────────────── */
.mdh-reviews-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  /* Prevent paint while hidden */
  contain: layout style;
}

/* !important needed: overrides inline style="display:none" used to prevent FOUC */
.mdh-reviews-modal--open {
  display: flex !important;
  align-items: center;
  justify-content: center;
  animation: mdh-modal-fadein 0.2s ease;
}

.mdh-reviews-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1;
}

/* ── Modal Dialog ─────────────────────────────── */
.mdh-reviews-modal__dialog {
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: var(--mdh-modal-radius);
  box-shadow: var(--mdh-modal-shadow);
  width: calc(100% - 32px);
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Close Button ─────────────────────────────── */
.mdh-reviews-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  color: #64748b;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.mdh-reviews-modal__close:hover,
.mdh-reviews-modal__close:focus-visible {
  background: #f1f5f9;
  color: var(--mdh-brand);
}

.mdh-reviews-modal__close:focus-visible {
  outline: 2px solid var(--mdh-secondary);
  outline-offset: 2px;
}

/* ── Header ───────────────────────────────────── */
.mdh-reviews-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--mdh-gray);
  flex-shrink: 0;
}

.mdh-reviews-modal__google-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.mdh-reviews-modal__google-icon svg {
  width: 32px;
  height: 32px;
}

.mdh-reviews-modal__header-text {
  flex: 1;
  min-width: 0;
}

.mdh-reviews-modal__title {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--mdh-brand);
  margin: 0 0 4px;
  line-height: 1.3;
}

.mdh-reviews-modal__rating-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mdh-reviews-modal__rating-number {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--mdh-brand);
}

.mdh-reviews-modal__rating-stars {
  display: inline-flex;
  gap: 1px;
}

.mdh-reviews-modal__rating-stars .mdh-star {
  width: 16px;
  height: 16px;
}

.mdh-reviews-modal__rating-count {
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  color: #64748b;
}

/* ── Carousel ─────────────────────────────────── */
.mdh-reviews-modal__carousel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.mdh-reviews-modal__card {
  display: none;
}

.mdh-reviews-modal__card--active {
  display: block;
  animation: mdh-slide-fadein 0.2s ease;
}

.mdh-reviews-modal__card-stars {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
}

.mdh-reviews-modal__card-stars .mdh-star {
  width: 18px;
  height: 18px;
}

.mdh-reviews-modal__card-text {
  font-family: 'Open Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
  margin: 0 0 12px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.mdh-reviews-modal__read-more {
  background: none;
  border: none;
  color: var(--mdh-secondary);
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  margin-left: 4px;
}

.mdh-reviews-modal__read-more:hover {
  color: var(--mdh-brand);
  text-decoration: underline;
}

.mdh-reviews-modal__card-author {
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

.mdh-reviews-modal__card-author strong {
  color: var(--mdh-brand);
  font-weight: 600;
}

/* Empty state */
.mdh-reviews-modal__empty {
  text-align: center;
  padding: 32px 16px;
}

.mdh-reviews-modal__empty p {
  font-family: 'Open Sans', sans-serif;
  font-size: 15px;
  color: #64748b;
  margin: 0 0 16px;
}

/* ── Navigation ───────────────────────────────── */
.mdh-reviews-modal__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--mdh-gray);
  flex-shrink: 0;
}

.mdh-reviews-modal__prev,
.mdh-reviews-modal__next {
  background: none;
  border: 1px solid var(--mdh-gray);
  border-radius: 50%;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mdh-brand);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mdh-reviews-modal__prev:hover:not(:disabled),
.mdh-reviews-modal__next:hover:not(:disabled) {
  background: #f4f9fc;
  border-color: var(--mdh-secondary);
}

.mdh-reviews-modal__prev:disabled,
.mdh-reviews-modal__next:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* !important needed: WordPress theme applies generic button styles that override border-radius */
.mdh-reviews-modal__prev:focus-visible,
.mdh-reviews-modal__next:focus-visible {
  outline: 2px solid var(--mdh-secondary) !important;
  outline-offset: 2px !important;
}

.mdh-reviews-modal__dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mdh-reviews-modal__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mdh-gray);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  /* Minimum touch target via padding trick */
  box-sizing: content-box;
}

/* !important needed: WordPress theme sets min-height on buttons which distorts dots */
.mdh-reviews-modal__dot {
  min-height: auto !important;
  min-width: auto !important;
}

.mdh-reviews-modal__dot--active {
  background: var(--mdh-brand);
  transform: scale(1.25);
}

.mdh-reviews-modal__dot:hover {
  background: var(--mdh-secondary);
}

/* ── Footer ───────────────────────────────────── */
.mdh-reviews-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--mdh-gray);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.mdh-reviews-modal__google-link {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--mdh-brand);
  text-decoration: none;
  transition: color 0.15s ease;
}

.mdh-reviews-modal__google-link:hover {
  color: var(--mdh-secondary);
  text-decoration: underline;
}

.mdh-reviews-modal__attribution {
  font-family: 'Open Sans', sans-serif;
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

/* ── Body Scroll Lock ─────────────────────────── */
.mdh-body-scroll-lock {
  overflow: hidden !important;
}

/* ── Animations ───────────────────────────────── */
@keyframes mdh-modal-fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mdh-slide-fadein {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Reduced Motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mdh-reviews-modal--open,
  .mdh-reviews-modal__card--active,
  .mdh-hero-stars,
  .mdh-reviews-modal__dot {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Tablet (641px+) ──────────────────────────── */
@media (min-width: 641px) {
  .mdh-reviews-modal__title {
    font-size: 20px;
  }

  .mdh-reviews-modal__card-text {
    font-size: 16px;
  }
}

/* ── Desktop (1024px+) ────────────────────────── */
@media (min-width: 1024px) {
  .mdh-reviews-modal__dialog {
    max-height: 75vh;
  }

  .mdh-reviews-modal__header {
    padding: 28px 32px 18px;
  }

  .mdh-reviews-modal__carousel {
    padding: 24px 32px;
  }

  .mdh-reviews-modal__nav {
    padding: 14px 32px;
  }

  .mdh-reviews-modal__footer {
    padding: 14px 32px 20px;
  }
}
