/*
  Searchable Wilaya / Baladiya dropdowns - chosen-container skin.

  This plugin has no order-form restyling feature - every value below is
  copied directly from the theme's own untouched CSS, so the searchable
  dropdown looks identical to a plain, unmodified Hanout <select>, with
  one deliberate exception: the closed-state text color. Confirmed
  against the theme's own codplugin.css, two of its rules already color
  .chosen-single gray - #codplugin-checkout .chosen-single { color:
  #919191; } (static), plus a Customizer-generated inline rule in
  customizer.php driven by the site's "Text color" setting (default
  #404040) - overridden to solid black below on request. !important is
  needed here because the Customizer rule is printed in a <style> block
  in <head> after this stylesheet, and while this selector already has
  more specificity than either theme rule (2 classes vs. their 1), the
  !important removes any doubt regardless of caching, minifier reordering,
  or whatever "Text color" happens to be set to in the Customizer.
  - #codplugin_state, #codplugin_city { border: 2px solid #bce0f7; height:
    50px; }, in inc/order-form/include/assets/css/codplugin.css.
  - border-radius: 3px; font-size: 14px; background-color: #fff, the
    generic select/input rule in the theme's own style.css.
  - #codplugin_woo_single_form select:valid { border: 2px solid #69bf29
    !important; } (also codplugin.css) - carried over below via the
    hidden source <select>'s own :valid state, which chosen does not
    interfere with (see the sibling-selector rule further down).

  Confirmed against the theme (inc/order-form/include/assets/chosen/
  chosen.jquery.min.js, v1.1.0): calling .chosen() on a <select> sets that
  <select> to display:none and inserts a new sibling right after it -
  <div class="chosen-container chosen-container-single"> - containing
  <a class="chosen-single"> (the visible closed-state box) and
  <div class="chosen-drop"> (search input + results list, shown while
  open, chosen toggles display/.chosen-container-active itself - no JS
  needed here for that part).
*/

#codplugin_woo_single_form select.hfe-ff-chosen-source {
    /* chosen() already sets display:none inline - this is only a safety
       net in case that inline style is ever stripped by a caching/
       minifying plugin that rewrites inline attributes. */
    display: none !important;
}

#codplugin_woo_single_form .chosen-container {
    display: block;
    position: relative;
    width: 100% !important;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
}

#codplugin_woo_single_form .chosen-container .chosen-single {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    width: 100%;
    height: 50px;
    line-height: normal;
    padding: 0;
    padding-inline-start: 12px;
    padding-inline-end: 32px;
    border: 2px solid #bce0f7;
    border-radius: 3px;
    background: #fff !important;
    box-shadow: none;
    color: #000 !important;
    cursor: pointer;
    transition: border-color .15s ease;
}

/* Matches #codplugin_woo_single_form select:valid { border: 2px solid
   #69bf29 !important; } in codplugin.css - the hidden source <select>'s
   own :valid state is unaffected by chosen hiding it, only its focus
   state is (browsers never focus a display:none element), so this one
   still just works via a plain sibling selector. */
#codplugin_woo_single_form select.hfe-ff-chosen-source:valid ~ .chosen-container .chosen-single {
    border: 2px solid #69bf29 !important;
}

#codplugin_woo_single_form .chosen-container .chosen-single span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Same double-chevron glyph the theme's own style.css uses for every
   plain <select> on the site, recolored/repositioned to sit where
   chosen's own arrow div renders instead of shipping a second, visually
   different arrow. */
#codplugin_woo_single_form .chosen-container .chosen-single div {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 11px;
    background: none;
}

#codplugin_woo_single_form .chosen-container .chosen-single div b {
    display: block;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat center / 9px;
}

/* Base position/visibility for the dropdown panel - normally provided by
   the theme's own chosen.min.css (enqueued alongside this file, see
   includes/frontend.php); declared here too as a safety net so the panel
   never renders permanently expanded if that file is ever missing for
   any reason. */
#codplugin_woo_single_form .chosen-container .chosen-drop {
    position: absolute;
    display: none;
    inset-inline-start: 0;
    top: 100%;
    box-sizing: border-box;
    width: 100%;
    margin-top: 4px;
    border: 2px solid #bce0f7;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
    overflow: hidden;
    z-index: 20;
}

#codplugin_woo_single_form .chosen-container-active .chosen-drop,
#codplugin_woo_single_form .chosen-container.chosen-with-drop .chosen-drop {
    display: block;
}

#codplugin_woo_single_form .chosen-container .chosen-search {
    padding: 8px;
    background: #fff;
}

#codplugin_woo_single_form .chosen-container .chosen-search input {
    box-sizing: border-box;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 2px solid #bce0f7;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font-size: 13px;
    outline: none;
}

#codplugin_woo_single_form .chosen-container .chosen-search input:focus {
    border-color: #259bea;
}

#codplugin_woo_single_form .chosen-container .chosen-results {
    box-sizing: border-box;
    max-height: 240px;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
}

#codplugin_woo_single_form .chosen-container .chosen-results li {
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 3px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
}

#codplugin_woo_single_form .chosen-container .chosen-results li.highlighted {
    background: #eaf4fd;
    color: #185fa5;
}

#codplugin_woo_single_form .chosen-container .chosen-results li.no-results,
#codplugin_woo_single_form .chosen-container .chosen-results li.disabled-result {
    color: #999;
    cursor: default;
}

/* Baladiya locked (empty/disabled) until a Wilaya is chosen - toggled by
   assets/js/searchable-dropdowns.js directly on the <select> itself, so
   it applies whether or not Searchable Wilaya / Baladiya is also on (the
   plain <select> rule below covers that case on its own). */
#codplugin_woo_single_form select.hfe-locked,
#codplugin_woo_single_form select.hfe-locked ~ .chosen-container .chosen-single {
    cursor: not-allowed;
    opacity: .55;
    background: #f5f5f5 !important;
}

@media (prefers-reduced-motion: reduce) {
    #codplugin_woo_single_form .chosen-container .chosen-single {
        transition: none;
    }
}
