/* Glossary Wrapper */
.glossary-wrapper {
    margin: 20px 0;
}

/* Search Bar */
.glossary-search {
    max-width: 600px;
    gap: 0.5rem;
}

.form-control.glossary-search-input {
    background-color: #eef1f4;
    margin: 0;
    width: auto;
    border: 1px solid #5f7f96;
    border-radius: 0.25rem; 
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem 0.375rem 0.75rem;
    font-size: 1rem;       
}

.glossary-search .btn{
    color: #fff;
    background-color: #5c7f92;
    padding: 0.375rem 0.75rem;
    font-size: .875rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    border: 2px solid #5c7f92;
    text-decoration: none;
}


.glossary-search .btn:hover {
    -webkit-filter: brightness(0.9);
    filter: brightness(0.9);
    color: #000 !important;
    background-color: #5c7f92;
    border-color: #5c7f92;
    -webkit-transition: all .3s ease-in-out;
    -moz-transition: all .3s ease-in-out;
    -o-transition: all .3s ease-in-out;
    transition: all .3s ease-in-out;
}


/* Category Heading */
.glossary-category-heading {    
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #5c7f92;

}

/* Filter Section */
.glossary-filters {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.25rem;
}

.glossary-filters label {
    font-weight: 600;
    color: #495057;
}


/* Select2 Bootstrap 4 Styling */
.glossary-filters ul {
	margin: 0 !important;
}

.glossary-filters ol li, .glossary-filters ul li {
    margin: 0.25rem 0 0 .1875rem !important;
}

.glossary-filters  ul li:before, 
.glossary-filters  ul.unordered-list li:before{
    all:unset !important;
}
.glossary-filters .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered{
    padding: 0 !important;
}

.glossary-filters .select2-container .select2-selection .select2-selection__rendered {
    line-height: 1.5 !important;
}
.glossary-filters .select2-container .select2-selection .select2-selection__rendered .select2-selection__clear{
    line-height:normal;
    margin-top: 0.5rem;
}
.glossary-filters .select2-container--bootstrap4 .select2-selection{
    background-color: #eef1f4;
    margin: 0;
    width: 100%;
    border: 1px solid #5f7f96;
    border-radius: 0.25rem;
    height: auto;
    color:#495057;

}

.glossary-filters .select2-container--bootstrap4 .select2-results__option {
    padding: .375rem;
    font-size: 0.875rem;
}
.select2-container--default .select2-results__option[aria-disabled=true],
.select2-container--bootstrap4 .select2-results__option[aria-disabled=true] {
    display: none;
}

.glossary-filters .select2-container--bootstrap4 .select2-results__group {
    color: #868e96;
    display: block;
    padding: .375rem;
    font-size: 1rem;
    line-height: 1;
    white-space: nowrap;
}

.glossary-filters .select2-container--bootstrap4 .select2-selection--multiple:focus,
.glossary-filters .select2-container--bootstrap4.select2-container--focus .select2-selection--multiple {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.glossary-filters .select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected] {
    background-color: #007bff;
    color: white;
}

.glossary-filters .select2-container--bootstrap4.select2-search--inline .select2-search__field {
    margin-top: 5px;
}
.glossary-filters .select2-container .select2-search--inline .select2-search__field {
    height: 28px;
}

.glossary-filters .select2-container--bootstrap4 .select2-results__option .select2-results__option {
    padding: .375rem;
}

.glossary-filters .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
    background-color: #5c7f92;
    border: 1px solid #5c7f92;
    color: #fff;
    padding: 2px 8px;
    border-radius: 0.25rem;
    margin-top: 5px;
    margin-right: 5px;
    font-size: 0.875rem;
}

.glossary-filters .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 5px;
    font-weight: bold;
}

.glossary-filters .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #e9ecef;
}

/* Select2 Dropdown */
.select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.select2-results__group {
    font-weight: 600;
    color: #495057;
    padding: 6px 12px;
    background-color: #f8f9fa;
}

