/*
 * Global form input style.
 * Single source of truth for the bordered / rounded / outline-label
 * look used across product, purchase, sale, permission and modal forms.
 * Edit this file only — do not re-add input rules to style.css/custom.css.
 */

.order-form-section label,
.permission label,
.role-input-label label,
.modal-body label,
.table-top-left label,
.table-search label,
.custom-date-filter label,
.date-filters-container .date-filters label,
.sale-field-label,
.search-product-label {
    font-weight: 400;
    font-size: 12px;
    line-height: 1;
    text-align: center;
    color: #191919;
    background: #fff;
    position: relative;
    left: 8px;
    top: 11px;
    padding: 0 6px;
    margin-bottom: 0 !important;
    z-index: 2;
    font-style: normal !important;
}

/* jQuery Validate messages are <label class="error">: keep them out of the outline-label look */
.order-form-section label.error,
.permission label.error,
.role-input-label label.error,
.modal-body label.error {
    display: block;
    position: static;
    left: auto;
    top: auto;
    padding: 0;
    margin-top: 4px;
    background: transparent;
    text-align: left;
    white-space: normal;
    line-height: 1.3;
}

.order-form-section .form-control,
.role-input-label .form-control,
.permission .form-control,
.modal-body .form-control {
    -webkit-box-shadow: none;
    box-shadow: none;
    background: #ffffff;
    border: 1px solid #e4e5e7;
    border-radius: 12px;
    height: var(--control-height);
    font-weight: 400;
    line-height: 30px;
}

.order-form-section .form-control:focus,
.permission .form-control:focus,
.modal-body .form-control:focus {
    background-color: transparent !important;
    z-index: 0;
}

.order-form-section .form-control .form-control {
    padding: 0px 1px;
}

/* style.css has a legacy `.input-group .form-control { border-top-left-radius:
   6px !important; border-bottom-left-radius: 6px !important; }` meant for
   inputs with an attached left-side addon. Our date/time fields sit alone in
   an .input-group with nothing attached, so restore the full standard radius. */
.order-form-section .input-group .form-control {
    border-radius: 12px !important;
}

.order-form-section .form-control::placeholder,
.permission .form-control::placeholder,
.modal-body .form-control::placeholder {
    font-weight: 400;
    font-size: var(--font-size-base);
    line-height: 20px;
    color: #7e7e7e;
}

.order-form-section .table-select,
.permission .table-select,
.modal-body .table-select {
    height: var(--control-height);
    line-height: 24px;
    font-size: 14px;
    color: #7e7e7e;
}

/* Table filter bars (per-page select, search box) — no floating label,
   just kept visually consistent with the bordered/rounded inputs above. */
.table-top-left .form-control,
.table-search .form-control,
.date-filters-container .form-control {
    box-shadow: none;
    background: #ffffff;
    border: 1px solid #e4e5e7;
    border-radius: 12px;
    height: var(--control-height);
    font-weight: 400;
}

/* Report "Select Date" dropdown. Two legacy rules in style.css break it:
   - `.custom-date-filter span { border-bottom/right: 2px !important }` hits
     every span inside, including all of select2's markup (select2 is applied
     to every <select> by validation-setup.js), drawing stray borders;
   - the hand-drawn arrow <span> is not the wrapper's last child (the calendar
     icon follows it), so the shared .gpt-up-down-arrow rule never positions it.
   The calendar icon is also drawn in white, invisible on the white box. */
.custom-date-filter .calendar-icon {
    display: none;
}

.custom-date-filter .select2-container,
.custom-date-filter .select2-container span {
    border-bottom: 0 !important;
    border-right: 0 !important;
}

.custom-date-filter .select2-container .select2-selection--single {
    border: 1px solid #e4e5e7 !important;
}

/* select2 draws its own arrow; hide the hand-drawn one when it has taken over */
.custom-date-filter:has(.select2-container) > span:not(.select2-container) {
    display: none;
}

/* Fallback when select2 is not loaded: native select + hand-drawn arrow,
   matched to the per-page "Show" select. */
.custom-date-filter .custom-days {
    height: var(--control-height);
    padding: 0 36px 0 12px !important;
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: normal;
}

.custom-date-filter > span:not(.select2-container) {
    pointer-events: none;
    position: absolute;
    bottom: 18px;
    right: 16px;
    height: 10px;
    width: 10px;
    transform-origin: 66% 66%;
    transform: rotate(45deg);
    transition: all 0.15s ease-in-out;
}

.custom-date-filter:hover > span:not(.select2-container) {
    transform: rotate(225deg);
}

/* From / To date wrappers are toggled with d-none/d-flex; stack them so the
   label floats on the border like every other filter field. */
.date-filters-container .date-filters:not(.d-none) {
    display: block !important;
}

/* Select2 theme — re-skin the plugin's default box to match the
   bordered/rounded .form-control look above (select2 hides the
   original <select> so none of the rules above reach it). */
.select2-container--default .select2-selection--single {
    box-shadow: none;
    background: #ffffff;
    border: 1px solid #e4e5e7;
    border-radius: 12px;
    height: var(--control-height);
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: normal;
    font-size: var(--font-size-base);
    font-weight: 400;
    color: #191919;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #7e7e7e;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px;
    right: 10px;
}

.select2-container--default .select2-selection--multiple {
    box-shadow: none;
    background: #ffffff;
    border: 1px solid #e4e5e7;
    border-radius: 12px;
    min-height: var(--control-height);
    padding: 2px 8px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: #f8f9fa;
    border: 1px solid #e4e5e7;
    border-radius: 8px;
    font-size: var(--font-size-base);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #e4e5e7;
    box-shadow: none;
}

.select2-dropdown {
    border-color: #e4e5e7;
    border-radius: 12px;
    overflow: hidden;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #e4e5e7;
    border-radius: 8px;
    outline: none;
    font-size: var(--font-size-base);
}

.select2-results__option {
    font-size: var(--font-size-base);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--clr-primary);
    color: #191919;
}

/* Choices.js theme — re-skin the plugin's default box (2.5px radius, #ddd
   border, 44px height) to match the bordered/rounded .form-control look. */
.choices__inner {
    background: #ffffff;
    border: 1px solid #e4e5e7 !important;
    border-radius: 12px !important;
    height: var(--control-height);
    min-height: var(--control-height);
    font-size: var(--font-size-base);
    display: flex;
    align-items: center;
}

.choices.is-open .choices__inner {
    border-radius: 12px 12px 0 0 !important;
}

.choices.is-flipped.is-open .choices__inner {
    border-radius: 0 0 12px 12px !important;
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
    border-color: #e4e5e7 !important;
    border-radius: 0 0 12px 12px !important;
    font-size: var(--font-size-base);
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: rgba(var(--clr-primary-rgb), 0.1);
}
