/* Tabs component (Components::Tabs). Generic, used by the intensity tile,
   condition standards, cycles, programs, and the public demo. Loaded by every
   layout that renders the component (application + marketing). Mobile-first:
   a select on small screens, a segmented pill tablist on desktop.
   (.sr-only, used by the mobile select label, is provided by navigation.css.) */

/* Mobile dropdown - visible on small screens */
.tabs-mobile-select {
  display: block;
  margin-bottom: 1.5rem;
}

.tabs-mobile-select .form-select {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  background-color: white;
  color: var(--dark-gray);
  min-height: 44px; /* Touch-friendly */
}

.tabs-mobile-select .form-select:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-color: var(--primary-500);
}

/* Desktop tabs - hidden on mobile */
.tabs-nav {
  display: none;
}

/* Tab panels */
.tabs-content {
  margin-top: 1rem;
}

.tab-panel {
  display: block;
}

.tab-panel.hidden {
  display: none;
}

/* Desktop styles (>=768px). Basecoat-style tabs (segmented pill):
   https://basecoatui.com/components/tabs/ - the tablist is a rounded
   muted-background container with tab buttons inside; the active tab
   sits on top with a white background and a subtle shadow. */
@media (min-width: 768px) {
  /* Hide mobile dropdown on desktop */
  .tabs-mobile-select {
    display: none;
  }

  /* Show desktop tablist as a segmented pill */
  .tabs-nav {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 0.5rem;
    background-color: color-mix(in oklch, var(--medium-gray, #e5e7eb) 40%, var(--surface-white, #fff));
    margin-bottom: 1.25rem;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-button {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary, #6b7280);
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
  }

  .tab-button:hover {
    color: var(--text-primary, var(--dark-gray));
  }

  .tab-button:focus-visible {
    outline: 2px solid color-mix(in oklch, var(--primary-color) 40%, transparent);
    outline-offset: 1px;
  }

  .tab-button.active,
  .tab-button[aria-selected="true"] {
    color: var(--text-primary, var(--dark-gray));
    background-color: var(--surface-white, #fff);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.10), 0 1px 2px -1px rgb(0 0 0 / 0.10);
  }
}
