/* Open Library Theme — 2026-08-30 v64
 * Global Select2 visual system for all public frontend <select> controls.
 */
:root{
  --ol64-red:#dc2636;
  --ol64-red-dark:#b91f2d;
  --ol64-red-soft:#fff4f5;
  --ol64-ink:#172133;
  --ol64-muted:#667085;
  --ol64-line:#d8dee7;
  --ol64-surface:#fff;
  --ol64-control-h:44px;
}

/* ---------- base Select2 container ---------- */
html body .select2-container{
  box-sizing:border-box!important;
  max-width:100%!important;
  min-width:0!important;
  font-family:"Plus Jakarta Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  font-size:13px!important;
  vertical-align:middle!important;
}
html body .select2-container .selection,
html body .select2-container .select2-selection{
  display:block!important;
  width:100%!important;
}
html body .select2-container--default .select2-selection--single{
  box-sizing:border-box!important;
  display:flex!important;
  align-items:center!important;
  width:100%!important;
  height:var(--ol64-control-h)!important;
  min-height:var(--ol64-control-h)!important;
  padding:0 42px 0 14px!important;
  overflow:hidden!important;
  border:1px solid var(--ol64-line)!important;
  border-radius:10px!important;
  background:var(--ol64-surface)!important;
  color:var(--ol64-ink)!important;
  box-shadow:none!important;
  transition:border-color .15s ease,box-shadow .15s ease,background .15s ease!important;
}
html body .select2-container--default .select2-selection--single .select2-selection__rendered{
  display:block!important;
  width:100%!important;
  min-width:0!important;
  padding:0!important;
  overflow:hidden!important;
  color:var(--ol64-ink)!important;
  font-size:13px!important;
  font-weight:500!important;
  line-height:calc(var(--ol64-control-h) - 2px)!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
html body .select2-container--default .select2-selection--single .select2-selection__placeholder{
  color:#8a94a4!important;
}
html body .select2-container--default .select2-selection--single .select2-selection__arrow{
  position:absolute!important;
  top:0!important;
  right:10px!important;
  width:24px!important;
  height:100%!important;
}
html body .select2-container--default .select2-selection--single .select2-selection__arrow b{
  top:50%!important;
  left:50%!important;
  width:7px!important;
  height:7px!important;
  margin:-5px 0 0 -4px!important;
  border:0!important;
  border-right:1.7px solid #667085!important;
  border-bottom:1.7px solid #667085!important;
  transform:rotate(45deg)!important;
  transition:transform .15s ease,margin .15s ease!important;
}
html body .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{
  margin:-1px 0 0 -4px!important;
  transform:rotate(225deg)!important;
}
html body .select2-container--default.select2-container--focus .select2-selection--single,
html body .select2-container--default.select2-container--open .select2-selection--single{
  border-color:var(--ol64-red)!important;
  box-shadow:0 0 0 3px rgba(220,38,54,.10)!important;
}
html body .select2-container--default.select2-container--disabled .select2-selection--single{
  background:#f3f4f6!important;
  color:#98a2b3!important;
  cursor:not-allowed!important;
}

/* ---------- multiple selects ---------- */
html body .select2-container--default .select2-selection--multiple{
  box-sizing:border-box!important;
  min-height:var(--ol64-control-h)!important;
  padding:5px 8px!important;
  border:1px solid var(--ol64-line)!important;
  border-radius:10px!important;
  background:#fff!important;
}
html body .select2-container--default.select2-container--focus .select2-selection--multiple{
  border-color:var(--ol64-red)!important;
  box-shadow:0 0 0 3px rgba(220,38,54,.10)!important;
}
html body .select2-container--default .select2-selection--multiple .select2-selection__choice{
  margin:2px 4px 2px 0!important;
  padding:4px 8px!important;
  border:1px solid #f1bfc4!important;
  border-radius:7px!important;
  background:var(--ol64-red-soft)!important;
  color:var(--ol64-red-dark)!important;
  font-size:11.5px!important;
  font-weight:700!important;
}
html body .select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
  margin-right:5px!important;
  color:var(--ol64-red-dark)!important;
}

