/*
 * Unified catalog selector
 *
 * This file is the only owner of catalog-selector geometry and interaction
 * styling. Product pages may style the mount container or set the public
 * custom properties below, but must not target internal catalog classes.
 */

/* Compact tablet catalog geometry stays with this component, not with its
   callers. Touch targets remain at least 44px in either orientation. */
html.layout-mobile:is(.device-small-tablet, .device-android-tablet)[data-layout-page="index"]:not(.layout-industrial) .learning-board-catalog-field {
  --learning-board-catalog-max-width: 560px;
  gap: 4px;
}

html.layout-mobile:is(.device-small-tablet, .device-android-tablet)[data-layout-page="index"]:not(.layout-industrial) .learning-board-catalog-field .learning-board-catalog-label {
  font-size: 13px;
  line-height: 1.4;
}

html.layout-mobile:is(.device-small-tablet, .device-android-tablet)[data-layout-page="index"]:not(.layout-industrial) .learning-board-catalog-field .learning-board-catalog-trigger {
  min-height: 44px;
  padding: 9px 64px 9px 12px;
  border-radius: 12px;
  font-size: 15px;
  box-shadow: none;
}

:root {
  --learning-board-catalog-accent: 14, 165, 233;
  --learning-board-catalog-ink: #0f172a;
  --learning-board-catalog-muted: #64748b;
  --learning-board-catalog-surface: 255, 255, 255;
  --learning-board-catalog-soft-surface: 240, 249, 255;
  --learning-board-catalog-max-width: 1120px;
}

.learning-board-catalog-field {
  width: min(100%, var(--learning-board-catalog-max-width));
  max-width: var(--learning-board-catalog-max-width);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  color: var(--learning-board-catalog-ink);
  font-family: inherit;
}

.learning-board-catalog-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.learning-board-catalog-field .learning-board-catalog-label {
  min-width: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--learning-board-catalog-label-color, var(--learning-board-catalog-ink));
  font: inherit;
  font-size: var(--learning-board-catalog-label-font-size, 15px);
  font-weight: var(--learning-board-catalog-label-font-weight, 800);
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

.learning-board-catalog-field .learning-board-catalog-label::before {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 999px;
  background: rgb(var(--learning-board-catalog-accent));
  box-shadow: 0 0 0 4px rgba(var(--learning-board-catalog-accent), 0.10);
}

.learning-board-catalog-field .learning-board-catalog-status {
  max-width: min(100%, 34rem);
  min-height: 0;
  margin: 0;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(var(--learning-board-catalog-accent), 0.16);
  border-radius: 999px;
  background: rgba(var(--learning-board-catalog-soft-surface), 0.94);
  color: rgba(var(--learning-board-catalog-accent), 0.92);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learning-board-catalog-field .learning-board-catalog-status[hidden] {
  display: none !important;
}

.learning-board-catalog-field .learning-board-catalog-status[data-kind='empty'] {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--learning-board-catalog-muted);
  white-space: normal;
  overflow: visible;
}

.learning-board-catalog-field .learning-board-catalog-select-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
}

.learning-board-catalog-field .learning-board-catalog-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.learning-board-catalog-field .learning-board-catalog-trigger {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: var(--learning-board-catalog-trigger-height, 50px);
  max-height: none;
  margin: 0;
  padding: var(--learning-board-catalog-trigger-padding, 11px 64px 11px 15px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid var(--learning-board-catalog-trigger-border-color, rgba(var(--learning-board-catalog-accent), 0.22));
  border-radius: var(--learning-board-catalog-trigger-radius, 14px);
  outline: none;
  background: rgba(var(--learning-board-catalog-surface), 0.98);
  color: var(--learning-board-catalog-ink);
  box-shadow: var(--learning-board-catalog-trigger-shadow,
    0 8px 22px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.92));
  font: inherit;
  font-size: var(--learning-board-catalog-trigger-font-size, 16px);
  font-weight: var(--learning-board-catalog-trigger-font-weight, 700);
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.learning-board-catalog-field .learning-board-catalog-trigger:hover:not(:disabled) {
  border-color: rgba(var(--learning-board-catalog-accent), 0.42);
  background: rgb(var(--learning-board-catalog-surface));
  box-shadow: var(--learning-board-catalog-trigger-hover-shadow,
    0 10px 26px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96));
}

