/**
 * YOOAdmin — Auto-Archive Delay custom dropdown (scoped component).
 * Loaded on settings (notifications tab) and legacy notification settings screen.
 */

/* -------------------------------------------------------------------------
 * Trigger
 * ------------------------------------------------------------------------- */
.yp-ui-select {
  position: relative;
  display: inline-block;
  width: min(var(--yp-settings-select-width, 420px), 100%);
  max-width: 100%;
  box-sizing: border-box;
  vertical-align: middle;
  --yp-ads-primary: var(--yooadmin-primary, #eda934);
  --yp-ads-border: rgba(15, 23, 42, 0.12);
  --yp-ads-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  /* Global compact sizing — override locally only when a screen truly needs more height */
  --yp-select-trigger-padding: 6px 10px;
  --yp-select-trigger-min-height: 32px;
  --yp-select-option-padding: 6px 10px;
  --yp-select-drop-padding: 4px;
}

.yp-ui-select .yp-custom-select__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: var(--yp-select-trigger-min-height);
  padding: var(--yp-select-trigger-padding);
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #1e293b;
  text-align: start;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--yp-ads-border);
  border-radius: 10px;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.yp-ui-select.is-disabled .yp-custom-select__trigger,
.yp-ui-select .yp-custom-select__trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.yp-ui-select .yp-custom-select__option.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.yp-ui-select .yp-custom-select__trigger:hover {
  border-color: color-mix(in srgb, var(--yp-ads-primary) 45%, var(--yp-ads-border));
}

.yp-ui-select.is-open .yp-custom-select__trigger {
  border-color: var(--yp-ads-primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--yp-ads-primary) 14%, transparent);
}

.yp-ui-select .yp-custom-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yp-ui-select .yp-custom-select__chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  font-size: 18px;
  line-height: 1;
  color: #64748b;
  transition: transform 0.18s ease, color 0.15s ease;
}

.yp-ui-select.is-open .yp-custom-select__chevron {
  transform: rotate(180deg);
  color: var(--yp-ads-primary);
}

[dir="rtl"] .yp-ui-select.is-open .yp-custom-select__chevron {
  transform: rotate(-180deg);
}

/* -------------------------------------------------------------------------
 * Dropdown panel
 * ------------------------------------------------------------------------- */
.yp-ui-select .yp-custom-select__drop {
  position: absolute;
  z-index: 100050;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  /* At least as wide as the trigger, but grow to fit the widest option (e.g. status filters). */
  min-width: 100%;
  width: max-content;
  max-width: min(var(--yp-settings-select-width, 420px), calc(100vw - 48px));
  max-height: min(280px, 50vh);
  margin: 0;
  padding: var(--yp-select-drop-padding);
  list-style: none;
  background: #fff;
  border: 1px solid var(--yp-ads-border);
  border-radius: 12px;
  box-shadow: var(--yp-ads-shadow);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.22) transparent;
}

/* Thin, neutral scrollbar (Apple-like) */
.yp-ui-select .yp-custom-select__drop::-webkit-scrollbar {
  width: 6px;
}

.yp-ui-select .yp-custom-select__drop::-webkit-scrollbar-track {
  background: transparent;
}

.yp-ui-select .yp-custom-select__drop::-webkit-scrollbar-thumb {
  background-color: rgba(15, 23, 42, 0.2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.yp-ui-select .yp-custom-select__drop::-webkit-scrollbar-thumb:hover {
  background-color: rgba(15, 23, 42, 0.32);
}

html[data-yooadmin-studio-color-mode-effective='dark'] .yp-ui-select .yp-custom-select__drop,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark'] .yp-ui-select .yp-custom-select__drop {
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

html[data-yooadmin-studio-color-mode-effective='dark'] .yp-ui-select .yp-custom-select__drop::-webkit-scrollbar-thumb,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__drop::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.26);
}

html[data-yooadmin-studio-color-mode-effective='dark'] .yp-ui-select .yp-custom-select__drop::-webkit-scrollbar-thumb:hover,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__drop::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.38);
}

