/**
 * KSquare Gems - Trust Bar Styles
 * Trust indicators strip below the header
 *
 * @package Onviqa
 * @since 1.0.0
 */

/* ==========================================================================
   Trust Bar Container
   ========================================================================== */

.trust-bar {
  background: #f5f6fa;
  border: 1px solid #e6e9f0;
  height: 50px;
  width: 100%;
  position: sticky; /* Sticky - sticks below header */
  top: 70px; /* Sticks at 70px (header height) */
  z-index: 1000;
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.08);
}

.trust-bar__inner {
  width: 100%;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  /* Centered when items fit; falls back to flex-start when they overflow
	   so the first item is never clipped past the left edge */
  justify-content: center;
  justify-content: safe center;
  box-sizing: border-box;
  /* Top padding offsets the scrollbar gutter at the bottom so items stay
	   optically centered (bar height stays 50px for sticky offsets) */
  padding: 0px 40px;
  /* Horizontal scroll when items overflow */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #c4c9d6 transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Scrollbar - WebKit */
.trust-bar__inner::-webkit-scrollbar {
  height: 6px;
}

.trust-bar__inner::-webkit-scrollbar-track {
  background: transparent;
}

.trust-bar__inner::-webkit-scrollbar-thumb {
  background: #c4c9d6;
  border-radius: 3px;
}

.trust-bar__inner::-webkit-scrollbar-thumb:hover {
  background: #a8aebf;
}

.trust-bar__items {
  display: flex;
  align-items: center;
  gap: 60px;
  /* Never shrink - let the inner container scroll instead */
  flex: 0 0 auto;
}

/* ==========================================================================
   Marquee - only active when the items overflow
   JS adds .is-marquee (and duplicates the items) when scrollWidth exceeds
   clientWidth. Without the class this block does nothing, so the bar stays
   centered and static whenever everything already fits.
   ========================================================================== */

.trust-bar__inner.is-marquee {
  /* The animation does the scrolling - no manual scrollbar needed */
  overflow: hidden;
  justify-content: flex-start;
  scrollbar-width: none;
}

.trust-bar__inner.is-marquee::-webkit-scrollbar {
  display: none;
}

.trust-bar__inner.is-marquee .trust-bar__items {
  /* --marquee-distance = width of one copy + one gap, set by JS.
     Translating by exactly that distance makes the loop seamless. */
  animation: trust-bar-marquee var(--marquee-duration, 30s) linear infinite;
  will-change: transform;
}

/* Pause on hover/focus so items stay clickable */
.trust-bar__inner.is-marquee:hover .trust-bar__items,
.trust-bar__inner.is-marquee:focus-within .trust-bar__items {
  animation-play-state: paused;
}

@keyframes trust-bar-marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(var(--marquee-distance, 0px) * -1));
  }
}

/* The duplicated set is decorative - hide it from screen readers */
.trust-bar__items[aria-hidden="true"] {
  pointer-events: none;
}

/* ==========================================================================
   Trust Bar Items
   ========================================================================== */

/* Trust Bar Item - Figma: gap 12px between icon and text */
.trust-bar__item {
  display: inline-flex;
  align-items: center;
  gap: 12px; /* Figma: gap 12px */
  color: #111111;
  font-family: "Roboto Flex", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 19px; /* Figma: line-height 19px */
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.2s ease;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

a.trust-bar__item:hover,
a.trust-bar__item:focus,
button.trust-bar__item:hover,
button.trust-bar__item:focus {
  color: #ff6b35;
  text-decoration: none;
}

a.trust-bar__item:focus-visible,
button.trust-bar__item:focus-visible {
  outline: 2px solid #ff6b35;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==========================================================================
   Trust Bar Icons
   ========================================================================== */

.trust-bar__icon {
  display: flex;
  width: 24px;
  height: 24px;
  padding: 2px 2.502px 2px 2.498px;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.trust-bar__icon svg {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  min-height: 24px;
  color: #666666;
}

/* ==========================================================================
   Trust Bar Text
   ========================================================================== */

.trust-bar__text {
  display: inline-block;
}

/* ==========================================================================
   Rating Item - Stars & Text - Figma: TrustScore 4.5
   ========================================================================== */

/* Figma: Frame 1410087167 */
.trust-bar__item--rating {
  gap: 12px; /* Figma: gap 12px */
}

/* Figma: TrustScore stars container, gap 2px */
.trust-bar__stars {
  display: inline-flex !important;
  align-items: center;
  gap: 2px; /* Figma: gap 2px */
  visibility: visible !important;
  opacity: 1 !important;
}

/* Figma: Star badge 20x20px, background #219653 */
.trust-bar__star-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background-color: #219653; /* Figma: #219653 */
  border-radius: 0; /* Figma: no border-radius shown */
  visibility: visible !important;
  opacity: 1 !important;
}

/* Figma: Star shape 14x14px white */
.trust-bar__star-badge svg {
  width: 14px !important;
  height: 14px !important;
  color: #ffffff !important;
  fill: #ffffff !important;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.trust-bar__star-badge svg path,
.trust-bar__star-badge svg polygon {
  fill: #ffffff !important;
  stroke: none !important;
}

/* Figma: Rating text, font-size 16px, line-height 19px, color #111111 */
.trust-bar__rating-text {
  display: inline-block;
  color: #111111;
  font-size: 16px;
  line-height: 19px;
}

.trust-bar__rating-text strong {
  font-weight: 700;
}

.trust-bar__rating-value {
  font-weight: 500;
}

/* ==========================================================================
   Responsive - Tablet
   ========================================================================== */

@media (max-width: 1400px) {
  .trust-bar__items {
    gap: 40px;
  }
}

@media (max-width: 1200px) {
  .trust-bar__items {
    gap: 30px;
  }

  .trust-bar__item {
    font-size: 15px;
    gap: 10px;
  }

  .trust-bar__icon svg {
    width: 18px !important;
    height: 18px !important;
  }

  .trust-bar__star-badge {
    width: 18px;
    height: 18px;
  }

  .trust-bar__star-badge svg {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 1024px) {
  .trust-bar__items {
    gap: 24px;
  }

  .trust-bar__item {
    font-size: 14px;
  }
}

/* ==========================================================================
   Responsive - Mobile (Horizontal Scroll)
   ========================================================================== */

@media (max-width: 768px) {
  /* Hide trust bar completely on mobile for all pages */
  .trust-bar {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .trust-bar__item {
    font-size: 11.5px;
  }

  .trust-bar__stars {
    gap: 2px;
  }

  .trust-bar__star-badge {
    width: 13px;
    height: 13px;
  }

  .trust-bar__star-badge svg {
    width: 7px;
    height: 7px;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .trust-bar {
    display: none !important;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .trust-bar__item {
    transition: none;
  }

  .trust-bar__items {
    scroll-behavior: auto;
  }

  /* Stop the marquee and fall back to manual horizontal scrolling */
  .trust-bar__inner.is-marquee {
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .trust-bar__inner.is-marquee::-webkit-scrollbar {
    display: block;
  }

  .trust-bar__inner.is-marquee .trust-bar__items {
    animation: none;
  }

  /* The duplicate set is redundant without the animation */
  .trust-bar__items[aria-hidden="true"] {
    display: none;
  }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
  .trust-bar {
    border-bottom-width: 2px;
  }

  .trust-bar__item {
    color: #000000;
  }

  .trust-bar__star-badge {
    background-color: #006600;
  }
}
