/* ==================================================
   CHATNET USER MANAGEMENT
   Place this at the very bottom of style.css
================================================== */

/* Modal container */
#modal .modal-card {
    position: relative;
    width: min(760px, 94vw) !important;
    max-width: 760px !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    padding: 28px !important;
}

/* Modal form */
#modal #modalForm {
    width: 100% !important;
}

/* User manager wrapper */
#modal .user-manager {
    width: 100% !important;
}

/* Create-user button */
#modal #createUserInsideManager {
    display: block !important;
    width: 100% !important;
    margin: 0 0 16px !important;
    padding: 12px 16px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    text-align: center !important;
    font-weight: 700 !important;
    cursor: pointer !important;
}

#modal #createUserInsideManager:hover {
    background: #1d4ed8 !important;
}

/* Table wrapper */
#modal .table-scroll {
    width: 100% !important;
    overflow-x: auto !important;
    border: 1px solid #263247 !important;
    border-radius: 12px !important;
}

/* User table */
#modal .user-table {
    width: 100% !important;
    min-width: 620px !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
}

/* Table cells */
#modal .user-table th,
#modal .user-table td {
    display: table-cell !important;
    padding: 14px 16px !important;
    border-bottom: 1px solid #263247 !important;
    text-align: left !important;
    vertical-align: middle !important;
}

/* Column widths */
#modal .user-table th:nth-child(1),
#modal .user-table td:nth-child(1) {
    width: 46% !important;
}

#modal .user-table th:nth-child(2),
#modal .user-table td:nth-child(2) {
    width: 18% !important;
}

#modal .user-table th:nth-child(3),
#modal .user-table td:nth-child(3) {
    width: 36% !important;
    text-align: right !important;
}

/* Table header */
#modal .user-table th {
    background: #0b1220 !important;
    color: #94a3b8 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    white-space: nowrap !important;
}

/* Remove the final row border */
#modal .user-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

/* Row hover */
#modal .user-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.08) !important;
}

/* User name */
#modal .user-table td strong {
    display: block !important;
    color: #ffffff !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

/* Username */
#modal .user-table td small {
    display: block !important;
    margin-top: 4px !important;
    color: #94a3b8 !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

/* Role column */
#modal .user-table td:nth-child(2) {
    color: #dbeafe !important;
    text-transform: capitalize !important;
    white-space: nowrap !important;
}

/* Actions column */
#modal .user-actions {
    display: table-cell !important;
    white-space: nowrap !important;
    text-align: right !important;
}

/* Action buttons */
#modal .user-actions button {
    display: inline-block !important;
    width: auto !important;
    min-width: 78px !important;
    margin: 2px 0 2px 7px !important;
    padding: 9px 14px !important;
    border: 0 !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    cursor: pointer !important;
}

/* Edit button */
#modal .edit-user-btn {
    background: #2563eb !important;
}

#modal .edit-user-btn:hover {
    background: #1d4ed8 !important;
}

/* Delete button */
#modal .delete-user-btn {
    background: #991b1b !important;
}

#modal .delete-user-btn:hover {
    background: #7f1d1d !important;
}

/* Close button */
#modal .modal-close {
    position: absolute !important;
    top: 10px !important;
    right: 12px !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 4px 8px !important;
    border: 0 !important;
    background: transparent !important;
    color: #ffffff !important;
    font-size: 26px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

/* Create and edit form fields */
#modal #modalForm label {
    display: grid !important;
    gap: 7px !important;
    margin: 14px 0 !important;
}

#modal #modalForm input,
#modal #modalForm select {
    width: 100% !important;
    padding: 12px !important;
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    background: #0b1220 !important;
    color: #ffffff !important;
}

/* Submit button inside edit/create form */
#modal #modalForm > button[type="submit"] {
    width: 100% !important;
    margin-top: 14px !important;
    padding: 12px 16px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    cursor: pointer !important;
}

/* Mobile */
@media (max-width: 700px) {
    #modal .modal-card {
        width: 96vw !important;
        max-height: 90vh !important;
        padding: 22px 16px !important;
    }

    #modal .user-table {
        min-width: 590px !important;
    }

    #modal .user-table th,
    #modal .user-table td {
        padding: 11px 10px !important;
    }

    #modal .user-actions button {
        min-width: 68px !important;
        margin-left: 4px !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
}