/* ============================================================
   ZA Vivid Data - Application Users page
   Scoped to .za-users so it never leaks into the rest of the app.
   ============================================================ */

.za-users {
    --za-blue: #0b6fd8;
    --za-blue-soft: #e8f1fc;
    --za-ink: #1b2231;
    --za-muted: #5f6b7c;
    --za-line: #e6ebf2;
    --za-card: #ffffff;
    --za-radius: 14px;
    --za-shadow: 0 6px 20px rgba(15, 40, 80, 0.06), 0 1px 0 rgba(15, 40, 80, 0.04);

    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    color: var(--za-ink);
    font-family: var(--rz-text-font-family);

    /* Fills whatever height the layout body gives it (see the :has() rules below); the grid scrolls internally. */
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* While this page is shown, turn the main layout body into a non-scrolling flex column so the page
   can take the full remaining height regardless of the layout's breakpoint paddings. Scoped with :has()
   so no other page is affected. */
.rz-body:has(.za-users) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rz-body:has(.za-users) .rz-row:has(> .rz-col-12 > .za-users) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    /* single flex line so the column's height is the row's height, not its content height */
    flex-wrap: nowrap;
    align-items: stretch;
}

.rz-body:has(.za-users) .rz-row:has(> .rz-col-12 > .za-users) > .rz-col-12 {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.za-users *,
.za-users *::before,
.za-users *::after {
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */

.za-users__head,
.za-users__stats {
    flex: 0 0 auto;
}

.za-users__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--za-card);
    border-radius: var(--za-radius);
    box-shadow: var(--za-shadow);
}

.za-users__head-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.za-users__head-icon {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--za-blue-soft);
    color: var(--za-blue);
}

.za-users__head-icon .rzi {
    font-size: 2.4rem;
    font-variation-settings: 'FILL' 1;
}

.za-users__title {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.za-users__subtitle {
    margin: 0.3rem 0 0 0;
    font-size: 1rem;
    color: var(--za-muted);
}

.za-users__head-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.za-users .za-users__btn-outline.rz-button,
.za-users .za-users__btn-outline.rz-button.rz-variant-outlined {
    height: 2.9rem;
    padding: 0 1.1rem;
    border-radius: 10px;
    border: 1px solid #cfd8e3;
    background: var(--za-card);
    color: var(--za-blue);
    font-weight: 600;
    box-shadow: none;
}

.za-users .za-users__btn-outline.rz-button:hover {
    background: var(--za-blue-soft);
}

.za-users .za-users__btn-primary.rz-button {
    height: 2.9rem;
    padding: 0 1.25rem;
    border-radius: 10px;
    background: var(--za-blue);
    color: #fff;
    font-weight: 600;
    border: 0;
    box-shadow: 0 6px 14px rgba(11, 111, 216, 0.28);
}

.za-users .za-users__btn-primary.rz-button:hover {
    background: #0a5fbb;
}

.za-users .rz-button .rz-button-box {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.za-users .rz-button .rz-button-box .rzi {
    font-size: 1.25rem;
}

.za-users__btn-caret {
    font-size: 1.1rem;
}

/* ------------------------------------------------------------
   Statistic tiles
   ------------------------------------------------------------ */

.za-users__stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.za-users__stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: var(--za-card);
    border-radius: var(--za-radius);
    box-shadow: var(--za-shadow);
}

.za-users__stat-icon {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.za-users__stat-icon .rzi {
    font-size: 1.9rem;
    font-variation-settings: 'FILL' 1;
}

.za-users__stat-icon--blue { background: #e8f1fc; color: #0b6fd8; }
.za-users__stat-icon--teal { background: #e0f7f4; color: #00a389; }
.za-users__stat-icon--green { background: #e6f7ec; color: #1ba85a; }
.za-users__stat-icon--purple { background: #efeafb; color: #6f42c1; }

.za-users__stat-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.za-users__stat-label {
    font-size: 0.9rem;
    color: var(--za-muted);
}

.za-users__stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.za-users__stat-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    color: var(--za-blue);
}

.za-users__stat-side strong {
    font-size: 1rem;
    font-weight: 600;
}

.za-users__stat-side span {
    font-size: 0.72rem;
    color: var(--za-muted);
}

.za-users__stat-side--green {
    color: #1ba85a;
}

/* ------------------------------------------------------------
   Grid card and toolbar
   ------------------------------------------------------------ */

.za-users__card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--za-card);
    border-radius: var(--za-radius);
    box-shadow: var(--za-shadow);
    padding: 1.25rem 1.25rem 0.75rem 1.25rem;
}

.za-users__grid-host {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.za-users__grid-host .e-grid {
    height: 100%;
}

.za-users__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.za-users__search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    max-width: 920px;
}

.za-users__search .rzi {
    position: absolute;
    left: 1rem;
    font-size: 1.35rem;
    color: #8b97a8;
    pointer-events: none;
}

.za-users__search input {
    width: 100%;
    height: 2.9rem;
    padding: 0 1rem 0 3rem;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    background: var(--za-card);
    font: inherit;
    font-size: 1rem;
    color: var(--za-ink);
}

.za-users__search input:focus {
    outline: none;
    border-color: var(--za-blue);
    box-shadow: 0 0 0 3px rgba(11, 111, 216, 0.15);
}

.za-users__toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 0 0 auto;
}

/* ------------------------------------------------------------
   Flat Syncfusion grid
   ------------------------------------------------------------ */

.za-users #v2UsersGrid.e-grid {
    border: 0;
    font-family: inherit;
}

.za-users #v2UsersGrid .e-gridheader {
    border-top: 1px solid var(--za-line);
    border-bottom: 1px solid var(--za-line);
    background: #f6f8fb;
}

