.slick-header-column,
.slick-header-sortable,
.slick-header-column.ui-state-default,
.slick-header-column.slick-header-sortable {
    position: relative !important;
    padding-right: 42px !important;
    cursor: default !important;
}

body.rtl .slick-header-column,
[dir="rtl"] .slick-header-column {
    padding-right: 4px !important;
    padding-left: 42px !important;
}

.slick-header-col-actions {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 2px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    z-index: 5;
}

body.rtl .slick-header-col-actions,
[dir="rtl"] .slick-header-col-actions {
    right: auto !important;
    left: 2px !important;
}

.slick-header-filterbutton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 11px;
    color: #888;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.slick-header-filterbutton.active {
    opacity: 1 !important;
    color: #0073b7 !important;
    font-weight: bold;
}

.slick-sort-indicator,
.slick-header-column .slick-sort-indicator,
.slick-sort-indicator-asc,
.slick-sort-indicator-desc {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.slick-header-menubutton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 12px;
    color: #888;
    border-radius: 3px;
    opacity: 0.35;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.slick-header-column:hover .slick-header-filterbutton,
.slick-header-column:hover .slick-header-menubutton,
.slick-header-column.ui-state-hover .slick-header-filterbutton,
.slick-header-column.ui-state-hover .slick-header-menubutton,
.slick-header-column-active .slick-header-menubutton,
.slick-header-menubutton.active {
    opacity: 1 !important;
    color: #444;
}

.slick-header-filterbutton:hover,
.slick-header-menubutton:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #0073b7 !important;
}

.grid-header-menu {
    position: fixed;
    z-index: 999999;
    width: 260px;
    background: #ffffff;
    border: 1px solid #d2d6de;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12.5px;
    color: #333333;
    line-height: 1.4;
    user-select: none;
    -webkit-user-select: none;
    animation: ghm-fade-in 0.12s ease-out;
}

@keyframes ghm-fade-in {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-header-menu * {
    box-sizing: border-box;
}

.ghm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 5px 5px 0 0;
}

.ghm-col-title {
    font-weight: 600;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
}

.ghm-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ghm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #495057;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.12s ease;
}

.ghm-icon-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
    color: #111;
}

.ghm-icon-btn.text-danger {
    color: #dc3545;
}

.ghm-icon-btn.text-danger:hover {
    background: #ffebe9;
    border-color: #f5c6cb;
    color: #bd2130;
}

.ghm-body {
    padding: 8px 12px 6px 12px;
}

.ghm-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.ghm-row-label {
    width: 44px;
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    flex-shrink: 0;
}

.ghm-btn-group {
    display: flex;
    gap: 6px;
    flex: 1;
}

.ghm-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 6px;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
}

.ghm-btn:hover {
    background: #f1f7fa;
    border-color: #0073b7;
    color: #0073b7;
}

.ghm-btn.active {
    background: #0073b7;
    border-color: #0073b7;
    color: #ffffff;
}

.ghm-btn:disabled,
.ghm-btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f8f9fa !important;
    border-color: #e9ecef !important;
    color: #adb5bd !important;
}

.ghm-divider {
    height: 1px;
    background: #e9ecef;
    margin: 6px 0;
}

.ghm-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #212529;
    transition: background 0.12s ease, color 0.12s ease;
}

.ghm-menu-item:hover {
    background: #f1f7fa;
    color: #0073b7;
}

.ghm-menu-item.active {
    background: #e8f4fc;
    color: #0056b3;
    font-weight: 500;
}

.ghm-menu-item .ghm-item-icon {
    width: 14px;
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    flex-shrink: 0;
}

.ghm-menu-item:hover .ghm-item-icon {
    color: #0073b7;
}

.grid-header-filter-dialog {
    position: fixed;
    z-index: 999999;
    width: 250px;
    background: #ffffff;
    border: 1px solid #d2d6de;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12.5px;
    color: #333333;
    line-height: 1.4;
    user-select: none;
    -webkit-user-select: none;
    animation: ghm-fade-in 0.12s ease-out;
}

.grid-header-filter-dialog * {
    box-sizing: border-box;
}

.ghf-search-box {
    position: relative;
    padding: 8px 10px;
    border-bottom: 1px solid #e9ecef;
}

.ghf-search-icon {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    color: #999;
    font-size: 12px;
}

body.rtl .ghf-search-icon,
[dir="rtl"] .ghf-search-icon {
    left: auto !important;
    right: 18px !important;
}

.ghf-search-input {
    width: 100%;
    padding: 5px 8px 5px 28px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

body.rtl .ghf-search-input,
[dir="rtl"] .ghf-search-input {
    padding: 5px 28px 5px 8px !important;
}

.ghf-search-input:focus {
    border-color: #0073b7;
    box-shadow: 0 0 0 2px rgba(0, 115, 183, 0.2);
}

.ghf-select-all-row {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f3f5;
    background: #fafbfc;
    font-weight: 500;
}

.ghf-select-all-row label,
.ghf-value-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    font-size: 12px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ghf-values-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 4px 6px;
}

.ghf-value-item {
    padding: 4px 6px;
    border-radius: 3px;
    transition: background 0.1s;
}

.ghf-value-item:hover {
    background: #f1f7fa;
}

.ghf-val-count {
    color: #888;
    font-size: 11px;
    margin-left: auto;
}

body.rtl .ghf-val-count,
[dir="rtl"] .ghf-val-count {
    margin-left: 0;
    margin-right: auto;
}

.ghf-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 5px 5px;
}

.ghf-btn-clear {
    background: transparent;
    border: none;
    color: #0073b7;
    cursor: pointer;
    font-size: 11.5px;
    padding: 0;
    text-decoration: underline;
}

.ghf-btn-clear:hover {
    color: #0056b3;
}

.ghf-footer-actions {
    display: flex;
    gap: 6px;
}

.ghf-btn-cancel {
    padding: 4px 10px;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 11.5px;
    cursor: pointer;
}

.ghf-btn-cancel:hover {
    background: #e9ecef;
}

.ghf-btn-apply {
    padding: 4px 12px;
    background: #0073b7;
    border: 1px solid #0073b7;
    border-radius: 4px;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
}

.ghf-btn-apply:hover {
    background: #0056b3;
    border-color: #0056b3;
}

body.rtl .grid-header-menu,
body.rtl .grid-header-filter-dialog,
[dir="rtl"] .grid-header-menu,
[dir="rtl"] .grid-header-filter-dialog {
    direction: rtl;
    text-align: right;
}

body.rtl .ghm-header-actions,
[dir="rtl"] .ghm-header-actions {
    flex-direction: row-reverse;
}

body.rtl .ghm-btn-group,
[dir="rtl"] .ghm-btn-group {
    flex-direction: row-reverse;
}
