/**
 * RFH Scrolling Tabs Component (rst-*)
 * Self-contained styles for horizontally scrollable tab navigation.
 * Prefix "rst-" avoids conflicts with existing project styles.
 */

/* --------------------------------------------------------------------------
   Main container
   -------------------------------------------------------------------------- */
.rst-tabs {
  margin-top: 2rem;
}

/* --------------------------------------------------------------------------
   Tab navigation bar: arrows + scrollable tab list
   -------------------------------------------------------------------------- */
.rst-tabs__nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

/* Scrollable tab list wrapper */
.rst-tabs__scroll-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Tab list – single row, no wrap, horizontal scroll */
.rst-tabs__list {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.25rem 0;
}

/* Center tabs when all items fit within the viewport */
.rst-tabs__list--fits {
  justify-content: center;
}

.rst-tabs__list::-webkit-scrollbar {
  display: none;
}

/* --------------------------------------------------------------------------
   Individual tab buttons
   -------------------------------------------------------------------------- */
.rst-tabs__tab {
  flex: 0 0 auto;
  white-space: nowrap;
  border: none;
  background: transparent;
  color: #1a1a1a;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 0.625rem 1.25rem;
  border-radius: 2rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.rst-tabs__tab:hover {
  color: #185c80;
}

/* Active tab – pill style matching reference design */
.rst-tabs__tab[aria-selected="true"] {
  background-color: #185c80;
  color: #ffffff;
}

.rst-tabs__tab[aria-selected="true"]:hover {
  color: #ffffff;
}

/* Visible focus indicator (WCAG 2.2 AA) */
.rst-tabs__tab:focus {
  outline: none;
}

.rst-tabs__tab:focus-visible {
  outline: 3px solid #185c80;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Scroll arrow buttons
   -------------------------------------------------------------------------- */
.rst-tabs__arrow {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid #1a1a1a;
  border-radius: 50%;
  background: #ffffff;
  color: #1a1a1a;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  padding: 0;
}

.rst-tabs__arrow:hover:not(:disabled) {
  background-color: #f5f5f5;
  border-color: #185c80;
  color: #185c80;
}

.rst-tabs__arrow:focus {
  outline: none;
}

.rst-tabs__arrow:focus-visible {
  outline: 3px solid #185c80;
  outline-offset: 2px;
}

.rst-tabs__arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.rst-tabs__arrow-icon {
  display: block;
  width: 0.5rem;
  height: 0.5rem;
  border-style: solid;
  border-color: currentColor;
  border-width: 0 2px 2px 0;
}

.rst-tabs__arrow--prev .rst-tabs__arrow-icon {
  transform: rotate(135deg);
  margin-left: 0.15rem;
}

.rst-tabs__arrow--next .rst-tabs__arrow-icon {
  transform: rotate(-45deg);
  margin-right: 0.15rem;
}

/* --------------------------------------------------------------------------
   Tab panels
   -------------------------------------------------------------------------- */
.rst-tabs__panels {
  position: relative;
}

.rst-tabs__panel {
  display: none;
}

.rst-tabs__panel--active {
  display: block;
}

.rst-tabs__panel[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Responsive adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .rst-tabs__nav {
    gap: 0.5rem;
    margin-bottom: 2rem;
  }

  .rst-tabs__tab {
    font-size: 0.9375rem;
    padding: 0.5rem 1rem;
  }

  .rst-tabs__arrow {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (max-width: 575.98px) {
  .rst-tabs__nav {
    gap: 0.375rem;
  }

  .rst-tabs__tab {
    font-size: 0.875rem;
    padding: 0.4375rem 0.875rem;
  }

  .rst-tabs__arrow {
    width: 2rem;
    height: 2rem;
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .rst-tabs__list {
    scroll-behavior: auto;
  }

  .rst-tabs__tab,
  .rst-tabs__arrow {
    transition: none;
  }
}
