/* =========================================================
   Recharge transitions
   ========================================================= */

#recharge-summary-wrap {
    transition: opacity 0.1s ease-in;
}

#recharge-summary-wrap.ic-transitioning {
    opacity: 0.25;
}

.recharge-startdate-text {
    font-size: small;
}


/* =========================================================
   Recharging preview filters
   ========================================================= */

.recharge-filter-content {
    background-color: var(--bs-table-striped-row-odd-bg);
    padding: 16px;
}

#recharging_preview_form .filter-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start !important;
    justify-content: flex-start;
    gap: 12px 8px;
    width: 100%;
    min-width: 0;
    margin: 0;
}

#recharging_preview_form .filter-field,
#recharging_preview_form .filter-check-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 0 0 128px;
    width: 128px;
    min-width: 0;
    max-width: 100%;
    margin: 0;
}

#recharging_preview_form .filter-check-field {
    flex-basis: 104px;
    width: 104px;
}

#recharging_preview_form .label-small {
    display: flex;
    align-items: center;
    height: 15px;
    font-size: 10px;
    line-height: 14px;
    white-space: normal;
    color: var(--bs-input-font-color);
    margin-bottom: 2px;
}

#recharging_preview_form .toggle-field {
    width: 100%;
    min-width: 0;
}

#recharging_preview_form .filter-check-field .toggle-field {
    display: flex;
    align-items: center;
    min-height: 30px;
}

#recharging_preview_form .filter-field .toggle-field > input:not([type="hidden"]),
#recharging_preview_form .filter-field .toggle-field > select:not(.selectpicker) {
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    height: 30px;
    min-height: 30px;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 20px;
    box-sizing: border-box;
}

#recharging_preview_form label.errors {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Preview inside the filter row */

#recharging_preview_form .recharge-preview-action {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 30px;
    padding-top: 18px;
}

#recharging_preview_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    margin: 0 !important;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 20px;
    white-space: nowrap;
}


/* =========================================================
   Other recharging layouts
   ========================================================= */

.recharging-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px 16px;
    width: 100%;
    min-width: 0;
    font-size: 12px;
}

.recharging-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    margin: 0;
    padding: 6px;
    box-sizing: border-box;
    border-radius: 8px;
}

.recharging-label {
    margin-bottom: 6px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--bs-input-font-color);
}

.recharging-item:hover {
    box-shadow:
        0 1.5px 4px var(--bs-table-shadow1-color),
        0 1.5px 6px var(--bs-table-shadow2-color),
        0 0 6px rgba(184, 224, 187, 0.5);
}

.recharging-item input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#recharge input.datepicker {
    width: 200px;
    max-width: 100%;
    box-sizing: border-box;
}


/* =========================================================
   Recharge summary filters
   ========================================================= */

.recharge-summary-filter-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 760px;
    margin-bottom: 0;
    padding-bottom: 0;
}

.recharge-summary-filter-row {
    display: grid;
    grid-template-columns:
        minmax(140px, 190px)
        minmax(0, 280px)
        minmax(0, 1fr);
    gap: 8px 16px;
    align-items: center;
    margin-bottom: 0;
}

.recharge-summary-filter-label,
.recharge-summary-filter-field,
.recharge-summary-filter-error {
    min-width: 0;
    min-height: 30px;
    margin-bottom: 0;
}

.recharge-summary-filter-label,
.recharge-summary-filter-error {
    display: flex;
    align-items: center;
}

.recharge-summary-filter-label,
.recharge-summary-filter-label label {
    margin-bottom: 0;
    font-size: 12px;
    line-height: 1.3;
}

.recharge-summary-filter-field select:not(.selectpicker) {
    width: 100%;
    min-height: 30px;
    padding: 4px 8px;
    box-sizing: border-box;
    font-size: 12px;
    line-height: 20px;
}

.recharge-summary-filter-error {
    overflow-wrap: anywhere;
}

.recharge-summary-filter-row:last-child {
    margin-top: 4px;
}

.recharge-summary-filter-row:last-child .btn,
.recharge-summary-filter-row:last-child .small-button {
    margin-bottom: 0;
    white-space: nowrap;
}


/* =========================================================
   Dropdowns shared by recharge forms
   ========================================================= */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-bottom: 0 !important;
}