.za-users #v2UsersGrid .e-gridheader .e-headercell,
.za-users #v2UsersGrid .e-gridheader .e-headercelldiv {
    background: #f6f8fb;
    color: #2f3947;
    font-size: 0.92rem;
    font-weight: 600;
    height: 48px;
}

.za-users #v2UsersGrid .e-gridheader .e-headercell {
    border-left: 1px solid var(--za-line);
}

.za-users #v2UsersGrid .e-gridheader .e-headercell:first-child {
    border-left: 0;
}

.za-users #v2UsersGrid .e-gridcontent .e-rowcell {
    border-bottom: 1px solid var(--za-line);
    border-left: 1px solid var(--za-line);
    font-size: 0.95rem;
    color: var(--za-ink);
    padding-left: 1rem;
    padding-right: 1rem;
}

.za-users #v2UsersGrid .e-gridcontent .e-rowcell:first-child {
    border-left: 0;
}

.za-users #v2UsersGrid .e-gridcontent .e-row:hover .e-rowcell {
    background: #f8fafd;
}

.za-users #v2UsersGrid .e-gridcontent .e-row {
    cursor: pointer;
}

.za-users #v2UsersGrid .e-gridpager {
    border: 0;
    background: transparent;
    padding-top: 0.75rem;
}

.za-users #v2UsersGrid .e-gridpager .e-currentitem {
    background: var(--za-blue);
    color: #fff;
    border-radius: 8px;
}

.za-users #v2UsersGrid .e-gridpager .e-numericitem {
    border-radius: 8px;
}

/* User cell */

.za-users__user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.za-users__avatar {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
}

.za-users__user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.za-users__user-name {
    font-weight: 600;
    color: var(--za-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.za-users__user-email {
    font-size: 0.82rem;
    color: var(--za-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges and chips */

.za-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.za-badge .rzi {
    font-size: 1rem;
    font-variation-settings: 'FILL' 1;
}

.za-badge--green { background: #e6f7ec; color: #178a47; }
.za-badge--orange { background: #fff3e0; color: #c05f00; }
.za-badge--red { background: #fdecec; color: #c62828; }
.za-badge--grey { background: #eef1f5; color: #6b7686; }

.za-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

.za-chip {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.za-chip--green { background: #e6f7ec; color: #178a47; }
.za-chip--orange { background: #fff3e0; color: #c05f00; }
.za-chip--red { background: #fdecec; color: #c62828; }
.za-chip--grey { background: #eef1f5; color: #6b7686; }

/* Kebab */

.za-users .za-users__kebab.rz-button {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 8px;
    background: #f1f4f8;
    color: #2f3947;
    box-shadow: none;
}

.za-users .za-users__kebab.rz-button:hover {
    background: #e3e9f1;
}

.za-users .za-users__kebab .rzi {
    font-size: 1.3rem;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 1300px) {
    .za-users__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .za-users__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .za-users__toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .za-users__toolbar-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 640px) {
    .za-users__stats {
        grid-template-columns: minmax(0, 1fr);
    }
}