.learning-board-catalog-field .learning-board-catalog-trigger:focus-visible,
.learning-board-catalog-field .learning-board-catalog-trigger[data-open='true'] {
  border-color: rgba(var(--learning-board-catalog-accent), 0.58);
  box-shadow:
    0 0 0 3px rgba(var(--learning-board-catalog-accent), 0.14),
    0 10px 26px rgba(15, 23, 42, 0.08);
}

.learning-board-catalog-field .learning-board-catalog-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}

.learning-board-catalog-field .learning-board-catalog-trigger-text {
  display: block;
  width: 100%;
  min-width: 0;
  white-space: var(--learning-board-catalog-trigger-text-white-space, normal);
  overflow: var(--learning-board-catalog-trigger-text-overflow, visible);
  text-overflow: var(--learning-board-catalog-trigger-text-ellipsis, clip);
  overflow-wrap: anywhere;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.learning-board-catalog-field .learning-board-catalog-trigger-text[data-empty='true'] {
  color: rgba(71, 85, 105, 0.76);
  font-weight: 650;
}

.learning-board-catalog-field .learning-board-catalog-clear {
  position: absolute;
  z-index: 2;
  right: 34px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: rgba(var(--learning-board-catalog-accent), 0.88);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.learning-board-catalog-field .learning-board-catalog-clear:hover,
.learning-board-catalog-field .learning-board-catalog-clear:focus-visible {
  color: rgb(var(--learning-board-catalog-accent));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.learning-board-catalog-field .learning-board-catalog-chevron {
  position: absolute;
  z-index: 2;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid rgba(var(--learning-board-catalog-accent), 0.78);
  border-bottom: 2px solid rgba(var(--learning-board-catalog-accent), 0.78);
  transform: rotate(45deg);
  transform-origin: center;
  pointer-events: none;
  transition: transform 160ms ease;
}

.learning-board-catalog-field .learning-board-catalog-select-wrap.is-open {
  z-index: 70;
}

/*
 * backdrop-filter / transform create isolated stacking contexts. While a
 * catalog is open, the component marks only those ancestor contexts so the
 * panel stays above later sibling cards without leaving the trigger's
 * coordinate system (important for industrial-screen scaling).
 */
.learning-board-catalog-open-layer {
  z-index: 2147482000 !important;
}

.learning-board-catalog-open-layer--static {
  position: relative !important;
}

.learning-board-catalog-field .learning-board-catalog-select-wrap.is-open .learning-board-catalog-chevron {
  margin-top: -2px;
  transform: rotate(225deg);
}

.learning-board-catalog-panel {
  position: absolute !important;
  inset: auto !important;
  top: calc(100% + 8px) !important;
  right: auto !important;
  bottom: auto !important;
  left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: var(--learning-board-catalog-panel-max-height, 360px) !important;
  margin: 0 !important;
  padding: 9px;
  overflow: hidden !important;
  border: 1px solid rgba(var(--learning-board-catalog-accent), 0.20);
  border-radius: 16px;
  background: rgba(var(--learning-board-catalog-surface), 0.99);
  color: var(--learning-board-catalog-ink);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.18),
    0 4px 14px rgba(var(--learning-board-catalog-accent), 0.10);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-sizing: border-box;
  z-index: 2147483000 !important;
}

.learning-board-catalog-panel[data-placement='top'] {
  top: auto !important;
  bottom: calc(100% + 8px) !important;
}

.learning-board-catalog-panel[hidden] {
  display: none !important;
}

.learning-board-catalog-panel .learning-board-catalog-search {
  appearance: none;
  width: 100%;
  min-height: 42px;
  margin: 0 0 8px;
  padding: 9px 12px;
  border: 1px solid rgba(var(--learning-board-catalog-accent), 0.20);
  border-radius: 11px;
  outline: none;
  background: rgba(var(--learning-board-catalog-soft-surface), 0.62);
  color: var(--learning-board-catalog-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  box-sizing: border-box;
}

.learning-board-catalog-panel .learning-board-catalog-search:focus {
  border-color: rgba(var(--learning-board-catalog-accent), 0.52);
  background: rgb(var(--learning-board-catalog-surface));
  box-shadow: 0 0 0 3px rgba(var(--learning-board-catalog-accent), 0.12);
}

.learning-board-catalog-panel .learning-board-catalog-list {
  max-height: max(96px, calc(var(--learning-board-catalog-panel-max-height, 360px) - 60px)) !important;
  padding: 0 2px 0 0;
  display: grid;
  gap: 3px;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.learning-board-catalog-panel .learning-board-catalog-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.learning-board-catalog-panel .learning-board-catalog-group-label {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 2px 0;
  padding: 8px 10px 6px;
  border-bottom: 1px solid rgba(var(--learning-board-catalog-accent), 0.10);
  background: rgba(var(--learning-board-catalog-surface), 0.97);
  color: rgba(var(--learning-board-catalog-accent), 0.96);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.3;
  letter-spacing: 0.04em;
}

.learning-board-catalog-panel .learning-board-catalog-option {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 9px 12px 9px calc(12px + var(--learning-board-catalog-indent, 0px));
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  outline: none;
  background: transparent;
  color: var(--learning-board-catalog-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.learning-board-catalog-panel .learning-board-catalog-option:hover,
.learning-board-catalog-panel .learning-board-catalog-option:focus-visible {
  border-color: rgba(var(--learning-board-catalog-accent), 0.20);
  background: rgba(var(--learning-board-catalog-soft-surface), 0.86);
}

.learning-board-catalog-panel .learning-board-catalog-option.is-selected,
.learning-board-catalog-panel .learning-board-catalog-option[aria-selected='true'] {
  border-color: rgba(var(--learning-board-catalog-accent), 0.32);
  background: rgba(var(--learning-board-catalog-accent), 0.10);
}

.learning-board-catalog-option-branch {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(var(--learning-board-catalog-accent), 0.80);
}

.learning-board-catalog-option-branch::before {
  content: '';
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background: rgba(var(--learning-board-catalog-accent), 0.06);
  box-sizing: border-box;
}

.learning-board-catalog-option[data-leaf='true'] .learning-board-catalog-option-branch::before {
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: currentColor;
}

.learning-board-catalog-option[data-depth]:not([data-depth='1']) .learning-board-catalog-option-branch::after {
  content: '';
  position: absolute;
  right: calc(100% + 4px);
  top: 50%;
  width: 8px;
  height: 1px;
  background: rgba(var(--learning-board-catalog-accent), 0.24);
}

.learning-board-catalog-panel .learning-board-catalog-option-main {
  min-width: 0;
  display: block;
  color: inherit;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.learning-board-catalog-panel .learning-board-catalog-option-check {
  min-width: 0;
  color: rgb(var(--learning-board-catalog-accent));
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.learning-board-catalog-panel .learning-board-catalog-empty {
  padding: 16px 12px;
  color: var(--learning-board-catalog-muted);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 720px) {
  .learning-board-catalog-field {
    --learning-board-catalog-max-width: 100%;
  }

  .learning-board-catalog-head {
    align-items: flex-start;
  }

  .learning-board-catalog-field .learning-board-catalog-label {
    font-size: 14px;
  }

  .learning-board-catalog-field .learning-board-catalog-trigger {
    min-height: 48px;
    padding-block: 10px;
    font-size: 15px;
  }

  .learning-board-catalog-panel {
    max-width: 100% !important;
    border-radius: 14px;
  }

  .learning-board-catalog-panel .learning-board-catalog-option {
    min-height: 46px;
    padding-block: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .learning-board-catalog-field .learning-board-catalog-trigger,
  .learning-board-catalog-field .learning-board-catalog-chevron,
  .learning-board-catalog-panel .learning-board-catalog-option {
    transition: none;
  }
}

/* Industrial typography is owned by this shared catalog component. */
@media screen {
html[data-layout-page="index"].layout-industrial:not(.layout-mobile) body .learning-board-catalog-field {
  font-size: var(--industrial-type-small);
}
html[data-layout-page="index"].layout-industrial:not(.layout-mobile) body .learning-board-catalog-field :is(.learning-board-catalog-label, .learning-board-catalog-trigger, .learning-board-catalog-option) {
  font-size: var(--industrial-type-small) !important;
  font-weight: 650;
}
}
