/* ==========================================================
   ITP Google Reviews — Optimized CSS (Bootstrap 5.3 friendly)
   - Mobile-first; desktop overrides ≥992px
   - Desktop carousel „CLIP“: judėjimas tik konteinerio viduje
   ========================================================== */

/* ==========================================================
   CSS variables
   ========================================================== */
:root {
  --itp-radius: 18px;
  --itp-border: #e9ecef;
  --itp-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  --itp-muted: #212529;
  --itp-star: #ffd54d;

  /* Desktop tuning */
  --gr-gap: 24px;
  --gr-font: 13px;
  --gr-height: 260px; /* vienodas kortelių aukštis desktop’e */
}

/* ==========================================================
   Base layout
   ========================================================== */
.itp-gr {
  border-radius: var(--itp-radius);
  background: #fbfbfb;
  padding: 16px 12px;
}

/* Summary */
.itp-gr-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.itp-gr-stars {
  font-size: 1.05rem;
  line-height: 1;
  color: var(--itp-star);
}

.itp-gr-count,
.itp-gr-powered {
  color: var(--itp-muted);
  opacity: 1;
}

.itp-gr-powered {
  margin-left: auto;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Mode visibility (mobile-first) */
.itp-gr-mobile {
  display: block;
}
.itp-gr-desktop {
  display: none;
}

/* ==========================================================
   Card (shared)
   ========================================================== */
.itp-gr .itp-gr-card {
  display: flex;
  height: 100%;
  border: 1px solid #eef2f6;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(18, 38, 63, 0.06);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.itp-gr .itp-gr-card:hover {
  box-shadow: 0 14px 36px rgba(18, 38, 63, 0.12);
  transform: translateY(-2px);
}

.itp-gr .itp-gr-card .card-body {
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
}

/* Helpers */
.itp-gr-star {
  display: inline-block;
  color: var(--itp-star);
}

/* Jei Bootstrap pritaiko per pilką text-muted – šiame widgete suvienodinam */
.itp-gr .text-muted,
.itp-gr .text-muted.small {
  color: var(--itp-muted);
}

/* Review text clamp */
.itp-gr .itp-gr-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-height: 1.6;
  overflow: hidden;
  margin: 6px 0 14px;
}

/* Read more */
.itp-gr a.itp-gr-readmore {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--itp-border);
}

.itp-gr a.itp-gr-readmore:hover {
  background: #f8f9fa;
}

.itp-gr a.itp-gr-readmore:focus {
  outline: 2px solid #9ec5fe;
  outline-offset: 2px;
}

/* Chips (optional tags) */
.itp-gr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 8px;
}

.itp-gr-chip {
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #f3f6fb;
  border: 1px solid #e7edf6;
  color: #394a6d;
  white-space: nowrap;
}

/* ==========================================================
   Carousel controls (shared)
   ========================================================== */
.itp-gr .carousel-control-prev,
.itp-gr .carousel-control-next {
  width: 44px;
  height: 44px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: 1px solid #eaeef2;
  border-radius: 9999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  opacity: 1;
  z-index: 5;
}

.itp-gr .carousel-control-prev-icon,
.itp-gr .carousel-control-next-icon {
  filter: invert(45%) brightness(70%);
  background-size: 60% 60%;
}

/* Mobile carousel spacing */
.itp-gr-mobile .carousel-item {
  padding: 8px 0;
}

.itp-gr-mobile .container-fluid {
  padding-left: 0;
  padding-right: 0;
}

.itp-gr-mobile .row {
  margin: 0;
}

.itp-gr-mobile .row > [class^="col"] {
  padding-left: 12px;
  padding-right: 12px;
}

/* ==========================================================
   Mobile / Tablet (≤991.98px)
   ========================================================== */
@media (max-width: 991.98px) {
  /* Išorinio rėmelio nuėmimas, arčiau kraštų */
  .itp-gr {
    border: 0;
    background: transparent;
    padding: 0;
  }

  .itp-gr-summary {
    margin: 0 12px 8px;
    padding-bottom: 0;
    border-bottom: 0;
  }

  /* Arrows positions (mobile/tablet) */
  .itp-gr-mobile .carousel-control-prev {
    left: -12px;
  }
  .itp-gr-mobile .carousel-control-next {
    right: -12px;
  }
}

