/*
 * Shared "filter dropdown" component styling — a custom popup menu (white
 * card, rounded corners, shadow, blue checkmark on selected items) used in
 * place of the browser's native <select> popup on every list-page filter
 * across the app. Enhancement is applied by public/js/filter-dropdown.js.
 *
 * Markup contract (see resources/views/components/filter-dropdown.blade.php):
 *   <div class="filter-dd">
 *     <i class="... filter-dd-icon"></i>
 *     <div class="filter-dd-field">
 *       <span class="filter-dd-label">Label</span>
 *       <select class="filter-dd-select" ...>...</select>   (single or [multiple])
 *     </div>
 *     <i class="ti ti-chevron-down filter-dd-chevron"></i>
 *   </div>
 * A .filter-dd-checkboxes variant (real checkboxes instead of a <select>)
 * is also supported for filters that were already checkbox-based.
 */

.filter-dd {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 190px;
    flex: 0 0 190px;
    border: 1px solid #e0e5eb;
    border-radius: 8px;
    padding: 10px 16px;
    background: #fff;
    position: relative;
    cursor: pointer;
    user-select: none;
}
.filter-dd.filter-dd-auto-width {
    width: auto;
    flex: 0 0 auto;
    min-width: 168px;
}
.filter-dd-icon {
    color: #1b84ff;
    font-size: 17px;
    flex-shrink: 0;
}
.filter-dd-field {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.filter-dd-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #8a94a6;
}
.filter-dd-chevron {
    color: #9aa4b8;
    font-size: 15px;
    margin-left: auto;
    flex-shrink: 0;
}
.filter-dd-value {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #202c4b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.filter-dd.filter-dd-enhanced select.filter-dd-select,
.filter-dd.filter-dd-enhanced .filter-dd-checkboxes-source {
    display: none;
}

/* Popup menu */
.filter-dd-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e5eb;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(20, 30, 60, .12);
    padding: 6px;
    z-index: 1000;
    cursor: default;
}
.filter-dd-menu.open {
    display: block;
}
.filter-dd-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    margin-bottom: 4px;
    border: 1px solid #e2e5eb;
    border-radius: 6px;
    color: #8a94a6;
}
.filter-dd-search i {
    font-size: 13px;
    flex-shrink: 0;
}
.filter-dd-search input {
    border: 0;
    outline: none;
    font-size: 13px;
    width: 100%;
    color: #202c4b;
    background: transparent;
}
.filter-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13.5px;
    color: #3d4863;
    white-space: nowrap;
}
.filter-dd-item:hover {
    background: #f4f6fb;
}
.filter-dd-item.active {
    background: #eaf1fd;
    color: #2f5adf;
    font-weight: 600;
}
.filter-dd-item .filter-dd-check {
    width: 14px;
    flex-shrink: 0;
    font-size: 13px;
    color: #2f5adf;
    visibility: hidden;
}
.filter-dd-item.active .filter-dd-check {
    visibility: visible;
}
.filter-dd-item.filter-dd-checkbox-item .filter-dd-check {
    width: 15px;
    height: 15px;
    border: 1.5px solid #c7cdd9;
    border-radius: 4px;
    visibility: visible;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: transparent;
}
.filter-dd-item.filter-dd-checkbox-item.active .filter-dd-check {
    background: #2f5adf;
    border-color: #2f5adf;
    color: #fff;
}
.filter-dd-item-empty {
    padding: 10px;
    font-size: 12.5px;
    color: #8a94a6;
    text-align: center;
}
.filter-dd-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 6px 4px;
    margin-top: 4px;
    border-top: 1px solid #f1f2f3;
}
.filter-dd-footer button {
    border: 0;
    background: transparent;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.filter-dd-footer .filter-dd-clear-btn {
    color: #67748e;
}
.filter-dd-footer .filter-dd-clear-btn:hover {
    background: #f4f6fb;
}
.filter-dd-footer .filter-dd-apply-btn {
    color: #fff;
    background: #2f5adf;
}
.filter-dd-footer .filter-dd-apply-btn:hover {
    background: #274bc0;
}

/*
 * AJAX-search filter-dd boxes (see filter-dropdown.js enhanceAjaxSelect)
 * — loading state while a search request is in flight: a thin
 * indeterminate progress bar in place of the item list, so a slow query
 * reads as "working" rather than a stuck/empty dropdown.
 */
.filter-dd-ajax-loading {
    position: relative;
    height: 4px;
    margin: 6px 4px;
    background: #eef1f6;
    border-radius: 2px;
    overflow: hidden;
}
.filter-dd-ajax-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: #2f5adf;
    border-radius: 2px;
    animation: filter-dd-ajax-progress 1s ease-in-out infinite;
}
@keyframes filter-dd-ajax-progress {
    0%   { left: -40%; }
    100% { left: 100%; }
}