/* Multi-select styling - removed since Select2 handles it */
/*
.main-category-filter,
.subcategory-filter {
    min-height: 120px;
    max-height: 200px;
    background-color: #eef1f4;
    margin: 0;
    width: 100%;
    border: 1px solid #5f7f96;
    border-radius: 5px; 
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem 0.375rem 0.75rem;
    font-size: 1rem;    

}

.main-category-filter option,
.subcategory-filter option {
    padding: 8px 12px;
    cursor: pointer;
}

.main-category-filter option:hover,
.subcategory-filter option:hover {
    background-color: #e9ecef;
}

.subcategory-filter optgroup {
    font-weight: 600;
    color: #495057;
    margin-top: 5px;
}

.subcategory-filter optgroup option {
    padding-left: 20px;
    font-weight: normal;
}
*/
/* Alphabet Filter */
.glossary-alphabet-filter {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.25rem;
    position: sticky;
    top: 1rem;
    z-index: 2;
}

.glossary-filters:has(+.glossary-alphabet-filter) {
    padding-bottom: 0;
}

.alphabet-btn.active {
    background-color: #5c7f92;
    color: white;
    border-color: #5c7f92;
}

.alphabet-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Accordion Styles */
.glossary-accordion {
    margin-top: 20px;
}

.glossary-item {
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.glossary-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.glossary-item .card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
}

.glossary-item .card-header h3 {
    font-size: 1.1rem;
    margin: 0;
}

.glossary-item .btn-link {
    width: 100%;
    text-align: left;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.glossary-item .btn-link:hover {
    color: #232323;
    text-decoration: none;
}

.glossary-item .btn-link:focus {
    box-shadow: none;
    outline: none;
}

.glossary-item .btn-link i {
    transition: transform 0.3s ease;
    color: #6c757d;
}

.glossary-item .btn-link:not(.collapsed) i {
    transform: rotate(180deg);
}

.accordion>.card.glossary-item{
    border-radius: 0.25rem;
}

.accordion>.card.glossary-item:not(:first-of-type) {
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
}

.accordion>.card.glossary-item:not(:last-of-type){
    border-bottom:1px solid rgba(0, 0, 0, .125);
    border-bottom-right-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;    
}

.glossary-item .card-body {
    padding: 20px;
    background-color: #fff;
    color: #495057;
    line-height: 1.6;
}

.glossary-item .card-body *:last-child{
    margin-bottom: 0;
}

/* Hidden Items */
.glossary-item.hidden {
    display: none !important;
}

/* No Results Message */
.no-results {
    margin-top: 20px;
}

.no-results .alert {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {    
    .main-category-filter,
    .subcategory-filter {
        min-height: 100px;
    }    
    .glossary-item .btn-link {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
}

/* Loading State */
.glossary-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}

.glossary-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5c7f92;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Section Spacing */
.glossary-section {
    position: relative;
}

/* Smooth Transitions */
.glossary-item,
.alphabet-btn,
.btn-link,
.btn-link i {
    transition: all 0.3s ease;
}

/* Deep Link: View all terms bar */
.glossary-deeplink-bar {
    display: flex;
    align-items: center;
}

.glossary-deeplink-bar .btn {
    font-size: 0.875rem;
}

/* Deep Link: Highlighted item */
.glossary-deeplink-highlight {
    border: 2px solid #007bff !important;
    border-radius: 4px;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15);
    animation: glossary-highlight-pulse 1.5s ease-in-out;
}

@keyframes glossary-highlight-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(0, 123, 255, 0.4); }
    50%  { box-shadow: 0 0 0 8px rgba(0, 123, 255, 0.1); }
    100% { box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15); }
}

/* Inline glossary term links (inserted via TinyMCE) */
a.glossary-term-link {
    border-bottom: 1px dashed #007bff;
    color: inherit;
    text-decoration: none;
}

a.glossary-term-link:hover {
    border-bottom-style: solid;
    color: #007bff;
}
