/* User Management Panel Styles */
.users-card {
    background: #fff;
    border: 1px solid var(--line, #e6dfe1);
    border-radius: 18px;
    margin-top: 18px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(43, 6, 17, 0.04);
}

.users-header {
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line, #e6dfe1);
    background: linear-gradient(110deg, #fff, #fff9f6);
    flex-wrap: wrap;
    gap: 16px;
}

.users-header .eyebrow {
    margin: 0 0 4px;
    color: #a56316;
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 800;
}

.users-header h2 {
    margin: 0;
    font-size: 1.45rem;
    color: #2b0611;
}

.users-header p {
    margin: 4px 0 0;
    color: var(--muted, #7e7276);
    font-size: .84rem;
}

.btn-add-user {
    border: 0;
    border-radius: 10px;
    padding: 11px 20px;
    background: linear-gradient(100deg, #710f29, #96163a);
    color: #fff;
    font-weight: 800;
    font-size: .86rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(113, 15, 41, 0.22);
    transition: transform .15s ease, box-shadow .15s ease;
}

.btn-add-user:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(113, 15, 41, 0.28);
}

/* User summary stats */
.user-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 20px 28px;
    background: #faf8f9;
    border-bottom: 1px solid var(--line, #e6dfe1);
}

.user-stat-card {
    background: #fff;
    border: 1px solid var(--line, #e6dfe1);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-stat-card i {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 1.15rem;
    flex-shrink: 0;
    background: #f8e8ec;
    color: #710f29;
}

.user-stat-card.active-stat i { background: #e3f4ec; color: #197049; }
.user-stat-card.admin-stat i { background: #fff2d7; color: #9a6100; }
.user-stat-card.staff-stat i { background: #e7eefb; color: #315e9c; }

.user-stat-card div {
    display: flex;
    flex-direction: column;
}

.user-stat-card span {
    font-size: .72rem;
    color: var(--muted, #7e7276);
}

.user-stat-card strong {
    font-size: 1.35rem;
    color: #27191e;
    line-height: 1.1;
    margin-top: 2px;
}

/* Toolbar filters */
.users-toolbar {
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
}

.users-search-wrap {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 380px;
}

.users-search-wrap input {
    width: 100%;
    border: 1px solid var(--line, #e6dfe1);
    border-radius: 9px;
    padding: 9px 12px 9px 34px;
    font: inherit;
    font-size: .84rem;
    outline: none;
    background: #fdfcfc;
}

.users-search-wrap input:focus {
    border-color: #710f29;
    box-shadow: 0 0 0 3px rgba(113, 15, 41, 0.08);
}

.users-search-wrap::before {
    content: "🔍";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8rem;
    opacity: .5;
}

.users-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.users-filters select {
    border: 1px solid var(--line, #e6dfe1);
    border-radius: 9px;
    padding: 9px 12px;
    font: inherit;
    font-size: .84rem;
    background: #fff;
    color: #3b2b31;
    cursor: pointer;
}

/* Users table */
.user-info-cell {
    display: flex;
    align-items: center;
    gap: 11px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #710f29, #9e1a3f);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .8rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-info-cell div {
    display: flex;
    flex-direction: column;
}

.user-info-cell strong {
    font-size: .86rem;
    color: #27191e;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-you {
    background: #fff2d7;
    color: #9a6100;
    font-size: .62rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    text-transform: uppercase;
}

.user-info-cell small {
    color: var(--muted, #7e7276);
    font-size: .72rem;
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.role-admin { background: #fae8ec; color: #710f29; border: 1px solid #f1ccd5; }
.role-manager { background: #fdf2de; color: #8a5700; border: 1px solid #f8dfaa; }
.role-gate_staff { background: #e3f5ec; color: #156d47; border: 1px solid #c2e9d5; }
.role-prasad_staff { background: #e6eefa; color: #205ca1; border: 1px solid #c8dbf6; }
.role-support_staff { background: #f2ebf9; color: #593983; border: 1px solid #dfd1f1; }
.role-custom { background: #f0edee; color: #493f42; border: 1px solid #dbd5d7; }

/* Menu Permission Pills */
.permissions-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 380px;
}

.perm-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #f4eff1;
    color: #492833;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 600;
}

.perm-pill i {
    font-style: normal;
    color: #710f29;
}

.perm-pill.all-access {
    background: #fdf1d9;
    color: #8c5b05;
    font-weight: 700;
    border: 1px solid #f4dbab;
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 12px;
    font-size: .72rem;
    font-weight: 700;
}

.status-pill.active {
    background: #e7f5ee;
    color: #197049;
}

.status-pill.suspended {
    background: #fae8ec;
    color: #a40e2d;
}

/* Action Buttons in Table */
.user-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-user-action {
    border: 1px solid #ded3d6;
    background: #fff;
    color: #4c1825;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: .73rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background .12s ease;
}

.btn-user-action:hover {
    background: #fbf5f7;
    border-color: #710f29;
}

.btn-user-action.delete {
    color: #9d1532;
}

.btn-user-action.delete:hover {
    background: #fae8ec;
    border-color: #ea96a9;
}

.btn-user-action:disabled {
    opacity: .4;
    cursor: not-allowed;
    border-color: #e5dde0;
}

/* Modal overlay & popup */
.user-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(22, 2, 7, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.user-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.user-modal {
    background: #fff;
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(22, 2, 7, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform .22s cubic-bezier(0.2, 0.9, 0.3, 1);
}

#userModalForm {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.user-modal-overlay.open .user-modal {
    transform: translateY(0);
}

.user-modal-head {
    padding: 18px 26px;
    background: linear-gradient(110deg, #440919, #76142e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.user-modal-head h3 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 9px;
}

.user-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: 0;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: grid;
    place-items: center;
    transition: background .15s ease;
}

.user-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-modal-body {
    padding: 22px 26px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-modal-body::-webkit-scrollbar {
    width: 6px;
}
.user-modal-body::-webkit-scrollbar-track {
    background: #f8f4f5;
}
.user-modal-body::-webkit-scrollbar-thumb {
    background: #d6c5ca;
    border-radius: 3px;
}
.user-modal-body::-webkit-scrollbar-thumb:hover {
    background: #9d6878;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-group label {
    font-size: .8rem;
    font-weight: 700;
    color: #3b2229;
}

.form-group label small {
    font-weight: 400;
    color: var(--muted, #7e7276);
}

.form-group input,
.form-group select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line, #e6dfe1);
    border-radius: 9px;
    padding: 10px 12px;
    font: inherit;
    font-size: .86rem;
    outline: none;
    background: #fdfbfb;
    text-overflow: ellipsis;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #710f29;
    box-shadow: 0 0 0 3px rgba(113, 15, 41, 0.08);
}

.password-input-wrap {
    display: flex;
    gap: 6px;
    width: 100%;
}

.password-input-wrap input {
    flex: 1;
    min-width: 0;
}

.btn-secondary-action {
    border: 1px solid var(--line, #e6dfe1);
    background: #f7f1f3;
    color: #551727;
    border-radius: 8px;
    padding: 0 12px;
    font-size: .74rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-secondary-action:hover {
    background: #eedee2;
}

/* Permission selector box */
.perm-box {
    border: 1px solid var(--line, #e6dfe1);
    border-radius: 13px;
    padding: 16px;
    background: #faf7f8;
    width: 100%;
    box-sizing: border-box;
}

.perm-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.perm-box-head strong {
    font-size: .84rem;
    color: #27191e;
}

.perm-quick-btns {
    display: flex;
    gap: 8px;
}

.perm-quick-btns button {
    background: transparent;
    border: 0;
    color: #710f29;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 4px;
    text-decoration: underline;
}

.perm-cards-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    width: 100%;
}

.perm-card-label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--line, #e6dfe1);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    min-width: 0;
    box-sizing: border-box;
}

.perm-card-label:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.perm-card-label:hover {
    border-color: #c9afb6;
    background: #fdfbfb;
}

.perm-card-label.checked {
    border-color: #8c1e3b;
    background: #fff8fa;
}

.perm-card-label input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #710f29;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.perm-card-label div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.perm-card-label b {
    font-size: .8rem;
    color: #2e171f;
    display: flex;
    align-items: center;
    gap: 4px;
}

.perm-card-label small {
    font-size: .68rem;
    color: var(--muted, #7e7276);
    line-height: 1.35;
    margin-top: 2px;
}

.user-modal-foot {
    padding: 14px 26px;
    background: #faf8f9;
    border-top: 1px solid var(--line, #e6dfe1);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.btn-cancel {
    border: 1px solid var(--line, #e6dfe1);
    background: #fff;
    color: #482932;
    padding: 10px 18px;
    border-radius: 9px;
    font-weight: 700;
    font-size: .84rem;
    cursor: pointer;
}

.btn-submit-user {
    border: 0;
    background: linear-gradient(100deg, #710f29, #96163a);
    color: #fff;
    padding: 10px 22px;
    border-radius: 9px;
    font-weight: 800;
    font-size: .84rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(113, 15, 41, 0.2);
}

.btn-submit-user:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* Flash message / Alerts */
.user-alert {
    margin: 18px 28px 0;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-alert.success {
    background: #e7f5ee;
    color: #197049;
    border: 1px solid #c2e9d5;
}

.user-alert.error {
    background: #fae8ec;
    color: #a40e2d;
    border: 1px solid #f1ccd5;
}

.user-alert button {
    background: none;
    border: 0;
    font-size: 1rem;
    cursor: pointer;
    color: inherit;
    line-height: 1;
}

@media (max-width: 850px) {
    .user-stats {
        grid-template-columns: 1fr 1fr;
    }
    .perm-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .users-header {
        padding: 18px;
    }
    .user-stats {
        grid-template-columns: 1fr;
        padding: 14px 18px;
    }
    .users-toolbar {
        padding: 14px 18px;
    }
    .users-search-wrap {
        max-width: 100%;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .user-modal-body {
        padding: 18px;
    }
}

/* ==========================================
   PASSWORD MANAGEMENT PANELS & BUTTONS
   ========================================== */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-info b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .84rem;
}

.sidebar-user-info small {
    display: block;
    color: var(--gold, #e8a93c);
    font-size: .7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-sidebar-pwd {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(232, 169, 60, 0.4);
    background: rgba(232, 169, 60, 0.12);
    color: #ffd678;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all .15s ease;
    font-size: .86rem;
    flex-shrink: 0;
}

.btn-sidebar-pwd:hover {
    background: #e8a93c;
    color: #3b101a;
    transform: translateY(-1px);
}

.admin-top-actions {
    margin-left: auto;
    margin-right: 18px;
    display: flex;
    align-items: center;
}

.btn-top-pwd {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 8px;
    border: 1px solid var(--line, #e6dfe1);
    background: #fff;
    color: #710f29;
    font-weight: 700;
    font-size: .78rem;
    cursor: pointer;
    transition: all .15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

.btn-top-pwd:hover {
    background: #fdf5f7;
    border-color: #710f29;
}

.btn-user-action.btn-modify-user-pwd {
    color: #9a6100;
    border-color: #f0deb8;
    background: #fffdf8;
}

.btn-user-action.btn-modify-user-pwd:hover {
    background: #fff4d8;
    border-color: #e5b357;
    color: #7b4c00;
}

.pwd-modal {
    max-width: 480px;
}

.pwd-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fbf8f9;
    border: 1px solid #ebdfe2;
    border-radius: 12px;
    margin-bottom: 16px;
}

.pwd-user-card .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #710f29, #99163c);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .88rem;
    flex-shrink: 0;
}

.pwd-user-card div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pwd-user-card strong {
    font-size: .95rem;
    color: #2b0611;
}

.pwd-user-card small {
    color: #7e7276;
    font-size: .74rem;
}

.pwd-feedback {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwd-feedback.success {
    background: #eaf8f1;
    color: #146e45;
    border: 1px solid #c2e8d3;
}

.pwd-feedback.error {
    background: #fdf0f2;
    color: #a40e2d;
    border: 1px solid #f6c8d1;
}

.pwd-quick-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.btn-copy-pwd {
    border: 1px solid #ebdfe2;
    background: #fff;
    color: #5b212f;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background .15s ease;
}

.btn-copy-pwd:hover {
    background: #f8eff2;
}

.copy-hint {
    font-size: .74rem;
    color: #197049;
    font-weight: 700;
}

.pwd-security-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 9px;
    background: #f8f6f7;
    border: 1px solid #ebdfe2;
    color: #635056;
    font-size: .75rem;
    line-height: 1.45;
}

.pwd-security-notice i {
    font-style: normal;
    color: #710f29;
}