[dir="rtl"] .yp-ui-select .yp-custom-select__drop {
  left: auto;
  right: 0;
}

.yp-ui-select .yp-custom-select__option {
  margin: 0;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}

.yp-ui-select .yp-custom-select__option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: var(--yp-select-option-padding);
  border-radius: 8px;
  transition: background 0.12s ease;
}

.yp-ui-select .yp-custom-select__option-main {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.yp-ui-select .yp-custom-select__option-group {
  margin: 0;
  padding: 8px 12px 4px;
  list-style: none;
  pointer-events: none;
}

.yp-ui-select .yp-custom-select__option-group-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.yp-ui-select .yp-custom-select__option-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  color: #7c4a03;
  background: color-mix(in srgb, var(--yp-ads-primary) 18%, #fff);
  border: 1px solid color-mix(in srgb, var(--yp-ads-primary) 35%, #fff);
}

.yp-ui-select .yp-custom-select__option:hover .yp-custom-select__option-row,
.yp-ui-select .yp-custom-select__option:focus .yp-custom-select__option-row {
  background: color-mix(in srgb, var(--yp-ads-primary) 10%, #fff);
}

.yp-ui-select .yp-custom-select__option.is-selected .yp-custom-select__option-row {
  background: color-mix(in srgb, var(--yp-ads-primary) 14%, #fff);
}

.yp-ui-select .yp-custom-select__drop:has(.yp-custom-select__option:hover)
  .yp-custom-select__option.is-selected:not(:hover)
  .yp-custom-select__option-row,
.yp-ui-select .yp-custom-select__drop:has(.yp-custom-select__option:focus)
  .yp-custom-select__option.is-selected:not(:focus)
  .yp-custom-select__option-row {
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .yp-ui-select .yp-custom-select__trigger,
  .yp-ui-select .yp-custom-select__chevron,
  .yp-ui-select .yp-custom-select__option-row {
    transition: none;
  }
}

.yp-ui-select select.yp-custom-select__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background: none !important;
  min-height: 0 !important;
}

/* Placeholder row (e.g. “Bulk actions”) — no light “selected” pill in the list */
.yp-ui-select .yp-custom-select__option.is-placeholder .yp-custom-select__option-row {
  background: transparent;
}

.yp-ui-select .yp-custom-select__option.is-placeholder .yp-custom-select__option-main {
  color: #64748b;
  font-weight: 500;
}

.yp-ui-select .yp-custom-select__option.is-disabled:not(.is-placeholder) .yp-custom-select__option-main {
  opacity: 0.55;
}

/* Bulk / tablenav — keep select + Apply on one row (yp-ui-select defaults to block width:100%) */
:is(.yoo-plugins-bulk-bar, .yoo-bulk-actions-bar, .yoo-bulk-actions-left)
  :is(.alignleft.actions, &.yoo-bulk-actions-left),
.tablenav .alignleft.actions.bulkactions,
.tablenav.top .alignleft.actions,
.tablenav.bottom .alignleft.actions {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  float: none !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

:is(.yoo-plugins-bulk-bar, .yoo-bulk-actions-bar, .tablenav) .alignleft.actions .yp-ui-select,
.yoo-bulk-actions-right .yp-ui-select {
  width: auto !important;
  flex: 0 1 auto !important;
  min-width: 160px;
  max-width: min(var(--yp-settings-select-width, 280px), 46vw);
}

:is(.yoo-plugins-bulk-bar, .yoo-bulk-actions-bar, .tablenav)
  .alignleft.actions
  :is(.button.action, input[type='submit'].button, .button),
.yoo-bulk-actions-right :is(.yp-yoo-btn, .button.action, input[type='submit'].button, .button) {
  flex: 0 0 auto !important;
  margin: 0 !important;
  float: none !important;
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: middle !important;
}

/* Posts/pages/categories — custom bulk bar uses .yoo-bulk-actions-right (not WP .alignleft.actions) */
.yoo-bulk-actions-right {
  display: inline-flex !important;
  flex-flow: row nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  width: auto !important;
  max-width: 100% !important;
}

/* Studio Hub dark mode — all yp-ui-select instances */
html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme) .yp-ui-select,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark'] .yp-ui-select {
  --yp-ads-border: rgba(255, 255, 255, 0.14);
  --yp-ads-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__trigger,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__trigger {
  color: var(--ysh-text, #cfd6e0) !important;
  background: #22262e !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: none !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__chevron,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__chevron {
  color: var(--ysh-muted, #9aa5b1) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__drop,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__drop {
  background: var(--ysh-card, #1a1d23) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__option-main,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__option-main {
  color: var(--ysh-text, #cfd6e0) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__option.is-placeholder
  .yp-custom-select__option-main,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__option.is-placeholder
  .yp-custom-select__option-main {
  color: var(--ysh-muted, #9aa5b1) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__option:hover
  .yp-custom-select__option-row,
html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__option:focus
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__option:hover
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__option:focus
  .yp-custom-select__option-row {
  background: rgba(255, 255, 255, 0.06) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-row {
  background: color-mix(in srgb, var(--ysh-brand, var(--yooadmin-primary, #eda934)) 14%, transparent) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-main,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-main {
  color: var(--ysh-heading, #e8ecf1) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-ui-select
  .yp-custom-select__option-group-label,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-ui-select
  .yp-custom-select__option-group-label {
  color: var(--ysh-muted, #9aa5b1) !important;
}

/* -------------------------------------------------------------------------
 * Portaled dropdown (appended to body) — cannot rely on .yp-ui-select ancestor
 * ------------------------------------------------------------------------- */
.yp-custom-select__drop.yp-custom-select__drop--portal {
  margin: 0;
  padding: 6px;
  list-style: none;
  pointer-events: auto;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
}

.yp-custom-select__drop--portal .yp-custom-select__option {
  margin: 0;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  pointer-events: auto;
}

.yp-custom-select__drop--portal .yp-custom-select__option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.yp-custom-select__drop--portal .yp-custom-select__option-main {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.yp-custom-select__drop--portal .yp-custom-select__option:hover .yp-custom-select__option-row,
.yp-custom-select__drop--portal .yp-custom-select__option:focus .yp-custom-select__option-row {
  background: rgba(15, 23, 42, 0.05);
}

.yp-custom-select__drop--portal .yp-custom-select__option.is-selected .yp-custom-select__option-row {
  background: color-mix(in srgb, var(--yooadmin-primary, #eda934) 12%, #fff);
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal {
  background: var(--ysh-card, #1a1d23) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal
  .yp-custom-select__option-main,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal
  .yp-custom-select__option-main {
  color: var(--ysh-text, #cfd6e0) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal
  .yp-custom-select__option:hover
  .yp-custom-select__option-row,
html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal
  .yp-custom-select__option:focus
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal
  .yp-custom-select__option:hover
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal
  .yp-custom-select__option:focus
  .yp-custom-select__option-row {
  background: rgba(255, 255, 255, 0.06) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-row {
  background: color-mix(in srgb, var(--ysh-brand, var(--yooadmin-primary, #eda934)) 14%, transparent) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-main,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal
  .yp-custom-select__option.is-selected
  .yp-custom-select__option-main {
  color: var(--ysh-heading, #e8ecf1) !important;
}

html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal:has(.yp-custom-select__option:hover)
  .yp-custom-select__option.is-selected:not(:hover)
  .yp-custom-select__option-row,
html:is([data-yooadmin-studio-color-mode-effective='dark'], .is-dark-theme)
  .yp-custom-select__drop--portal:has(.yp-custom-select__option:focus)
  .yp-custom-select__option.is-selected:not(:focus)
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal:has(.yp-custom-select__option:hover)
  .yp-custom-select__option.is-selected:not(:hover)
  .yp-custom-select__option-row,
html.yooadmin-studio-hub-html[data-yooadmin-studio-color-mode-effective='dark']
  .yp-custom-select__drop--portal:has(.yp-custom-select__option:focus)
  .yp-custom-select__option.is-selected:not(:focus)
  .yp-custom-select__option-row {
  background: transparent !important;
}
