/* Filter Card Styles */
/* Fix for dropdown z-index issue - centralized for all pages */
.filter-card {
    position: relative;
    z-index: 1002 !important;
    /* Keep filter cards visually consistent across a row */
    min-height: 80px;           /* adjust as needed */
    display: flex;               /* allow body to stretch */
    flex-direction: column;
}

.filter-card.dropdown-open {
    z-index: 99998 !important;
    position: relative;
}
/* Ensure the card body expands to fill available height */
.filter-card .card-body {
    flex: 1 1 auto;
}


/* Ensure dropdown menu appears above everything except navigation */
.filter-card .dropdown-menu.show {
    z-index: 99999 !important;
}

/* Match dropdown positioning/stacking */
.dropdown-menu {
    z-index: 1050; /* Bootstrap standard */
    position: absolute !important;
    transform: none !important;
    will-change: auto !important;
    top: 100% !important;
    left: 0 !important;
    margin-top: 0 !important;
}

.dropdown-menu.show { 
    z-index: 1050; 
}

.dropdown-toggle { 
    z-index: 1 !important; 
    position: relative; 
}

body > .dropdown-menu { 
    position: fixed !important; 
    top: auto !important; 
}
.filter-card .dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.filter-card .dropdown-menu::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.filter-card .dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
}

/* Don't show hand cursor on informational/disabled rows */
.filter-card .dropdown-item.text-muted,
.filter-card .dropdown-item.disabled {
    cursor: default;
}

/* Global: show hand cursor for dropdown options everywhere (not just filter cards) */
.dropdown-menu .dropdown-item {
    cursor: pointer;
}
.dropdown-menu .dropdown-item.text-muted,
.dropdown-menu .dropdown-item.disabled,
.dropdown-menu .dropdown-item[disabled] {
    cursor: default;
}

.filter-card .custom-control {
    margin: 0;
}

.filter-card .custom-control-label {
    cursor: pointer;
    user-select: none;
}

/* Sticky container for dropdown header and search */
.sticky-filter-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #fff; /* Ensure it has a background */
}

/* Project-wide filter dropdown search layout: keep input + icon on one line */
.dropdown-menu-small .dropdown-search .input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.dropdown-menu-small .dropdown-search .input-group > .form-control {
    min-width: 0;
    flex: 1 1 auto;
}

.dropdown-menu-small .dropdown-search .input-group-append {
    display: flex;
    flex: 0 0 auto;
}

.dropdown-menu-small .dropdown-search .input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Project-wide filter options list height limit */
.dropdown-menu-small .filter-options-list {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Remove individual sticky positioning */
.filter-card .dropdown-header,
.filter-card .dropdown-search {
    position: static;
}

.filter-card .dropdown-search {
    border-top: 1px solid #e1e5eb; /* Add border back */
}

.filter-card .dropdown-search .form-control {
    border: 1px solid #e1e5eb;
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
    color: #5a6169;
}

.filter-card .dropdown-search .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.1);
}

.filter-card .dropdown-search .input-group-text {
    background-color: #f8f9fa;
    border: 1px solid #e1e5eb;
    border-left: none;
    padding: 0.375rem 0.5rem;
}

.filter-card .dropdown-search .material-icons {
    font-size: 1rem;
    color: #818ea3;
}

.filter-card .dropdown-header .btn-group {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.filter-card .dropdown-header .btn {
    flex: 1;
    margin: 0 2px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.filter-card .dropdown-header .btn:hover {
    background-color: #e9ecef;
}

/* Fix for dropdown z-index issue in mobile view */
.filter-card.dropdown-open {
    z-index: 9999 !important;
    position: relative;
}

/* Ensure dropdown menu appears above everything */
.filter-card .dropdown-menu.show {
    z-index: 99999 !important;
}

/* Alternative solution: ensure stats cards below have lower z-index */
.stats-small {
    position: relative;
    z-index: 1;
}

/* Stats Card Styles */
.stats-small__value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: 1.5rem;
    line-height: 1.2;
    transition: font-size 0.2s ease;
}

.stats-small__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: 0.625rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    letter-spacing: 0.0625rem;
}