/* Phones (<576px): 1 kortelė per skaidrę */
@media (max-width: 575.98px) {
  .itp-gr .itp-gr-mobile .carousel-item .col-sm-6:nth-child(n + 2) {
    display: none !important;
  }

  /* stabilus aukštis */
  .itp-gr .itp-gr-mobile .card.itp-gr-card .card-body {
    min-height: 300px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
  }
}

/* Tablet (576–991.98px): 2 kortelės per skaidrę, centruota */
@media (min-width: 576px) and (max-width: 991.98px) {
  .itp-gr .itp-gr-mobile .carousel-item > .container-fluid {
    max-width: 860px;
    margin: 0 auto;
    padding-left: 8px;
    padding-right: 8px;
  }

  .itp-gr .itp-gr-mobile .carousel-item .row {
    justify-content: center;
    --bs-gutter-x: 16px;
    --bs-gutter-y: 16px;
  }

  .itp-gr .itp-gr-mobile .carousel-item .col-sm-6 {
    flex: 0 0 auto;
    width: 50%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .itp-gr .itp-gr-mobile .card.itp-gr-card .card-body {
    max-height: 300px;
  }
}

/* ==========================================================
   Desktop (≥992px) — 3 kortelės per skaidrę, CLIP režimas
   ========================================================== */
@media (min-width: 992px) {
  .itp-gr-desktop {
    display: block;
  }
  .itp-gr-mobile {
    display: none;
  }

  /* vizualas (Hostinger-like) */
  .itp-gr-desktop .google_card_slide {
    font-size: var(--gr-font);
    background: #fff;
    border: 1px solid #f1f3f5;
    border-radius: 16px;
    box-shadow: var(--itp-shadow);
    padding: 18px;
  }

  .itp-gr-desktop .itp-gr-card {
    min-height: var(--gr-height) !important;
    height: var(--gr-height) !important;
    box-shadow: none;
  }

  .itp-gr-desktop .itp-gr-card .card-body {
    padding: 15px;
    height: 100%;
  }

  /* avatarų desktop'e nereikia */
  .itp-gr-desktop .rounded-circle {
    display: none !important;
  }

  /* trumpesnis tekstas desktop’e */
  .itp-gr-desktop .itp-gr-text {
    -webkit-line-clamp: 4;
    max-height: calc(1.6em * 4);
    margin: 8px 0 10px;
  }

  /* „ghost“ read more (underline) */
  .itp-gr-desktop a.itp-gr-readmore {
    padding: 0;
    border: 0;
    border-radius: 0;
    font-size: 0.93rem;
    text-decoration: underline;
    color: inherit;
    background: transparent;
  }

  .itp-gr-desktop a.itp-gr-readmore:hover {
    opacity: 0.8;
    background: transparent;
  }

  /* eilutės tarpai */
  .itp-gr .carousel .row.g-4 {
    row-gap: 24px;
  }

  /* CLIP: judame tik konteinerio viduje */
  .itp-gr-desktop.itp-gr-desktop-clip,
  .itp-gr-desktop.itp-gr-desktop-clip .carousel,
  .itp-gr-desktop.itp-gr-desktop-clip .carousel-inner,
  .itp-gr-desktop.itp-gr-desktop-clip .carousel-item {
    overflow: hidden !important;
  }

  .itp-gr-desktop.itp-gr-desktop-clip {
    position: relative;
    margin-bottom: 8px;
    z-index: 1;
  }

  .itp-gr-desktop.itp-gr-desktop-clip .carousel-inner {
    padding: 0;
  }

  .itp-gr-desktop.itp-gr-desktop-clip .carousel-item {
    transition: transform 0.6s ease;
    backface-visibility: hidden;
    will-change: transform;
  }

  /* Arrows positions (desktop) */
  .itp-gr .carousel-control-prev {
    left: -8px;
  }
  .itp-gr .carousel-control-next {
    right: -8px;
  }
}

/* ==========================================================
   Google profile footer
   ========================================================== */
.google-profile__footer {
  text-align: center;
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.google-profile__badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
}

.google-profile__badge svg {
  display: block;
}

.google-profile__text {
  font-size: 0.95rem;
  line-height: 1.2;
  color: #202124;
}

/* ==========================================================
   Links in reviews-section (Lighthouse / kontrastas)
   - nekeičiame .itp-gr-readmore desktop'e, nes jis "inherit"
   ========================================================== */

.reviews-section .itp-gr :is(a:hover, a:focus-visible):not(.itp-gr-readmore) {
  color: #084298 !important;
}

/* ==========================================================
   Dark mode (data-bs-theme="dark" arba data-theme="dark")
   ========================================================== */
:where([data-bs-theme="dark"], [data-theme="dark"]) {
  --itp-border: #273244;
  --itp-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --itp-muted: #94a3b8;
  --itp-star: #fbbf24;
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr {
  background: #0b1220;
  color: #e5e7eb;
  border-color: transparent;
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr a {
  color: #6ea8fe;
}
:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr a:hover {
  color: #bfdbfe;
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr-powered,
:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr-count {
  color: #dee2e6;
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr .itp-gr-card {
  background: #0b1220;
  border-color: #1c2940;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr .itp-gr-card:hover {
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .itp-gr .itp-gr-text {
  color: #dbeafe;
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .google-profile__badge {
  background: rgba(255, 255, 255, 0.05);
  border-color: #243244;
}

:where([data-bs-theme="dark"], [data-theme="dark"]) .google-profile__text {
  color: #e5e7eb;
}

@media (min-width: 992px) {
  :where([data-bs-theme="dark"], [data-theme="dark"])
    .itp-gr-desktop
    .google_card_slide {
    background: #0f172a;
    border-color: #1c2940;
    color: #e5e7eb;
    box-shadow: var(--itp-shadow);
  }

  :where([data-bs-theme="dark"], [data-theme="dark"])
    .itp-gr
    .carousel-control-prev,
  :where([data-bs-theme="dark"], [data-theme="dark"])
    .itp-gr
    .carousel-control-next {
    background: #0b1220;
    border-color: #1c2940;
  }
}

/* ==========================================================
   A11y / motion
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  .carousel {
    scroll-behavior: auto;
  }
}

.reviews-section .itp-gr :is(a, a:visited):not(.itp-gr-readmore) {
  color: #084298;
  opacity: 1;
  text-decoration-color: currentColor;
}

/* Dark override (toks pats specifiškumas, todėl laimi) */
:where([data-bs-theme="dark"], [data-theme="dark"])
  .reviews-section
  .itp-gr
  :is(a, a:visited):not(.itp-gr-readmore) {
  color: #6ea8fe;
}

/* Dark hover/focus */
:where([data-bs-theme="dark"], [data-theme="dark"])
  .reviews-section
  .itp-gr
  :is(a:hover, a:focus-visible):not(.itp-gr-readmore) {
  color: #bfdbfe;
}

/* Reviews: sutvarkom link kontrastą + aiškumą */
.reviews-section a {
  color: color-mix(
    in srgb,
    var(--accent) 70%,
    #000
  ); /* patamsina accent -> geresnis kontrastas */
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

/* jei kažkur uždėtas .text-decoration-none (pvz. pluginas) */
.reviews-section a.text-decoration-none {
  text-decoration: underline !important;
}

/* hover */
.reviews-section a:hover {
  color: color-mix(in srgb, var(--accent) 60%, #000);
}

/* keyboard focus */
.reviews-section a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

/* dark mode: ten galima leisti šviesesnį variantą */
[data-bs-theme="dark"] .reviews-section a {
  color: color-mix(in srgb, var(--accent) 85%, #fff);
}
[data-bs-theme="dark"] .reviews-section a:hover {
  color: color-mix(in srgb, var(--accent) 70%, #fff);
}
