/* fix generic flex container */
.admin-interface .flex-container {
    width: 100%;
}
/* end-fix */

/* fix flex container for boolean fields */
.admin-interface .flex-container.checkbox-row {
    align-items: center;
}
.admin-interface .flex-container.checkbox-row label.vCheckboxLabel {
    margin-top: 0 !important;
    padding-left: 5px !important;
    padding-bottom: 0;
}
/* end-fix */

/* fix flex container for related-lookup (raw_id_fields) */
.admin-interface .flex-container:has(.vForeignKeyRawIdAdminField) {
    align-items: center;
}

.admin-interface .flex-container:has(.vForeignKeyRawIdAdminField) .related-lookup {
    margin-left: 12px;
}

.admin-interface .flex-container:has(.vForeignKeyRawIdAdminField) .related-lookup + * {
    margin-left: 8px;
}
/* end-fix */

/* fix flex container input fields height inheritance */
.admin-interface .flex-container label + input[type="text"],
.admin-interface .flex-container label + input[type="password"],
.admin-interface .flex-container label + input[type="email"],
.admin-interface .flex-container label + input[type="url"],
.admin-interface .flex-container label + input[type="number"],
.admin-interface .flex-container label + input[type="tel"] {
    height: 1.375em;
}
/* end-fix */

/* fix user reset password form */
.admin-interface #user_form #id_password p bdi::after {
    content: "";
    display: block;
}

.admin-interface #user_form #id_password a.button {
    display: inline-block;
    padding: 6px 12px;
    text-decoration: none !important;
}
/* end-fix */

/* fixed time widget header border radius */
.admin-interface .clockbox.module h2 {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
/* end-fix */

/* fixed related widget and select2 */
/* begin fix issue #10 - Related widget broken in long tabular inline */
.admin-interface .related-widget-wrapper {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    max-width: 1000px;
    height: fit-content;
    gap: 0;
}
/* end fix */

/* fix related widget links icons size and vertical alignment */
.admin-interface .related-widget-wrapper .related-widget-wrapper-link {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 32px;
}
.admin-interface .related-widget-wrapper .related-widget-wrapper-link:first-of-type {
    margin-left: 8px;
}
.admin-interface .related-widget-wrapper .related-widget-wrapper-link:hover {
    filter: brightness(80%);
}
.admin-interface .related-widget-wrapper .related-widget-wrapper-link img {
    width: 16px;
    height: 16px;
}
/* end fix */

/* fix related widget links add button position on many-to-many selector */
.admin-interface .related-widget-wrapper .related-widget-wrapper-link:has(+ .selector) {
    order: 2;
    align-self: flex-start;
    margin-top: 8px;
}
/* end fix */

/* fix selector chooser slide transition */
.admin-interface .related-widget-wrapper .selector-chooser .selector-add,
.admin-interface .related-widget-wrapper .selector-chooser .selector-remove {
    transition: none;
}
/* end fix */

/* fix related widget links margin from select2 (autocomplete_fields) */
/*
.admin-interface .related-widget-wrapper .select2-container + .related-widget-wrapper-link {
    margin-left: 12px !important;
}
*/
/* end fix */

/* improve responsive selector */

/* fix [stacked, not-stacked] equalize horizontal and vertical select padding for selector */
.admin-interface .selector .selector-available select,
.admin-interface .selector .selector-chosen select {
    padding: 7px 10px;
    display: block;
}

/* fix [stacked, not-stacked] select options text overflow */
.admin-interface .selector .selector-available select option,
.admin-interface .selector .selector-chosen select option {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* fix [not-stacked] equalize selectors height by adding the height of the .selector-available filter-bar */
.admin-interface .selector:not(.stacked) .selector-chosen select {
    height: calc(46px + 17.2em) !important;
}

/* fix selected options color */
.admin-interface .selector select option:checked {
    color: inherit;
}

@media (max-width: 767px) {
    /* fixed responsive widgets */
    .admin-interface .aligned.collapsed .form-row {
        display: none;
    }

    .admin-interface .aligned .form-row > div {
        display: flex;
        width: 100%;
        max-width: 100vw;
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-interface .aligned .form-row .help {
        margin-left: 0;
    }

    .admin-interface .aligned .form-row .checkbox-row label {
        margin: 10px 0 0 0;
        padding: 0;
    }

    .admin-interface .aligned .form-row input[type="file"],
    .admin-interface .aligned .form-row input[type="text"],
    .admin-interface .aligned .form-row input[type="email"] {
        width: 100%;
    }

    /* fix textarea horizontal scroll on Firefox */
    .admin-interface .aligned .form-row textarea {
        width: 100% !important;
        flex: 0 1 auto;
    }

    .admin-interface .aligned .form-row .datetime input[type="text"] {
        width: 50%;
    }

    .admin-interface .aligned .form-row span + .file-upload {
        margin-top: 10px;
    }

    .admin-interface .aligned .form-row .file-upload input[type="file"] {
        margin-top: 5px;
    }
}
