/* General body styling */
body {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    min-height: 100vh;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif; /* Universal sans-serif font */
}

/* Header styling */
header {
    background-color: #193d6a;
    color: white;
    padding: 20px;
    text-align: center;
    flex: 0 0 auto;
}

/* Main container styling */
#mainContainer {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
}

/* Filters container (left column) */
#filters {
    flex: 0 0 25%; /* Fixed to always take up 25% of the screen */
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* FilterFields container */
#filterFields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Table container (right column) */
#resultsTable {
    width: 100%; /* Fill the container - stretches columns across the available width */
    border-collapse: collapse;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: default; /* Ensure the cursor doesn't change */
}

/* Scroll container so the body scrolls while the sticky header stays put */
#resultsScroll {
    max-height: 600px;
    overflow: auto;
}

#resultsTableContainer {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 20px;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    max-width: 75%; /* Limit width to 75% of the screen */
    margin: 0 auto; /* Center the container horizontally */
    position: relative;
}

/* Footer styling */
footer {
    flex: 0 0 auto;
    background-color: #333;
    color: white;
    padding: 10px;
    text-align: center;
    flex: 0 0 auto;
}

/* Dropdown styling */
select {
    padding: 10px;
    font-size: 14px;
    min-width: 150px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
}

/* Button styling */
button {
    padding: 10px 15px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#searchButton {
    background-color: #007bff;
    color: #fff;
}

    #searchButton:hover {
        background-color: #0056b3;
        color: #fff;
    }

#clearButton {
    background-color: #6c757d;
    color: #fff;
}

    #clearButton:hover {
        background-color: #5a6268;
    }

/* Focus styling for accessibility */
button:focus, select:focus {
    outline: 2px solid #0056b3; /* High-contrast focus outline */
    outline-offset: 2px;
}

/* Table styling */
#resultsTable thead {
    position: sticky; /* Make the header sticky */
    top: 0; /* Stick to the top of the container */
    z-index: 1; /* Ensure it stays above the rows */
    background-color: #193d6a; /* Match the header background color */
    color: #fff;
}

#resultsTable th, #resultsTable td {
    padding: 10px;
    text-align: left;
    border: 1px solid #ddd;
}

/* Sortable column headers - a button that blends into the header cell */
#resultsTable th .sort-header {
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    color: inherit;       /* white, inherited from thead */
    font: inherit;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
}

#resultsTable th .sort-header:hover,
#resultsTable th .sort-header:focus-visible {
    text-decoration: underline;
}

#resultsTable th .sort-header:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

#resultsTable tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

#resultsTable tbody tr:hover {
    background-color: #e0e0e0; /* Higher contrast hover color */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #mainContainer {
        flex-direction: column;
    }

    #filters, #resultsTableContainer {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

#loader {
    border: 16px solid #f3f3f3; /* Light grey */
    border-top: 16px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 120px;
    height: 120px;
    animation: spin 2s linear infinite;

    position: absolute;
    top: 40%;
    left: 40%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}