/* ---------- dropdown panel ---------- */
html body .select2-container--open{
  z-index:10050!important;
}
html body .select2-dropdown{
  box-sizing:border-box!important;
  overflow:hidden!important;
  border:1px solid #efb6bc!important;
  border-radius:11px!important;
  background:#fff!important;
  box-shadow:0 16px 36px rgba(23,33,51,.16)!important;
  font-family:"Plus Jakarta Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  z-index:10060!important;
}
html body .select2-container--open .select2-dropdown--below{
  margin-top:6px!important;
  border-top:1px solid #efb6bc!important;
  border-radius:11px!important;
}
html body .select2-container--open .select2-dropdown--above{
  margin-top:-6px!important;
  border-bottom:1px solid #efb6bc!important;
  border-radius:11px!important;
}
html body .select2-search--dropdown{
  padding:9px!important;
  border-bottom:1px solid #eef0f3!important;
  background:#fff!important;
}
html body .select2-search--dropdown .select2-search__field{
  box-sizing:border-box!important;
  width:100%!important;
  height:38px!important;
  margin:0!important;
  padding:0 11px!important;
  border:1px solid #d8dee7!important;
  border-radius:8px!important;
  outline:0!important;
  background:#fff!important;
  color:var(--ol64-ink)!important;
  font-family:inherit!important;
  font-size:12.5px!important;
  box-shadow:none!important;
}
html body .select2-search--dropdown .select2-search__field:focus{
  border-color:var(--ol64-red)!important;
  box-shadow:0 0 0 3px rgba(220,38,54,.09)!important;
}
html body .select2-results{
  padding:5px!important;
}
html body .select2-results__options{
  max-height:285px!important;
}
html body .select2-results__option{
  margin:0!important;
  padding:9px 10px!important;
  border-radius:8px!important;
  color:#344054!important;
  font-size:12.5px!important;
  line-height:1.35!important;
}
html body .select2-container--default .select2-results__option[aria-selected=true]{
  background:#fff0f2!important;
  color:var(--ol64-red-dark)!important;
  font-weight:750!important;
}
html body .select2-container--default .select2-results__option--highlighted[aria-selected]{
  background:var(--ol64-red)!important;
  color:#fff!important;
}
html body .select2-results__option[aria-disabled=true]{
  color:#98a2b3!important;
}
html body .select2-results__message{
  color:var(--ol64-muted)!important;
}

/* clear button */
html body .select2-container--default .select2-selection--single .select2-selection__clear{
  position:relative!important;
  z-index:2!important;
  float:none!important;
  margin:0 8px 0 0!important;
  color:#98a2b3!important;
  font-size:17px!important;
  line-height:1!important;
}
html body .select2-container--default .select2-selection--single .select2-selection__clear:hover{
  color:var(--ol64-red)!important;
}

/* ---------- portal/search-specific sizing ---------- */
html body.openlib-site-index .openlib_discovery__form>.select2-container{
  width:100%!important;
  min-width:0!important;
}
html body.openlib-site-index .openlib_discovery__form>.select2-container .select2-selection--single{
  --ol64-control-h:52px;
  border-color:rgba(255,255,255,.78)!important;
  border-radius:12px!important;
}
html body .openlib_search_form__journal{
  overflow:visible!important;
}
html body .openlib_search_form__journal>.select2-container{
  width:100%!important;
  height:50px!important;
}
html body .openlib_search_form__journal>.select2-container .select2-selection--single{
  --ol64-control-h:50px;
  border:0!important;
  border-radius:11px!important;
}
html body .openlib_search_form__journal>.select2-container--focus .select2-selection--single,
html body .openlib_search_form__journal>.select2-container--open .select2-selection--single{
  box-shadow:inset 0 0 0 1px var(--ol64-red),0 0 0 3px rgba(220,38,54,.08)!important;
}

/* ---------- Advanced Search date controls ----------
 * Select2 injects a span after each hidden select. Place each generated control
 * explicitly so Year / Month / Day stay perfectly aligned.
 */
