﻿
/****

    Lookup Window 

*****/

/* Ensure the header containing the type and search box stays fixed */
.lookup-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1100;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Ensure table scrolls while header remains fixed */
.lookup-table-container {
    max-height: 50vh; /* Adjust based on modal size */
    /* overflow-y: auto; */ /* Enables scrolling for the table */
    flex-grow: 1;
    height: auto !important;
}

/* Fix hover for all rows */
.selectable:hover {
    background-color: #f1f1f1 !important;
    cursor: pointer;
}

/* Ensure selected row remains highlighted and does not change on hover */
.selectable.selected {
    background-color: #007bff !important;
    color: white !important;
}

/* Prevent hover effect on the selected row */
.selectable.selected:hover {
    background-color: #007bff !important;
    color: white !important;
}


/* Make table headers sticky */
#lookupTable thead {
    display: table-header-group !important;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1050;
    width: 100%;
}

#lookupTable thead, #lookupTable tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}


#lookupTable tbody tr:last-child {
    margin-bottom: 4rem; /* Adds space below last row */
}


/* Ensure hover effect works for ALL unselected rows */
#lookupTable tbody tr:not(.selected):hover {
    background-color: #e0e0e0 !important;
}

/* Ensure the modal properly sizes within the viewport */

#lookupModal .modal-dialog {
    max-width: 90%; /* Adjust modal width */
    width: auto;
    overflow: hidden;
    /*resize: both !important;*/
}

#lookupModal .modal-content {
    height: auto; /* Allow height to be set dynamically */
}

#lookupModal .modal-body {
    max-height: 65vh; /* Limit modal height to avoid excessive space usage */
    overflow-y: hidden; /* disable scrolling */
    display: flex;
    flex-direction: column;
    padding-top: 0; /* Avoid unnecessary gaps */
}

#lookupTable {
    display: table;
    width: 100%;
    table-layout: fixed;
    font-size: 14px; /* Reduce font size */
    white-space: nowrap; /* Prevent text wrapping */
}

#lookupTable th, #lookupTable td {
    padding: 6px 10px; /* Reduce padding for better spacing */
    border-bottom: 1px solid #ddd;
}

#lookupTable tbody {
    display: block;
    max-height: 50vh; /* Allows scrolling inside tbody */
    overflow-y: auto; /* Enables scrolling */
    width: 100%;
}

#lookupTable tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* Ensure the table does not create excessive vertical space */
#lookupTable tbody tr {
    height: 30px; /* Keep row height consistent */
}

/* Pagination Container */
#pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

#pagination .page-btn {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

#pagination .page-btn:disabled {
    color: #aaa;
    cursor: not-allowed;
}

/* Pagination buttons */
.page-btn {
    padding: 5px 10px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 14px;
}

.page-btn:hover {
    background-color: #ddd;
}

#pagination-container {
    display: flex;
    align-items: center;
    gap: 10px; /* ✅ Adds spacing between pagination elements */
}

#button-container {
    display: flex;
    gap: 10px; /* ✅ Ensures OK & Cancel buttons have proper spacing */
}

/* Moves the pagination controls to the modal footer */
#lookupModal .modal-footer {
    display: flex;
    justify-content: space-between; /* Keeps pagination on the left, buttons on the right */
    align-items: center;
    width: 100%;
    background-color: white;
    padding: 10px;
    border-top: 1px solid #ddd;
}

/* Ensure buttons stay together */
#lookupModal .footer-buttons {
    display: flex;
    gap: 10px; /* Adds space between Cancel and OK buttons */
}

.lookup-table thead {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1050;
}

.lookup-table tbody tr:first-child {
    margin-top: 0;
}

#lookupTable th,
#lookupTable td {
    white-space: nowrap; /* Prevents text from wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Adds "..." if text is too long */
}


/*#lookupTable td:first-child,
#lookupTable th:first-child {
    display: none;*/ /* Hides the first column (ID) */
/*}*/

#lookupModal .modal-body {
    max-height: 65vh; /* Ensures a reasonable modal size */
    overflow: hidden; /* Prevents an unnecessary extra scrollbar */
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

/* (NEW) Remove gap above headings */
.lookup-container {
    margin-top: 0 !important;
    padding-top: 0 !important;
}


/* (NEW) Change cursor to pointer on sortable columns */
.sortable {
    cursor: pointer;
    position: relative;
}

/* Show sorting indicator */
.sortable.asc::after {
    content: " ▲";
    font-size: 12px;
    color: #666;
    display: inline-block;
}

.sortable.desc::after {
    content: " ▼";
    font-size: 12px;
    color: #666;
    display: inline-block;
}

.page-input {
    width: 50px;
    text-align: center;
    margin: 0 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px;
}

/*
        Loading indicator
*/

/* Lookup Modal Loading Indicator */
.lookup-loading {
    display: none; /* Initially hidden */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 128, 0, 0.9); /* Green background */
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    z-index: 2000;
    text-align: center;
    width: auto;
    min-width: 120px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Dots animation */
@keyframes loadingDots {
    0% {
        content: ".";
    }

    33% {
        content: "..";
    }

    66% {
        content: "...";
    }
}

.lookup-loading .dots::after {
    content: "...";
    display: inline-block;
    animation: loadingDots 1.5s infinite;
}