.stats-small__percentage {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Dynamic font sizes */
.stats-small__value.long {
    font-size: 1.2rem;
}

.stats-small__value.very-long {
    font-size: 1rem;
}

/* Platform Distribution Chart Styles */
.card.ubd-stats .card-body {
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card.ubd-stats .analytics-users-by-device {
    height: 200px !important;
    width: 200px !important;
    margin: 0 auto;
    display: block;
}

.card.ubd-stats .ubd-stats__legend {
    margin-top: 1rem;
    padding: 1rem;
    max-height: 150px;
    overflow-y: auto;
    width: 100%;
}

.card.ubd-stats .ubd-stats__item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card.ubd-stats .ubd-stats__category {
    margin-left: 0.5rem;
    flex-grow: 1;
}

.card.ubd-stats .ubd-stats__value {
    font-weight: bold;
} 

/* Standardize card header spacing and height across app */
.card-header {
    padding-top: .5rem !important;
    padding-bottom: .5rem !important;
    /* Match single-line header height similar to "Team Performance Overview" */
    min-height: 3.375rem;
}

/* Vertically center plain headings inside headers without changing layout */
.card-header > h1,
.card-header > h2,
.card-header > h3,
.card-header > h4,
.card-header > h5,
.card-header > h6 {
    margin: 0;
    line-height: calc(3.375rem - 1rem); /* min-height minus vertical padding */
}

/* Button sizing adjustments */
/* Reduce height of small outline-primary buttons by ~20% */
.btn.btn-sm.btn-outline-primary {
    padding-top: 0.2rem !important;   /* 20% less than default 0.25rem */
    padding-bottom: 0.2rem !important;
    line-height: 1.2 !important;      /* 20% less than default 1.5 */
}

/* Lightweight badge chips (shared across pages) */
.chip {
    display: inline-block;
    background: #f1f3f5;
    color: #495057;
    border-radius: 999px;
    padding: .125rem .5rem;
    font-size: .75rem;
    white-space: nowrap;
}
.chip-dark {
    background: #dee2e6;
    color: #343a40;
}

/* Global chart tooltip stacking: keep Shards tooltips above cards/widgets */
div[class^="sc-tooltip-"] {
    z-index: 1000000 !important;
}

/* Shared morph-search control (icon -> expanding input) */
.search-morph {
    width: 38px;
    height: 38px;
    border: 1px solid #007bff;
    border-radius: 1rem;
    background: #fff;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    flex: 0 0 auto;
    transition: width 180ms ease;
}

.search-morph.search-morph--compact {
    width: 34px;
    height: 34px;
    border-radius: 0.75rem;
}

.search-morph:not(.is-open) {
    cursor: pointer;
}

.search-morph.is-open {
    width: 170px;
}

.search-morph-toggle {
    width: 38px;
    min-width: 38px;
    height: 100%;
    border: 0;
    border-radius: 0 !important;
    background: transparent;
    color: #007bff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.search-morph.search-morph--compact .search-morph-toggle {
    width: 34px;
    min-width: 34px;
}

.search-morph-toggle:focus {
    outline: none;
    box-shadow: none;
}

.search-morph-toggle .material-icons {
    transform: translateY(-2px);
}

.search-morph-fields {
    display: flex;
    align-items: center;
    width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: width 180ms ease, opacity 160ms ease;
}

.search-morph.is-open .search-morph-fields {
    width: 132px;
    opacity: 1;
    pointer-events: auto;
}

.search-morph.is-open .search-morph-toggle {
    border-right: 1px solid #007bff;
}

.search-morph-input {
    width: 100%;
    min-width: 0;
    border: 0;
    padding: 0 0.4rem;
    height: 100%;
    background: transparent;
    outline: none;
    box-shadow: none !important;
}

.search-morph-input::placeholder {
    color: #8a94a6;
}

.search-morph-clear {
    width: 30px;
    min-width: 30px;
    height: 100%;
    border: 0;
    background: transparent;
    color: #6b768d;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-morph-clear .material-icons {
    transform: translateY(-2px);
}

.search-morph-clear:focus {
    outline: none;
    box-shadow: none;
}