html body .openlib_search_advanced__dates fieldset>select.select2-hidden-accessible{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  min-width:0!important;
  min-height:0!important;
  margin:-1px!important;
  padding:0!important;
  overflow:hidden!important;
  clip:rect(0 0 0 0)!important;
  clip-path:inset(50%)!important;
  white-space:nowrap!important;
  border:0!important;
}
html body .openlib_search_advanced__dates fieldset>.select2-container{
  width:100%!important;
  min-width:0!important;
  grid-row:3!important;
  align-self:stretch!important;
}
html body .openlib_search_advanced__dates fieldset>.openlib-select2-date-year{grid-column:1!important;}
html body .openlib_search_advanced__dates fieldset>.openlib-select2-date-month{grid-column:2!important;}
html body .openlib_search_advanced__dates fieldset>.openlib-select2-date-day{grid-column:3!important;}
html body .openlib_search_advanced__dates fieldset>.select2-container .select2-selection--single{
  --ol64-control-h:42px;
  border-radius:9px!important;
}

/* ---------- validation ---------- */
html body select.openlib_invalid+.select2-container .select2-selection,
html body .select2-container.openlib_invalid .select2-selection{
  border-color:#dc2626!important;
  box-shadow:0 0 0 3px rgba(220,38,38,.09)!important;
}
html body .select2-container+.openlib_validation_error{
  display:block!important;
  margin-top:5px!important;
}

/* ---------- dark mode ---------- */
html[data-openlib-color-mode="dark"] body .select2-container--default .select2-selection--single,
html[data-openlib-color-mode="dark"] body .select2-container--default .select2-selection--multiple{
  border-color:#3b4655!important;
  background:#121923!important;
  color:#f2f4f7!important;
}
html[data-openlib-color-mode="dark"] body .select2-container--default .select2-selection--single .select2-selection__rendered{
  color:#f2f4f7!important;
}
html[data-openlib-color-mode="dark"] body .select2-container--default .select2-selection--single .select2-selection__placeholder{
  color:#8994a4!important;
}
html[data-openlib-color-mode="dark"] body .select2-container--default .select2-selection--single .select2-selection__arrow b{
  border-color:#aab4c2!important;
  border-top:0!important;
  border-left:0!important;
}
html[data-openlib-color-mode="dark"] body .select2-dropdown,
html[data-openlib-color-mode="dark"] body .select2-search--dropdown{
  border-color:#3b4655!important;
  background:#171e28!important;
}
html[data-openlib-color-mode="dark"] body .select2-search--dropdown{
  border-bottom-color:#313b48!important;
}
html[data-openlib-color-mode="dark"] body .select2-search--dropdown .select2-search__field{
  border-color:#3b4655!important;
  background:#0f1620!important;
  color:#f2f4f7!important;
}
html[data-openlib-color-mode="dark"] body .select2-results__option{
  color:#dbe1e8!important;
}
html[data-openlib-color-mode="dark"] body .select2-container--default .select2-results__option[aria-selected=true]{
  background:#2b1c21!important;
  color:#ff9ba4!important;
}
html[data-openlib-color-mode="dark"] body .select2-container--default .select2-results__option--highlighted[aria-selected]{
  background:#dc2636!important;
  color:#fff!important;
}
html[data-openlib-color-mode="dark"] body .select2-container--default.select2-container--disabled .select2-selection--single{
  background:#202733!important;
  color:#778292!important;
}

/* Search bar select remains light for visual consistency with the white fields. */
html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_discovery__form>.select2-container .select2-selection--single,
html[data-openlib-color-mode="dark"] body .openlib_search_form__journal>.select2-container .select2-selection--single{
  background:#fff!important;
  color:#344054!important;
}
html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_discovery__form>.select2-container .select2-selection__rendered,
html[data-openlib-color-mode="dark"] body .openlib_search_form__journal>.select2-container .select2-selection__rendered{
  color:#344054!important;
}

/* ---------- responsive ---------- */
@media(max-width:520px){
  html body .openlib_search_advanced__dates fieldset>.select2-container{
    grid-column:1!important;
    grid-row:auto!important;
  }
  html body .select2-dropdown{
    max-width:calc(100vw - 24px)!important;
  }
}
