/* Shared custom pickers (.portal-select) matching homepage search bar dropdowns. */
.portal-select {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 42px;
}

.portal-select > select.portal-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}

.portal-select-trigger {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  color: var(--ink-primary);
  font: 400 13px var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.portal-select-trigger::after {
  content: '';
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  color: var(--ink-muted);
  transition: transform 0.15s;
}

.portal-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-select-trigger:hover {
  border-color: var(--ink-faint);
}

.portal-select-trigger:focus {
  outline: none !important;
}

.portal-select-trigger:focus-visible {
  outline: 2px solid var(--brand-navy, var(--brand-primary)) !important;
  outline-offset: 3px !important;
}

.portal-select.is-open > .portal-select-trigger {
  border-color: var(--brand-navy, var(--brand-primary));
  box-shadow: 0 0 0 3px var(--bg-canvas);
}

.portal-select.is-open > .portal-select-trigger::after {
  transform: translateY(2px) rotate(225deg);
}

.portal-select-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.portal-select:has(> select[aria-invalid="true"]) > .portal-select-trigger {
  border-color: var(--brand-cta);
}

.portal-select-options {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  padding: 6px;
  border: 1px solid var(--line-default);
  border-radius: 8px;
  background: var(--bg-paper);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--brand-navy, var(--brand-primary)) 14%, transparent),
              0 2px 6px color-mix(in srgb, var(--brand-navy, var(--brand-primary)) 4%, transparent);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  color: var(--ink-primary);
  font: 400 13px var(--font-sans);
  z-index: 10000;
}

.portal-select-options[hidden] {
  display: none;
}

.portal-select-option {
  position: relative;
  padding: 11px 34px 11px 12px;
  border-radius: 4px;
  line-height: 1.4;
  cursor: pointer;
  white-space: normal;
}

.portal-select-option[aria-selected="true"] {
  font-weight: 600;
  background: var(--bg-canvas);
}

.portal-select-option[aria-selected="true"]::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 5px;
  height: 9px;
  border-right: 1.7px solid var(--brand-navy, var(--brand-primary));
  border-bottom: 1.7px solid var(--brand-navy, var(--brand-primary));
  transform: translateY(-65%) rotate(45deg);
}

.portal-select-option.is-active,
.portal-select-option:hover {
  background: var(--bg-canvas);
}

.portal-select-option[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Panel & landing form integration */
.admin-field .portal-select,
.admin-form .portal-select,
.admin-dialog .portal-select {
  height: calc(var(--space-8) + var(--space-3));
}

.admin-toolbar .portal-select {
  width: auto;
  min-width: calc(var(--section-gap-lg) * 2);
  height: calc(var(--space-8) + var(--space-3));
}

.newsletter-form-grid .portal-select {
  height: 44px;
}

.newsletter-form-grid .portal-select-trigger {
  font-size: 14px;
}

@media (max-width: 991px) {
  .portal-select > .portal-select-trigger,
  .newsletter-form-grid .portal-select > .portal-select-trigger {
    font-size: 16px;
  }

  .portal-select-option {
    min-height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
  }
}

@media (max-width: 768px) {
  .admin-toolbar .portal-select {
    flex: 1 1 100%;
    width: 100%;
  }
}
