/*
 * Open Library Theme — dark native select visibility fix
 * 2026-08-28 v1
 *
 * Windows/Chromium can render the opened native <select> popup on a light
 * surface while inheriting the dark-theme select text colour. The result is
 * near-white option text on a white popup. Explicit option colours and
 * color-scheme keep the dropdown legible in both colour modes.
 */

/* Keep native option menus readable in light mode too. */
html body select option,
html body select optgroup {
  background-color: #FFFFFF !important;
  color: #0F172A !important;
}

html body select option:disabled {
  color: #64748B !important;
}

/* Dark mode: request the browser's dark native control palette and provide
   explicit fallback colours for browsers that honour option styling. */
html[data-openlib-color-mode="dark"] body select {
  color-scheme: dark !important;
  background-color: #0F172A !important;
  color: #F8FAFC !important;
}

html[data-openlib-color-mode="dark"] body select option,
html[data-openlib-color-mode="dark"] body select optgroup {
  background-color: #111827 !important;
  color: #F8FAFC !important;
}

html[data-openlib-color-mode="dark"] body select option:disabled {
  color: #94A3B8 !important;
}

/* Main portal publication selector — reinforce the same palette because this
   is the most visible selector and some Chromium builds style it separately. */
html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_discovery__form select,
html[data-openlib-color-mode="dark"] body.openlib-site-page .openlib_search_form__primary select {
  color-scheme: dark !important;
  background-color: #0F172A !important;
  border-color: #475569 !important;
  color: #F8FAFC !important;
}

html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_discovery__form select option,
html[data-openlib-color-mode="dark"] body.openlib-site-page .openlib_search_form__primary select option {
  background-color: #111827 !important;
  color: #F8FAFC !important;
}
