/* Resizable columns для Django Admin — только десктоп */

@media (min-width: 1500px) {
    .column-resize-handle {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 5px;
        cursor: col-resize;
        background: transparent;
        z-index: 10;
    }

    .column-resize-handle:hover {
        background: var(--primary, #417690);
    }

    #result_list thead th {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        box-sizing: border-box;
    }

    #result_list tbody td,
    #result_list tbody th {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        box-sizing: border-box;
    }

    #result_list tbody td:hover,
    #result_list tbody th:hover {
        overflow: visible;
        white-space: normal;
        word-wrap: break-word;
        position: relative;
        z-index: 5;
        background: var(--body-bg, #fff);
    }

    .reset-columns-btn {
        background: #ba2121;
        color: white;
        border: none;
        padding: 5px 10px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 11px;
        margin-left: 10px;
    }

    .reset-columns-btn:hover {
        background: #a41515;
    }
}

/* Мобильные устройства — стандартная таблица Django с прокруткой */
@media (max-width: 1499px) {
    #result_list {
        table-layout: auto !important;
        width: auto !important;
    }

    #result_list thead th,
    #result_list tbody td,
    #result_list tbody th {
        width: auto !important;
        min-width: auto !important;
        max-width: none !important;
        white-space: normal;
        overflow: visible;
    }

    .column-resize-handle {
        display: none;
    }

    .reset-columns-btn {
        display: none;
    }

    #changelist .results {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Тёмная тема — только десктоп */
@media (prefers-color-scheme: dark) and (min-width: 1500px) {
    .column-resize-handle:hover {
        background: var(--primary, #79aec8);
    }

    #result_list tbody td:hover,
    #result_list tbody th:hover {
        background: var(--body-bg, #121212);
    }
}

html[data-theme="dark"] .column-resize-handle:hover {
    background: var(--primary, #79aec8);
}

html[data-theme="dark"] #result_list tbody td:hover,
html[data-theme="dark"] #result_list tbody th:hover {
    background: var(--body-bg, #121212);
}
