/* Search and Filter Styles */

/* Table and Utility Styles */
.results-table {
    width: 100%;
}

.results-table td {
    position: relative;
    overflow: visible;
}

/* Make sorting arrows appear on a new line below header text */
.results-table th {
    white-space: normal;
}

.results-table th .sorting-cnt {
    display: block;
}

.results-table th .sorting-icons {
    display: block;
    margin-top: 2px;
    line-height: 1;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

.loading {
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.message {
    text-align: center;
    padding: 20px;
    color: #666;
}

.footnote {
    position: relative;
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: #2572b4;
    text-underline-offset: 2px;
    color: #2572b4;
    transition: color 0.2s ease;
}

.footnote:hover {
    color: #1a5a8a;
    text-decoration-color: #1a5a8a;
}

.footnote-tooltip {
    position: fixed;
    background-color: #333;
    color: white;
    padding: 12px 15px;
    border-radius: 5px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10000;
    max-width: 500px;
    min-width: 300px;
    white-space: normal;
    line-height: 1.5;
    word-wrap: break-word;
    pointer-events: none;
    transform: translateX(-50%);
}

.footnote:hover .footnote-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Autocomplete Styles */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.autocomplete-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.autocomplete-suggestion:hover {
    background-color: #f8f9fa;
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.suggestion-text {
    flex: 1;
}

.suggestion-count {
    color: #666;
    font-size: 0.9em;
    margin-left: 10px;
}

/* Filter Bubble Styles */
.filter-bubbles {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-left: 10px;
    align-items: center;
    vertical-align: middle;
}

.filter-bubble {
    display: inline-flex;
    align-items: center;
    background-color: #2572b4;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    gap: 5px;
    margin-right: 10px;
}

.filter-bubble .remove-filter {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
    margin-left: 5px;
}

.filter-bubble .remove-filter:hover {
    color: #ffcccc;
}

/* DataTables filter positioning */
.dataTables_wrapper .top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.dataTables_filter {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
}

.dataTables_filter input {
    width: 100%;
    max-width: 300px;
}

/* DataTables bottom section - info and length on same line, pagination on separate line */
.dataTables_wrapper .bottom {
    margin-top: 10px;
}

/* First bottom section (info and length): display on same line */
.dataTables_wrapper > .bottom:first-of-type {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
}

/* Second bottom section (pagination): display on separate line, centered */
.dataTables_wrapper > .bottom:last-of-type:not(:first-of-type) {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.dataTables_info {
    display: inline-block;
    margin: 0;
}

.dataTables_length {
    display: inline-flex;
    align-items: center;
    margin: 0;
    font-size: 1em;
}

.dataTables_length label {
    font-size: 1em;
    margin: 0;
}

.dataTables_length select {
    font-size: 1em;
}

/* Ensure proper spacing between info and length when reorganized */
.dataTables_info + .dataTables_length {
    margin-left: 0;
}

.list-unstyled {
    list-style: none;
}

/* Remove bullets from footer list items - override theme CSS that uses ::before pseudo-elements */
#wb-info .ftr-urlt-lnk li::before,
#wb-info .ftr-urlt-lnk li:before {
    content: none !important;
    display: none !important;
}

/* Full width table view */
.search-section.full-width {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 15px;
    padding-right: 15px;
}

.search-section.full-width .table-responsive {
    width: 100%;
}

.table-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Keyboard navigation styles */
.results-table th.keyboard-focused,
.results-table td.keyboard-focused {
    background-color: #e6f2ff !important;
    position: relative;
    z-index: 1000 !important;
    border: 3px solid #2572b4 !important;
    box-shadow: 0 0 0 2px #2572b4 inset !important;
}

/* Special handling for header cells - ensure they're above everything */
.results-table thead {
    position: relative;
    z-index: 1;
}

.results-table thead th.keyboard-focused {
    z-index: 10000 !important;
    position: relative !important;
    border: 3px solid #2572b4 !important;
    box-shadow: 0 0 0 2px #2572b4 inset !important;
    background-color: #e6f2ff !important;
}

/* Use pseudo-element overlay for header cells to ensure it's on top of everything */
.results-table thead th.keyboard-focused::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid #2572b4;
    z-index: 10001;
    pointer-events: none;
    box-sizing: border-box;
}

.results-table th:focus,
.results-table td:focus {
    background-color: #e6f2ff !important;
    border: 3px solid #2572b4 !important;
    box-shadow: 0 0 0 2px #2572b4 inset !important;
    position: relative;
    z-index: 1000 !important;
}

/* Special handling for header cells on focus */
.results-table thead th:focus {
    z-index: 10000 !important;
    position: relative !important;
    border: 3px solid #2572b4 !important;
    box-shadow: 0 0 0 2px #2572b4 inset !important;
    background-color: #e6f2ff !important;
}

.results-table thead th:focus::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid #2572b4;
    z-index: 10001;
    pointer-events: none;
    box-sizing: border-box;
}