/*!
 * ---------------------------------------------------------------------
 *
 * GLPI - Gestionnaire Libre de Parc Informatique
 *
 * http://glpi-project.org
 *
 * @copyright 2015-2025 Teclib' and contributors.
 * @copyright 2003-2014 by the INDEPNET Development Team.
 * @licence   https://www.gnu.org/licenses/gpl-3.0.html
 *
 * ---------------------------------------------------------------------
 *
 * LICENSE
 *
 * This file is part of GLPI.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * ---------------------------------------------------------------------
 */

// TODO Encapsulate into a class

.form-check-input[name="as_map"]:checked {
    background-color: $info;
}

.form-check-input[name="is_deleted"]:checked {
    background-color: $danger;
}

.search_page {
    @include media-breakpoint-up(lg) {
        display: flex;
        align-items: stretch;
    }

    .search-container {
        @include media-breakpoint-up(lg) {
            overflow: auto;
            height: calc(100vh - #{$contextbar-height} - #{$content-margin});
            padding: 0;
            margin-left: calc(var(--tblr-gutter-x) / 2);
            width: 100%;

            .dashboard-card {
                @include media-breakpoint-up(lg) {
                    position: sticky;
                    left: 0;
                }
            }

            &.disable-overflow-y {
                height: auto;
            }
        }

        .search-form-container {
            @include media-breakpoint-up(lg) {
                position: sticky;
                left: 0;
            }

            .search-form {
                background-color: $search_bg;
                color: $search_fg;
                border-color: $search_border;

                // try having same width on link dropdowns
                .select2-container {
                    min-width: 58px;
                }

                .sub_criteria {
                    background-color: darken($search_bg, 1%);
                }
            }
        }

        .search-card {
            @include media-breakpoint-up(lg) {
                min-width: 100%;
                width: fit-content;

                .search-header {
                    border-bottom: 0;
                    position: sticky;
                    top: -1px;
                    background-color: inherit;
                    z-index: #{$zindex-sticky + 1};

                    .search-controls {
                        position: sticky;
                        left: 22px;
                    }
                }
            }

            .table-responsive-lg {
                @include media-breakpoint-down(lg) {
                    max-width: calc(100vw - 2rem);
                }
            }

            .search-results {
                border-collapse: separate;
                border-spacing: 0;

                a {
                    font-weight: 500;
                }

                hr {
                    margin: 10px 0;
                }

                @include media-breakpoint-up(lg) {
                    thead:first-child {
                        th {
                            z-index: $zindex-sticky;
                            position: sticky;
                            top: 59px;
                            border: 1px solid $card-border-color;
                            border-left: 0;
                            border-right: 0;
                            background-color: $table_header_bg;
                            min-width: max-content;
                            vertical-align: top;
                        }
                    }
                }

                @media (max-width: 1899.98px) {
                    font-size: 0.75rem;

                    & > :not(caption) > * > * {
                        padding: 0.25rem;
                    }
                }

                &.deleted-results {
                    color: rgb(56, 13, 13);
                }
            }

            .search-footer {
                position: sticky;
                bottom: 0;

                @include media-breakpoint-up(lg) {
                    .search-pager {
                        .search-limit {
                            position: sticky;
                            left: 22px;
                        }

                        .page-infos {
                            position: sticky;
                            left: 250px;
                            right: 270px;
                        }

                        .pagination {
                            position: sticky;
                            right: 22px;
                        }
                    }
                }
            }
        }

        div.spinner-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #80808033;
            z-index: 20;

            div.spinner-border {
                width: 50px;
                height: 50px;
                position: fixed;
                top: 50%;
                left: 50%;
                border-width: 4px;
            }
        }
    }
}

body.horizontal-layout {
    .search_page:not(.search_page_global) {
        .search-container {
            @include media-breakpoint-up(lg) {
                height: calc(100vh - #{$topbar-height} - #{$contextbar-height} - #{$content-margin});
            }
        }
    }

    .search_page_global {
        @include media-breakpoint-up(lg) {
            height: calc(100vh - #{$topbar-height} - #{$contextbar-height} - #{$content-margin});
        }
    }
}

.priority_block {
    white-space: nowrap;
    border: 1px solid transparent;
    padding-right: 6px;
    border-radius: 2px;
    display: flex;

    span {
        width: 20px;
    }
}

table.search-results {
    thead th[data-searchopt-id][data-nosort] {
        vertical-align: bottom !important;// Fix alignment for when no sorting indicator element is present
    }

    thead th[data-searchopt-id]:not([data-searchopt-id=""]):not([data-nosort]) {
        cursor: pointer;

        .sort-indicator {
            vertical-align: super;
            font-size: 1.2em;
            white-space: nowrap;
        }
    }
}