.recharging-item .form-group,
.recharge-summary-filter-field .form-group {
    width: 100%;
    min-width: 0;
    margin-bottom: 0;
}

/* Closed buttons: restore the original gradient background */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select > .dropdown-toggle {
    width: 100% !important;
    height: 30px;
    min-height: 30px;
    padding: 4px 26px 4px 8px !important;
    box-sizing: border-box;
    font-size: 12px;
    line-height: 20px;
    color: var(--bs-input-font-color) !important;
    background-color: transparent !important;
    background-image: var(--bs-gradient);
    border: 1px solid var(--bs-dropdown-input-border-color) !important;
    border-radius: 5px;
}

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select > .dropdown-toggle.bs-placeholder {
    color: var(--bs-placeholder-text) !important;
}

/* Reserve arrow space only once */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select > .dropdown-toggle .filter-option {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select .filter-option-inner-inner {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 20px;
}

/* Open menus: fixed width and the original theme surface */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select > .dropdown-menu {
    width: 210px !important;
    min-width: 210px !important;
    max-width: calc(100vw - 24px) !important;
    padding: 4px 0;
    box-sizing: border-box;
    background-color: var(--bg-color);
    background-image: none;
    color: var(--bs-input-font-color);
    border: 1px solid var(--bs-dropdown-border-color, rgba(0, 0, 0, 0.15));
    border-radius: 6px;
}

/* Inner option list: no extra panel background or border */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select .dropdown-menu.inner {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* Options fit their text, matching the earlier appearance */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select .dropdown-item {
    width: fit-content;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    border-radius: 5px;
    font-size: 10px;
    line-height: 18px;
}

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bootstrap-select .dropdown-item .text {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Dropdown search */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bs-searchbox {
    padding: 4px 8px 6px;
}

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bs-searchbox input.form-control {
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    height: 28px;
    min-height: 28px;
    margin: 0;
    padding: 3px 7px;
    font-size: 12px;
    line-height: 20px;
    box-sizing: border-box;
}

/* Select All / Deselect All */

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bs-actionsbox {
    padding: 0 8px 4px;
}

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bs-actionsbox .btn-group {
    display: flex;
    width: 100%;
}

:is(
    #recharging_preview_form,
    .recharging-item,
    .recharge-summary-filter-field
) .bs-actionsbox .btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 28px;
    height: auto;
    margin: 0;
    padding: 4px 6px;
    font-size: 11px;
    line-height: 18px;
    white-space: nowrap;
    color: var(--bs-input-font-color) !important;
    background-color: transparent !important;
    background-image: var(--bs-gradient);
    border-color: var(--bs-dropdown-input-border-color) !important;
}


/* =========================================================
   Notes and other action buttons
   ========================================================= */

#id_recharge_notes {
    width: 80% !important;
    max-width: 100%;
}

.disabled-field #id_recharge_notes {
    border: 0 !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent !important;
}

.recharging_edit_button_div {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px !important;
}

#recharging_save_form .edit_button-div,
#recharging_export_form .edit_button-div {
    margin-top: 0 !important;
}

.recharge-button-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.recharge-button-container > .btn,
.recharge-button-container > .small-button,
.recharging_edit_button_div > .btn {
    flex-shrink: 0;
    white-space: nowrap;
}


/* =========================================================
   Responsive adjustments
   ========================================================= */

@media (max-width: 767px) {
    .recharge-summary-filter-row {
        grid-template-columns:
            minmax(120px, 160px)
            minmax(0, 1fr);
    }

    .recharge-summary-filter-error {
        grid-column: 2;
        min-height: 0;
    }
}

@media (max-width: 480px) {
    #recharging_preview_form .filter-field,
    #recharging_preview_form .filter-check-field {
        flex: 1 1 100%;
        width: 100%;
    }

    #recharging_preview_form .label-small {
        height: auto;
        min-height: 0;
    }

    #recharging_preview_form .recharge-preview-action {
        flex-basis: 100%;
        justify-content: flex-end;
        padding-top: 0;
    }

    .recharging-container,
    .recharge-summary-filter-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .recharge-summary-filter-label {
        min-height: 0;
    }

    .recharge-summary-filter-error {
        grid-column: 1;
    }

    #id_recharge_notes {
        width: 100% !important;
    }

    .recharge-button-container {
        flex-direction: column;
        align-items: stretch;
    }
}