/* ===== ROLES & PERMISSIONS STYLES - Prefix: fxrole- ===== */

/* ===== Dialog — tall and scrollable ===== */
.fxrole-dialog .mud-dialog {
    max-height: 94vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.fxrole-dialog .mud-dialog-content {
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-height: 0 !important;
}

/* Body scrolls independently */
.fxrole-body {
    padding: 20px 28px 26px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.fxrole-body::-webkit-scrollbar { width: 5px; }
.fxrole-body::-webkit-scrollbar-track { background: transparent; }
.fxrole-body::-webkit-scrollbar-thumb { background: rgba(75,62,123,.25); border-radius: 3px; }

/* ===== Table description cell ===== */
.fxrole-td-desc { max-width: 220px; }

.fxrole-desc-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
}

/* ===== Permissions count badge in table ===== */
.fxrole-perm-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 800;
    color: #4B3E7B;
    background: rgba(75,62,123,.10);
    border: 1px solid rgba(75,62,123,.22);
    border-radius: 999px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.fxrole-perm-badge:hover {
    background: rgba(75,62,123,.18);
    transform: translateY(-1px);
}

/* ===== Permissions panel (below table) ===== */
.fxrole-perms-panel {
    margin-top: 14px !important;
    border-radius: 22px !important;
    background: #fff !important;
    border: 2px solid #4B3E7B !important;
    box-shadow: 0 20px 60px rgba(75,62,123,.15) !important;
    overflow: hidden !important;
    padding: 0 !important;
}

.fxrole-perms-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #2D2350 0%, #4B3E7B 100%);
}

.fxrole-perms-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
}

.fxrole-perms-panel-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fxrole-view-cat { display: flex; flex-direction: column; gap: 8px; }

.fxrole-view-cat-title {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #9CA3AF;
}

.fxrole-view-perms { display: flex; flex-wrap: wrap; gap: 6px; }

.fxrole-view-perm-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #059669;
    background: rgba(5,150,105,.08);
    border: 1px solid rgba(5,150,105,.20);
    border-radius: 8px;
    padding: 4px 10px;
}

/* ===== Permission label row ===== */
.fxrole-perm-label-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.fxrole-perm-count-badge {
    font-size: 11px;
    font-weight: 700;
    color: #4B3E7B;
    background: rgba(75,62,123,.10);
    border: 1px solid rgba(75,62,123,.20);
    border-radius: 999px;
    padding: 2px 10px;
}

.fxrole-clear-link {
    font-size: 12px;
    font-weight: 700;
    color: #EF4444;
    cursor: pointer;
    text-decoration: underline;
    margin-left: auto;
}

.fxrole-clear-link:hover { color: #DC2626; }

/* ===== Loading ===== */
.fxrole-perm-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #6B7280;
    font-size: 13px;
    font-weight: 600;
}

/* ===== Scrollable permission list — NO max-height, body scrolls ===== */
.fxrole-perm-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== Category block ===== */
.fxrole-cat-wrap {
    border: 1.5px solid rgba(75,62,123,.18);
    border-radius: 14px;
    overflow: hidden;
}

.fxrole-cat-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #2D2350 0%, #4B3E7B 100%);
    user-select: none;
}

/* Left side: checkbox + name — clicks toggle selection */
.fxrole-cat-hdr-check {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 11px 14px;
    cursor: pointer;
    transition: filter .15s;
}

.fxrole-cat-hdr-check:hover { filter: brightness(1.12); }

/* Right side: count + chevron — clicks toggle expand */
.fxrole-cat-hdr-right {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 14px;
    cursor: pointer;
    border-left: 1px solid rgba(255,255,255,.12);
    transition: background .15s;
}

.fxrole-cat-hdr-right:hover { background: rgba(255,255,255,.08); }

.fxrole-chk-icon   { flex-shrink: 0; }
.fxrole-chk-all    { color: #fff !important; }
.fxrole-chk-partial { color: #FFB547 !important; }
.fxrole-chk-none   { color: rgba(255,255,255,.38) !important; }

.fxrole-cat-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: #fff;
}

.fxrole-cat-cnt {
    font-size: 11px;
    font-weight: 800;
    color: rgba(255,255,255,.70);
    background: rgba(255,255,255,.15);
    border-radius: 999px;
    padding: 2px 8px;
    flex-shrink: 0;
}

.fxrole-expand-icon { color: rgba(255,255,255,.70) !important; }

/* ===== Permission tiles grid ===== */
.fxrole-items-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px;
    background: #F8F8FC;
}

@media (max-width: 540px) {
    .fxrole-items-grid { grid-template-columns: 1fr; }
}

.fxrole-perm-tile {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1.5px solid rgba(0,0,0,.07);
    background: #fff;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
}

.fxrole-perm-tile:hover {
    border-color: rgba(75,62,123,.30);
    background: rgba(75,62,123,.04);
    transform: translateY(-1px);
}

.fxrole-tile-on {
    border-color: #4B3E7B !important;
    background: rgba(75,62,123,.08) !important;
}

.fxrole-tile-check { flex-shrink: 0; margin-top: 1px; }
.fxrole-tile-chk-on  { color: #4B3E7B !important; }
.fxrole-tile-chk-off { color: #D1D5DB !important; }

.fxrole-tile-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fxrole-tile-name {
    font-size: 12px;
    font-weight: 700;
    color: #2D2350;
    line-height: 1.3;
}

.fxrole-tile-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;
    font-weight: 600;
    color: #9CA3AF;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
