/* Django 6.0 Admin Layout Fix */

/* Ensure changelist uses flexbox layout (Django 6.0 default) */
#changelist {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
}

/* Main content area should flex-grow */
#changelist .changelist-form-container {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* Filter sidebar on the right */
#changelist-filter {
    flex: 0 0 240px !important;
    order: 1 !important;
    margin: 0 0 0 30px !important;
}

/* Ensure results table doesn't break layout */
#changelist-form .results {
    overflow-x: auto !important;
    width: 100% !important;
}

/* Paginator should be horizontal */
.paginator {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 0 !important;
}

.paginator > * {
    display: inline-block !important;
}

/* Fix for filtered lists */
.change-list .filtered {
    display: flex !important;
    align-items: flex-start !important;
}

.change-list .filtered .results,
.change-list .filtered .paginator,
.filtered #toolbar {
    width: auto !important;
}

/* Ensure toolbar stays horizontal */
#toolbar {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 10px 0 !important;
}

#toolbar form {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
}

/* Fix search bar layout */
#changelist-search {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

/* Action bar should be horizontal */
.actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 0 !important;
}

.actions label,
.actions select,
.actions button {
    display: inline-block !important;
    margin: 0 5px 0 0 !important;
}

/* Responsive: stack on small screens */
@media (max-width: 1024px) {
    #changelist {
        flex-direction: column !important;
    }

    #changelist-filter {
        flex: 1 1 auto !important;
        margin: 20px 0 0 0 !important;
        width: 100% !important;
    }
}

